Skip to content

Commit 53f35ff

Browse files
Fatme HavaluovaFatme Havaluova
Fatme Havaluova
authored and
Fatme Havaluova
committed
Move tns related code to common
1 parent dd2361e commit 53f35ff

File tree

6 files changed

+24
-7
lines changed

6 files changed

+24
-7
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 {
@@ -194,6 +195,15 @@ class IOSProjectService implements IPlatformProjectService {
194195
}).future<void>()();
195196
}
196197

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

lib/services/platform-service.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -209,22 +209,21 @@ export class PlatformService implements IPlatformService {
209209
public debugOnDevice(platform: string): IFuture<void> {
210210
return (() => {
211211
platform = platform.toLowerCase();
212-
212+
var platformData = this.$platformsData.getPlatformData(platform);
213213
var packageFile = "";
214214

215215
if (options["debug-brk"]) {
216216
this.preparePlatform(platform).wait();
217-
218-
var platformData = this.$platformsData.getPlatformData(platform);
219-
220217
this.buildPlatform(platform).wait();
221218

222219
packageFile = this.getLatestApplicationPackageForDevice(platformData).wait().packageName;
223220
this.$logger.out("Using ", packageFile);
224221
}
225222

223+
var debuggerSetup = platformData.platformProjectService.getDebugOnDeviceSetup();
224+
226225
this.$devicesServices.initialize({platform: platform, deviceId: options.device}).wait();
227-
var action = (device: Mobile.IDevice): IFuture<void> => { return device.debug(packageFile, this.$projectData.projectId); };
226+
var action = (device: Mobile.IDevice): IFuture<void> => { return device.debug(packageFile, this.$projectData.projectId, debuggerSetup)};
228227
this.$devicesServices.execute(action).wait();
229228

230229
}).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)