forked from NativeScript/nativescript-app-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTNSAcquisitionManager.ts
37 lines (31 loc) · 1.41 KB
/
TNSAcquisitionManager.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
import * as AppVersion from "nativescript-appversion";
import { AcquisitionManager as AppSyncSDK } from "nativescript-app-sync-sdk/script/acquisition-sdk";
import { Device } from "@nativescript/core";
import { TNSRequester } from "./TNSRequester";
export class TNSAcquisitionManager {
private appSyncSDK: AcquisitionManager;
constructor(deploymentKey: string, serverUrl: string) {
const config: Configuration = {
serverUrl,
appVersion: AppVersion.getVersionNameSync(),
clientUniqueId: Device.uuid,
deploymentKey
};
this.appSyncSDK = new AppSyncSDK(new TNSRequester(), config);
return this;
}
queryUpdateWithCurrentPackage(currentPackage: IPackage, callback?: Callback<IRemotePackage | NativeUpdateNotification>): void {
this.appSyncSDK.queryUpdateWithCurrentPackage(currentPackage, callback);
}
reportStatusDeploy(pkg?: IPackage, status?: string, previousLabelOrAppVersion?: string, previousDeploymentKey?: string): void {
this.appSyncSDK.reportStatusDeploy(pkg, status, previousLabelOrAppVersion, previousDeploymentKey, () => {
// console.log("---- reportStatusDeploy completed, status: " + status);
// console.log("---- reportStatusDeploy completed, pkg: " + JSON.stringify(pkg));
});
}
reportStatusDownload(pkg: IPackage): void {
this.appSyncSDK.reportStatusDownload(pkg, () => {
// console.log("---- reportStatusDownload completed");
});
}
}