Skip to content

Commit e70cd89

Browse files
authored
Merge pull request #1976 from NativeScript/raikov/fix-livesync-on-device-simulator
Fixed: First time livesync syncs only on device even when simulator is running
2 parents 07849d6 + 3ec68f9 commit e70cd89

File tree

3 files changed

+0
-32
lines changed

3 files changed

+0
-32
lines changed

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

-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ class AndroidPlatformLiveSyncService extends PlatformLiveSyncServiceBase {
5050
this.$devicesService.execute(action, canExecute).wait();
5151
}).future<void>()();
5252
}
53-
54-
protected getCanExecuteActionCore(platform: string, appIdentifier: string): (dev: Mobile.IDevice) => boolean {
55-
return (device: Mobile.IDevice) => true;
56-
}
5753
}
5854

5955
$injector.register("androidPlatformLiveSyncServiceLocator", {factory: AndroidPlatformLiveSyncService});

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

-20
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,6 @@ class IOSPlatformLiveSyncService extends PlatformLiveSyncServiceBase {
4646
this.$devicesService.execute(action, canExecute).wait();
4747
}).future<void>()();
4848
}
49-
50-
protected getCanExecuteActionCore(platform: string, appIdentifier: string): (dev: Mobile.IDevice) => boolean {
51-
if (this.$options.emulator) {
52-
return (device: Mobile.IDevice): boolean => this.$devicesService.isiOSSimulator(device);
53-
} else {
54-
let devices = this.$devicesService.getDevicesForPlatform(platform);
55-
let simulator = _.find(devices, d => this.$devicesService.isiOSSimulator(d));
56-
if (simulator) {
57-
let iOSDevices = _.filter(devices, d => d.deviceInfo.identifier !== simulator.deviceInfo.identifier);
58-
if (iOSDevices && iOSDevices.length) {
59-
let isApplicationInstalledOnSimulator = simulator.applicationManager.isApplicationInstalled(appIdentifier).wait();
60-
let isApplicationInstalledOnAllDevices = _.intersection.apply(null, iOSDevices.map(device => device.applicationManager.isApplicationInstalled(appIdentifier).wait()));
61-
// In case the application is not installed on both device and simulator, syncs only on device.
62-
if (!isApplicationInstalledOnSimulator && !isApplicationInstalledOnAllDevices) {
63-
return (device: Mobile.IDevice): boolean => this.$devicesService.isiOSDevice(device);
64-
}
65-
}
66-
}
67-
}
68-
}
6949
}
7050

7151
$injector.register("iosPlatformLiveSyncServiceLocator", {factory: IOSPlatformLiveSyncService});

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

-8
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ export abstract class PlatformLiveSyncServiceBase implements IPlatformLiveSyncSe
3131

3232
public abstract fullSync(postAction?: (deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]) => IFuture<void>): IFuture<void>;
3333

34-
protected abstract getCanExecuteActionCore(platform: string, appIdentifier: string): (dev: Mobile.IDevice) => boolean;
35-
3634
public partialSync(event: string, filePath: string, dispatcher: IFutureDispatcher, afterFileSyncAction: (deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]) => IFuture<void>): void {
3735
if (filePath.indexOf(constants.APP_RESOURCES_FOLDER_NAME) !== -1) {
3836
this.$logger.warn(`Skipping livesync for changed file ${filePath}. This change requires a full build to update your application. `.yellow.bold);
@@ -72,12 +70,6 @@ export abstract class PlatformLiveSyncServiceBase implements IPlatformLiveSyncSe
7270
if (this.$options.device) {
7371
return (device: Mobile.IDevice): boolean => isTheSamePlatformAction(device) && device.deviceInfo.identifier === this.$devicesService.getDeviceByDeviceOption().deviceInfo.identifier;
7472
}
75-
76-
let platformCanExecuteAction = this.getCanExecuteActionCore(platform, appIdentifier);
77-
if (platformCanExecuteAction) {
78-
return (device: Mobile.IDevice): boolean => isTheSamePlatformAction(device) && platformCanExecuteAction(device);
79-
}
80-
8173
return isTheSamePlatformAction;
8274
}
8375

0 commit comments

Comments
 (0)