Skip to content

Commit 64790c4

Browse files
authored
Merge pull request #1910 from NativeScript/raikov/improve-livesync
Improved livesync behavior to start emulators if not running
2 parents 2429d03 + ef2614c commit 64790c4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/services/livesync/livesync-service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,19 @@ class LiveSyncService implements ILiveSyncService {
4545
public liveSync(platform: string): IFuture<void> {
4646
return (() => {
4747
let liveSyncData: ILiveSyncData[] = [];
48-
this.$devicesService.initialize({ skipInferPlatform: true }).wait();
4948
if (platform) {
49+
this.$devicesService.initialize({ platform: platform, deviceId: this.$options.device }).wait();
5050
liveSyncData.push(this.prepareLiveSyncData(platform));
5151
} else if (this.$options.device) {
52+
this.$devicesService.initialize({ platform: platform, deviceId: this.$options.device }).wait();
5253
platform = this.$devicesService.getDeviceByIdentifier(this.$options.device).deviceInfo.platform;
5354
liveSyncData.push(this.prepareLiveSyncData(platform));
5455
} else {
56+
this.$devicesService.initialize({ skipInferPlatform: true }).wait();
5557
for(let installedPlatform of this.$platformService.getInstalledPlatforms().wait()) {
58+
if (this.$devicesService.getDevicesForPlatform(installedPlatform).length === 0) {
59+
this.$devicesService.startEmulator(installedPlatform).wait();
60+
}
5661
liveSyncData.push(this.prepareLiveSyncData(installedPlatform));
5762
}
5863
}

0 commit comments

Comments
 (0)