Skip to content

Commit f7e5b1d

Browse files
Fatme HavaluovaFatme Havaluova
Fatme Havaluova
authored and
Fatme Havaluova
committed
Move tns related code to common
1 parent b7e67aa commit f7e5b1d

File tree

6 files changed

+25
-6
lines changed

6 files changed

+25
-6
lines changed

lib/definitions/project.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ interface IPlatformProjectService {
3030
buildProject(projectRoot: string): IFuture<void>;
3131
isPlatformPrepared(projectRoot: string): IFuture<boolean>;
3232
addLibrary(platformData: IPlatformData, libraryPath: string): IFuture<void>;
33+
getDebugOnDeviceSetup(): Mobile.IDebugOnDeviceSetup;
3334
}

lib/services/android-project-service.ts

+4
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ class AndroidProjectService implements IPlatformProjectService {
123123
}).future<string>()();
124124
}
125125

126+
public getDebugOnDeviceSetup(): Mobile.IDebugOnDeviceSetup {
127+
return { };
128+
}
129+
126130
private updateMetadata(projectRoot: string): void {
127131
var projMetadataDir = path.join(projectRoot, "assets", "metadata");
128132
var libsmetadataDir = path.join(projectRoot, "../../lib", this.platformData.normalizedPlatformName, AndroidProjectService.METADATA_DIRNAME);

lib/services/ios-project-service.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class IOSProjectService implements IPlatformProjectService {
2020
private $childProcess: IChildProcess,
2121
private $errors: IErrors,
2222
private $logger: ILogger,
23-
private $iOSEmulatorServices: Mobile.IEmulatorPlatformServices) { }
23+
private $iOSEmulatorServices: Mobile.IEmulatorPlatformServices,
24+
private $npm: INodePackageManager) { }
2425

2526
public get platformData(): IPlatformData {
2627
return {
@@ -195,6 +196,15 @@ class IOSProjectService implements IPlatformProjectService {
195196
}).future<void>()();
196197
}
197198

199+
public getDebugOnDeviceSetup(): Mobile.IDebugOnDeviceSetup {
200+
var tnsIosPackage = this.$npm.install("tns-ios").wait();
201+
var safariPath = path.join(tnsIosPackage, "WebInspectorUI/Safari/Main.html");
202+
203+
return {
204+
frontEndPath: safariPath
205+
}
206+
}
207+
198208
private validateDynamicFramework(libraryPath: string): IFuture<void> {
199209
return (() => {
200210
var infoPlistPath = path.join(libraryPath, "Info.plist");

lib/services/platform-service.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,13 @@ export class PlatformService implements IPlatformService {
210210
public debugOnDevice(platform: string): IFuture<void> {
211211
return (() => {
212212
platform = platform.toLowerCase();
213-
213+
var platformData = this.$platformsData.getPlatformData(platform);
214214
var packageFile = "";
215+
var platformData = this.$platformsData.getPlatformData(platform);
215216

216217
if (options["debug-brk"]) {
217218
this.preparePlatform(platform).wait();
218219

219-
var platformData = this.$platformsData.getPlatformData(platform);
220-
221220
var cachedDeviceOption = options.forDevice;
222221
options.forDevice = true;
223222
this.buildPlatform(platform).wait();
@@ -227,8 +226,10 @@ export class PlatformService implements IPlatformService {
227226
this.$logger.out("Using ", packageFile);
228227
}
229228

229+
var debuggerSetup = platformData.platformProjectService.getDebugOnDeviceSetup();
230+
230231
this.$devicesServices.initialize({platform: platform, deviceId: options.device}).wait();
231-
var action = (device: Mobile.IDevice): IFuture<void> => { return device.debug(packageFile, this.$projectData.projectId); };
232+
var action = (device: Mobile.IDevice): IFuture<void> => { return device.debug(packageFile, this.$projectData.projectId, debuggerSetup)};
232233
this.$devicesServices.execute(action).wait();
233234

234235
}).future<void>()();

test/stubs.ts

+3
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ export class PlatformProjectServiceStub implements IPlatformProjectService {
273273
addLibrary(platformData: IPlatformData, libraryPath: string): IFuture<void> {
274274
return Future.fromResult();
275275
}
276+
getDebugOnDeviceSetup(): Mobile.IDebugOnDeviceSetup {
277+
return null;
278+
}
276279
}
277280

278281
export class ProjectDataService implements IProjectDataService {

0 commit comments

Comments
 (0)