Skip to content

Commit 4e3477e

Browse files
committed
Add interval for syc wait feedback
1 parent 688e431 commit 4e3477e

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

lib/services/livesync/android-device-livesync-sockets-service.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export class AndroidDeviceSocketsLiveSyncService extends DeviceLiveSyncServiceBa
1515
private $injector: IInjector,
1616
protected $platformsData: IPlatformsData,
1717
protected $staticConfig: Config.IStaticConfig,
18+
private $logger: ILogger,
1819
protected device: Mobile.IAndroidDevice,
1920
private $options: ICommonOptions) {
2021
super($platformsData, device);
@@ -33,7 +34,21 @@ export class AndroidDeviceSocketsLiveSyncService extends DeviceLiveSyncServiceBa
3334
(localToDevicePath: Mobile.ILocalToDevicePathData) => !this.canExecuteFastSync(localToDevicePath.getLocalPath(), projectData, this.device.deviceInfo.platform));
3435

3536
if(liveSyncInfo.modifiedFilesData.length) {
36-
await this.livesyncTool.sendDoSyncOperation();
37+
const operationUid = this.livesyncTool.generateOperationUid();
38+
const doSyncPromise = this.livesyncTool.sendDoSyncOperation(operationUid);
39+
40+
//TODO clear interval on exit sygnals/stopLivesync
41+
const syncInterval : NodeJS.Timer = setInterval(() => {
42+
if(this.livesyncTool.isOperationInProgress(operationUid)){
43+
this.$logger.info("Sync operation in progress...");
44+
}
45+
}, 10000);
46+
47+
const clearSyncInterval = () => {
48+
clearInterval(syncInterval);
49+
}
50+
doSyncPromise.then(clearSyncInterval, clearSyncInterval);
51+
await doSyncPromise;
3752

3853
if(!canExecuteFastSync){
3954
await this.device.applicationManager.restartApplication({ appId: liveSyncInfo.deviceAppData.appIdentifier, projectName: projectData.projectName });

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@
8080
"xmldom": "0.1.21",
8181
"xmlhttprequest": "https://github.com/telerik/node-XMLHttpRequest/tarball/master",
8282
"yargs": "6.0.0",
83-
"zipstream": "https://github.com/Icenium/node-zipstream/tarball/master"
83+
"zipstream": "https://github.com/Icenium/node-zipstream/tarball/master",
84+
"nativescript-android-livesync-lib": "file:../nativescript-android-livesync-lib"
8485
},
8586
"analyze": true,
8687
"devDependencies": {

0 commit comments

Comments
 (0)