Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Use async API from ios-sim #1092

Merged
merged 1 commit into from
Jun 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions appbuilder/providers/device-app-data-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class IOSAppIdentifier extends AppBuilderDeviceAppDataBase implements ILi
@cache()
public async getDeviceProjectRootPath(): Promise<string> {
if (this.device.isEmulator) {
const applicationPath = this.$iOSSimResolver.iOSSim.getApplicationPath(this.device.deviceInfo.identifier, this.appIdentifier);
const applicationPath = await this.$iOSSimResolver.iOSSim.getApplicationPath(this.device.deviceInfo.identifier, this.appIdentifier);
return path.join(applicationPath, "www");
}

Expand All @@ -127,7 +127,7 @@ export class IOSNativeScriptAppIdentifier extends AppBuilderDeviceAppDataBase im
@cache()
public async getDeviceProjectRootPath(): Promise<string> {
if (this.device.isEmulator) {
const applicationPath = this.$iOSSimResolver.iOSSim.getApplicationPath(this.device.deviceInfo.identifier, this.appIdentifier);
const applicationPath = await this.$iOSSimResolver.iOSSim.getApplicationPath(this.device.deviceInfo.identifier, this.appIdentifier);
return applicationPath;
}

Expand Down
2 changes: 1 addition & 1 deletion definitions/mobile.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ declare module Mobile {
* @param {string} deviceId The unique identifier of the device.
* @param {Mobile.IiOSLogStreamOptions} options Describes the options which can be passed
*/
startLogProcess(deviceId: string, options?: Mobile.IiOSLogStreamOptions): void;
startLogProcess(deviceId: string, options?: Mobile.IiOSLogStreamOptions): Promise<void>;
/**
* Starts a new process for getting simulator logs and emits and DEVICE_LOG_EVENT_NAME event. The event's reponse is with muted=true flag so it will not be printed from deviceLogProvider.
* @param {string} deviceId The unique identifier of the device.
Expand Down
6 changes: 3 additions & 3 deletions mobile/ios/simulator/ios-simulator-application-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ export class IOSSimulatorApplicationManager extends ApplicationManagerBase {
}
}

this.iosSim.installApplication(this.device.deviceInfo.identifier, packageFilePath);
return this.iosSim.installApplication(this.device.deviceInfo.identifier, packageFilePath);
}

public async uninstallApplication(appIdentifier: string): Promise<void> {
return this.iosSim.uninstallApplication(this.device.deviceInfo.identifier, appIdentifier);
}

public async startApplication(appData: Mobile.IApplicationData): Promise<void> {
const launchResult = this.iosSim.startApplication(this.device.deviceInfo.identifier, appData.appId);
const launchResult = await this.iosSim.startApplication(this.device.deviceInfo.identifier, appData.appId);
const pid = getPidFromiOSSimulatorLogs(appData.appId, launchResult);
await this.setDeviceLogData(appData, pid);
}
Expand Down Expand Up @@ -87,7 +87,7 @@ export class IOSSimulatorApplicationManager extends ApplicationManagerBase {
return null;
}

const applicationPath = this.iosSim.getApplicationPath(this.device.deviceInfo.identifier, appIdentifier),
const applicationPath = await this.iosSim.getApplicationPath(this.device.deviceInfo.identifier, appIdentifier),
pathToInfoPlist = path.join(applicationPath, "Info.plist");

return this.$fs.exists(pathToInfoPlist) ? await this.$plistParser.parseFile(pathToInfoPlist) : null;
Expand Down
2 changes: 1 addition & 1 deletion mobile/ios/simulator/ios-simulator-device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class IOSSimulator implements Mobile.IiOSSimulator {
public async openDeviceLogStream(options?: Mobile.IiOSLogStreamOptions): Promise<void> {
this._deviceLogHandler = this.onDeviceLog.bind(this, options);
this.$iOSSimulatorLogProvider.on(constants.DEVICE_LOG_EVENT_NAME, this._deviceLogHandler);
this.$iOSSimulatorLogProvider.startLogProcess(this.simulator.id, options);
return this.$iOSSimulatorLogProvider.startLogProcess(this.simulator.id, options);
}

public detach(): void {
Expand Down
4 changes: 2 additions & 2 deletions mobile/ios/simulator/ios-simulator-log-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export class IOSSimulatorLogProvider extends EventEmitter implements Mobile.IiOS
this.shouldDispose = shouldDispose;
}

public startLogProcess(deviceId: string, options?: Mobile.IiOSLogStreamOptions): void {
public async startLogProcess(deviceId: string, options?: Mobile.IiOSLogStreamOptions): Promise<void> {
if (!this.simulatorsLoggingEnabled[deviceId]) {
const deviceLogChildProcess: ChildProcess = this.$iOSSimResolver.iOSSim.getDeviceLogProcess(deviceId, options ? options.predicate : null);
const deviceLogChildProcess: ChildProcess = await this.$iOSSimResolver.iOSSim.getDeviceLogProcess(deviceId, options ? options.predicate : null);

const action = (data: NodeBuffer | string) => {
const message = data.toString();
Expand Down