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