Skip to content

Improved: The live sync successfull message appears twice in the code #1997

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 29, 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
2 changes: 0 additions & 2 deletions lib/commands/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
return (() => {
let projectData: IProjectData = this.$injector.resolve("projectData");

this.$logger.info(`Successfully synced application ${deviceAppData.appIdentifier} on device ${deviceAppData.device.deviceInfo.identifier}.`);

this.debugService.debugStop().wait();

let applicationId = deviceAppData.appIdentifier;
Expand Down
4 changes: 3 additions & 1 deletion lib/services/livesync/android-platform-livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ class AndroidPlatformLiveSyncService extends PlatformLiveSyncServiceBase {
}

if (postAction) {
this.finishLivesync(deviceAppData).wait();
return postAction(deviceAppData, localToDevicePaths).wait();
}

return afterSyncAction().wait();
afterSyncAction().wait();
this.finishLivesync(deviceAppData).wait();
}).future<void>()();
};
this.$devicesService.execute(action, canExecute).wait();
Expand Down
4 changes: 3 additions & 1 deletion lib/services/livesync/ios-platform-livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ class IOSPlatformLiveSyncService extends PlatformLiveSyncServiceBase {
}

if (postAction) {
this.finishLivesync(deviceAppData).wait();
return postAction(deviceAppData, localToDevicePaths).wait();
}

return afterSyncAction().wait();
afterSyncAction().wait();
this.finishLivesync(deviceAppData).wait();
}).future<void>()();
};
this.$devicesService.execute(action, canExecute).wait();
Expand Down
5 changes: 0 additions & 5 deletions lib/services/livesync/livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,7 @@ class LiveSyncService implements ILiveSyncService {
let watchForChangeActions: ((event: string, filePath: string, dispatcher: IFutureDispatcher) => void)[] = [];
_.each(liveSyncData, (dataItem) => {
let service = this.resolvePlatformLiveSyncBaseService(dataItem.platform, dataItem);

watchForChangeActions.push((event: string, filePath: string, dispatcher: IFutureDispatcher) => {
if (!applicationReloadAction) {
applicationReloadAction = (deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[]) => service.refreshApplication(deviceAppData, localToDevicePaths);
}

service.partialSync(event, filePath, dispatcher, applicationReloadAction);
});
service.fullSync(applicationReloadAction).wait();
Expand Down
14 changes: 13 additions & 1 deletion lib/services/livesync/platform-livesync-service-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ export abstract class PlatformLiveSyncServiceBase implements IPlatformLiveSyncSe
let deviceLiveSyncService = this.resolveDeviceSpecificLiveSyncService(deviceAppData.device.deviceInfo.platform, deviceAppData.device);
this.$logger.info("Applying changes...");
deviceLiveSyncService.refreshApplication(deviceAppData, localToDevicePaths, this.liveSyncData.forceExecuteFullSync).wait();
}).future<void>()();
}

protected finishLivesync(deviceAppData: Mobile.IDeviceAppData): IFuture<void> {
return (() => {
// This message is important because it signals Visual Studio Code that livesync has finished and debugger can be attached.
this.$logger.info(`Successfully synced application ${deviceAppData.appIdentifier} on device ${deviceAppData.device.deviceInfo.identifier}.`);
}).future<void>()();
}
Expand Down Expand Up @@ -187,7 +193,13 @@ export abstract class PlatformLiveSyncServiceBase implements IPlatformLiveSyncSe
let localToDevicePaths = this.$projectFilesManager.createLocalToDevicePaths(deviceAppData, this.liveSyncData.projectFilesPath, filesToSync, this.liveSyncData.excludedProjectDirsAndFiles);

fileSyncAction(deviceAppData, localToDevicePaths).wait();
afterFileSyncAction(deviceAppData, localToDevicePaths).wait();
if (!afterFileSyncAction) {
this.refreshApplication(deviceAppData, localToDevicePaths).wait();
}
this.finishLivesync(deviceAppData).wait();
if (afterFileSyncAction) {
afterFileSyncAction(deviceAppData, localToDevicePaths).wait();
}
}).future<void>()();
};

Expand Down