Skip to content

Commit 5820370

Browse files
author
Tsvetan Raikov
committed
Added support for debug with livesync
1 parent 9fef7c9 commit 5820370

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

lib/definitions/debug.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
interface IDebugService {
2-
debug(): IFuture<void>;
2+
debug(shouldBreak?: boolean): IFuture<void>;
33
debugStart(): IFuture<void>;
44
platform: string;
55
}

lib/services/ios-debug-service.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ class IOSDebugService implements IDebugService {
6060
} else {
6161
let deploy = this.$platformService.deployOnDevice(this.platform);
6262
deploy.wait();
63-
6463
return this.deviceStart();
6564
}
6665
}
@@ -76,7 +75,9 @@ class IOSDebugService implements IDebugService {
7675
private emulatorDebugBrk(shouldBreak?: boolean): IFuture<void> {
7776
return (() => {
7877
let platformData = this.$platformsData.getPlatformData(this.platform);
79-
this.$platformService.buildPlatform(this.platform).wait();
78+
if (!this.$options.debug) {
79+
this.$platformService.buildPlatform(this.platform).wait();
80+
}
8081
let emulatorPackage = this.$platformService.getLatestApplicationPackageForEmulator(platformData).wait();
8182

8283
let args = shouldBreak ? "--nativescript-debug-brk" : "--nativescript-debug-start";

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

+7-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class IOSLiveSyncService extends liveSyncServiceBaseLib.LiveSyncServiceBase<Mobi
1515
private $injector: IInjector,
1616
private $logger: ILogger,
1717
private $options: IOptions,
18+
private $iOSDebugService: IDebugService,
1819
$liveSyncProvider: ILiveSyncProvider) {
1920
super(_device, $liveSyncProvider);
2021
}
@@ -32,8 +33,12 @@ class IOSLiveSyncService extends liveSyncServiceBaseLib.LiveSyncServiceBase<Mobi
3233
}
3334

3435
protected restartApplication(deviceAppData: Mobile.IDeviceAppData): IFuture<void> {
35-
let projectData: IProjectData = this.$injector.resolve("projectData");
36-
return this.device.applicationManager.restartApplication(deviceAppData.appIdentifier, projectData.projectName);
36+
if (this.$options.debug) {
37+
return this.$iOSDebugService.debug();
38+
} else {
39+
let projectData: IProjectData = this.$injector.resolve("projectData");
40+
return this.device.applicationManager.restartApplication(deviceAppData.appIdentifier, projectData.projectName);
41+
}
3742
}
3843

3944
protected reloadPage(deviceAppData: Mobile.IDeviceAppData): IFuture<void> {

0 commit comments

Comments
 (0)