1+ ///<reference path="../.d.ts"/>
2+ "use strict" ;
3+ import deviceAppDataBaseLib = require( "../common/mobile/device-app-data/device-app-data-base" ) ;
4+ import constantsLib = require( "../common/mobile/constants" ) ;
5+ import Future = require( "fibers/future" ) ;
6+
7+ export class IOSAppIdentifier extends deviceAppDataBaseLib . DeviceAppDataBase implements Mobile . IDeviceAppData {
8+ private static DEVICE_PROJECT_ROOT_PATH = "Library/Application Support/LiveSync" ;
9+
10+ constructor ( _appIdentifier : string ) {
11+ super ( _appIdentifier ) ;
12+ }
13+
14+ public get deviceProjectRootPath ( ) : string {
15+ return this . getDeviceProjectRootPath ( IOSAppIdentifier . DEVICE_PROJECT_ROOT_PATH ) ;
16+ }
17+
18+ public isLiveSyncSupported ( device : Mobile . IDevice ) : IFuture < boolean > {
19+ return Future . fromResult ( true ) ;
20+ }
21+ }
22+
23+ export class AndroidAppIdentifier extends deviceAppDataBaseLib . DeviceAppDataBase implements Mobile . IDeviceAppData {
24+ constructor ( _appIdentifier : string ) {
25+ super ( _appIdentifier ) ;
26+ }
27+
28+ public get deviceProjectRootPath ( ) : string {
29+ return `/data/local/tmp/12590FAA-5EDD-4B12-856D-F52A0A1599F2/${ this . appIdentifier } ` ;
30+ }
31+
32+ public isLiveSyncSupported ( device : Mobile . IDevice ) : IFuture < boolean > {
33+ return Future . fromResult ( true ) ;
34+ }
35+ }
36+
37+ export class AndroidCompanionAppIdentifier extends deviceAppDataBaseLib . CompanionDeviceAppDataBase implements Mobile . IDeviceAppData {
38+ private static APP_IDENTIFIER = "com.telerik.NativeScript" ;
39+
40+ constructor ( ) {
41+ super ( AndroidCompanionAppIdentifier . APP_IDENTIFIER ) ;
42+ }
43+
44+ public get deviceProjectRootPath ( ) : string {
45+ return `/mnt/sdcard/Android/data/${ this . appIdentifier } /files/12590FAA-5EDD-4B12-856D-F52A0A1599F2` ;
46+ }
47+ }
48+
49+ export class DeviceAppDataProvider implements Mobile . IDeviceAppDataProvider {
50+ public createFactoryRules ( ) : IDictionary < Mobile . IDeviceAppDataFactoryRule > {
51+ return {
52+ iOS : {
53+ vanilla : IOSAppIdentifier
54+ } ,
55+ Android : {
56+ vanilla : AndroidAppIdentifier ,
57+ companion : AndroidCompanionAppIdentifier
58+ }
59+ }
60+ }
61+ }
62+ $injector . register ( "deviceAppDataProvider" , DeviceAppDataProvider ) ;
0 commit comments