Skip to content

Commit b22110c

Browse files
authored
Merge pull request #1879 from NativeScript/raikov/fix-firsttime-livesync
Fixed: the app is recompiled always when first time livesync
2 parents 7eb92a9 + ba73741 commit b22110c

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ class AndroidLiveSyncService extends liveSyncServiceBaseLib.LiveSyncServiceBase<
7171
}).future<void>()();
7272
}
7373

74-
public afterInstallApplicationAction(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]): IFuture<void> {
75-
return this.deviceHashService.uploadHashFileToDevice(localToDevicePaths);
74+
public afterInstallApplicationAction(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]): IFuture<boolean> {
75+
return (() => {
76+
this.deviceHashService.uploadHashFileToDevice(localToDevicePaths).wait();
77+
return false;
78+
}).future<boolean>()();
7679
}
7780

7881
private getDeviceRootPath(appIdentifier: string): string {

lib/services/livesync/ios-livesync-service.ts

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ class IOSLiveSyncService extends liveSyncServiceBaseLib.LiveSyncServiceBase<Mobi
1919
super(_device, $liveSyncProvider);
2020
}
2121

22+
public afterInstallApplicationAction(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]): IFuture<boolean> {
23+
return (() => {
24+
return this.$options.watch;
25+
}).future<boolean>()();
26+
}
27+
2228
public removeFiles(appIdentifier: string, localToDevicePaths: Mobile.ILocalToDevicePathData[]): IFuture<void> {
2329
return (() => {
2430
_.each(localToDevicePaths, localToDevicePathData => this.device.fileSystem.deleteFile(localToDevicePathData.getDevicePath(), appIdentifier));

lib/services/livesync/livesync-service-base.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ export abstract class LiveSyncServiceBase<T extends Mobile.IDevice> {
77
private $liveSyncProvider: ILiveSyncProvider) { }
88

99
public refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], forceExecuteFullSync: boolean): IFuture<void> {
10-
let canExecuteFastSync = !forceExecuteFullSync && localToDevicePaths &&
11-
_.each(localToDevicePaths, localToDevicePath => this.$liveSyncProvider.canExecuteFastSync(localToDevicePath.getLocalPath(), deviceAppData.platform));
10+
let canExecuteFastSync = !forceExecuteFullSync && localToDevicePaths !== undefined;
11+
for (let localToDevicePath of localToDevicePaths) {
12+
if (!this.$liveSyncProvider.canExecuteFastSync(localToDevicePath.getLocalPath(), deviceAppData.platform)) {
13+
canExecuteFastSync = false;
14+
break;
15+
}
16+
}
1217
if (canExecuteFastSync) {
1318
return this.reloadPage(deviceAppData);
1419
}

0 commit comments

Comments
 (0)