diff --git a/lib/controllers/run-controller.ts b/lib/controllers/run-controller.ts index bb46da92e5..259a44b99f 100644 --- a/lib/controllers/run-controller.ts +++ b/lib/controllers/run-controller.ts @@ -38,8 +38,10 @@ export class RunController extends EventEmitter implements IRunController { const projectData = this.$projectDataService.getProjectData(projectDir); await this.initializeSetup(projectData); - const platforms = this.$devicesService.getPlatformsFromDeviceDescriptors(deviceDescriptors); const deviceDescriptorsForInitialSync = this.getDeviceDescriptorsForInitialSync(projectDir, deviceDescriptors); + const newPlatforms = this.$devicesService.getPlatformsFromDeviceDescriptors(deviceDescriptors); + const oldPlatforms = this.$liveSyncProcessDataService.getPlatforms(projectDir); + const platforms = _.uniq(_.concat(newPlatforms, oldPlatforms)); this.$liveSyncProcessDataService.persistData(projectDir, deviceDescriptors, platforms); diff --git a/lib/definitions/livesync.d.ts b/lib/definitions/livesync.d.ts index b692609ccb..e4ac2c0d99 100644 --- a/lib/definitions/livesync.d.ts +++ b/lib/definitions/livesync.d.ts @@ -492,5 +492,6 @@ declare global { getAllPersistedData(): IDictionary; persistData(projectDir: string, deviceDescriptors: ILiveSyncDeviceDescriptor[], platforms: string[]): void; hasDeviceDescriptors(projectDir: string): boolean; + getPlatforms(projectDir: string): string[]; } } diff --git a/lib/services/livesync-process-data-service.ts b/lib/services/livesync-process-data-service.ts index 6edd76ef88..9975bdb6d2 100644 --- a/lib/services/livesync-process-data-service.ts +++ b/lib/services/livesync-process-data-service.ts @@ -30,5 +30,11 @@ export class LiveSyncProcessDataService implements ILiveSyncProcessDataService { public getAllPersistedData() { return this.processes; } + + public getPlatforms(projectDir: string): string[] { + const liveSyncProcessesInfo = this.processes[projectDir] || {}; + const currentPlatforms = liveSyncProcessesInfo.platforms; + return currentPlatforms || []; + } } $injector.register("liveSyncProcessDataService", LiveSyncProcessDataService);