Skip to content

Fixed: First time livesync syncs only on device even when simulator is running #1976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions lib/services/livesync/android-platform-livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ class AndroidPlatformLiveSyncService extends PlatformLiveSyncServiceBase {
this.$devicesService.execute(action, canExecute).wait();
}).future<void>()();
}

protected getCanExecuteActionCore(platform: string, appIdentifier: string): (dev: Mobile.IDevice) => boolean {
return (device: Mobile.IDevice) => true;
}
}

$injector.register("androidPlatformLiveSyncServiceLocator", {factory: AndroidPlatformLiveSyncService});
20 changes: 0 additions & 20 deletions lib/services/livesync/ios-platform-livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,6 @@ class IOSPlatformLiveSyncService extends PlatformLiveSyncServiceBase {
this.$devicesService.execute(action, canExecute).wait();
}).future<void>()();
}

protected getCanExecuteActionCore(platform: string, appIdentifier: string): (dev: Mobile.IDevice) => boolean {
if (this.$options.emulator) {
return (device: Mobile.IDevice): boolean => this.$devicesService.isiOSSimulator(device);
} else {
let devices = this.$devicesService.getDevicesForPlatform(platform);
let simulator = _.find(devices, d => this.$devicesService.isiOSSimulator(d));
if (simulator) {
let iOSDevices = _.filter(devices, d => d.deviceInfo.identifier !== simulator.deviceInfo.identifier);
if (iOSDevices && iOSDevices.length) {
let isApplicationInstalledOnSimulator = simulator.applicationManager.isApplicationInstalled(appIdentifier).wait();
let isApplicationInstalledOnAllDevices = _.intersection.apply(null, iOSDevices.map(device => device.applicationManager.isApplicationInstalled(appIdentifier).wait()));
// In case the application is not installed on both device and simulator, syncs only on device.
if (!isApplicationInstalledOnSimulator && !isApplicationInstalledOnAllDevices) {
return (device: Mobile.IDevice): boolean => this.$devicesService.isiOSDevice(device);
}
}
}
}
}
}

$injector.register("iosPlatformLiveSyncServiceLocator", {factory: IOSPlatformLiveSyncService});
8 changes: 0 additions & 8 deletions lib/services/livesync/platform-livesync-service-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export abstract class PlatformLiveSyncServiceBase implements IPlatformLiveSyncSe

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

protected abstract getCanExecuteActionCore(platform: string, appIdentifier: string): (dev: Mobile.IDevice) => boolean;

public partialSync(event: string, filePath: string, dispatcher: IFutureDispatcher, afterFileSyncAction: (deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]) => IFuture<void>): void {
if (filePath.indexOf(constants.APP_RESOURCES_FOLDER_NAME) !== -1) {
this.$logger.warn(`Skipping livesync for changed file ${filePath}. This change requires a full build to update your application. `.yellow.bold);
Expand Down Expand Up @@ -72,12 +70,6 @@ export abstract class PlatformLiveSyncServiceBase implements IPlatformLiveSyncSe
if (this.$options.device) {
return (device: Mobile.IDevice): boolean => isTheSamePlatformAction(device) && device.deviceInfo.identifier === this.$devicesService.getDeviceByDeviceOption().deviceInfo.identifier;
}

let platformCanExecuteAction = this.getCanExecuteActionCore(platform, appIdentifier);
if (platformCanExecuteAction) {
return (device: Mobile.IDevice): boolean => isTheSamePlatformAction(device) && platformCanExecuteAction(device);
}

return isTheSamePlatformAction;
}

Expand Down