diff --git a/definitions/mobile.d.ts b/definitions/mobile.d.ts index e867d32c..ee10e9b7 100644 --- a/definitions/mobile.d.ts +++ b/definitions/mobile.d.ts @@ -238,7 +238,7 @@ declare module Mobile { uninstallApplication(appIdentifier: string): Promise; reinstallApplication(appIdentifier: string, packageFilePath: string): Promise; startApplication(appIdentifier: string): Promise; - stopApplication(appIdentifier: string): Promise; + stopApplication(appIdentifier: string, appName?: string): Promise; restartApplication(appIdentifier: string, appName?: string): Promise; canStartApplication(): boolean; checkForApplicationUpdates(): Promise; diff --git a/mobile/application-manager-base.ts b/mobile/application-manager-base.ts index 4c079f4d..0e1a25ed 100644 --- a/mobile/application-manager-base.ts +++ b/mobile/application-manager-base.ts @@ -17,7 +17,7 @@ export abstract class ApplicationManagerBase extends EventEmitter implements Mob } public async restartApplication(appIdentifier: string, appName?: string): Promise { - await this.stopApplication(appName || appIdentifier); + await this.stopApplication(appIdentifier, appName); await this.startApplication(appIdentifier); } @@ -70,7 +70,7 @@ export abstract class ApplicationManagerBase extends EventEmitter implements Mob public abstract async installApplication(packageFilePath: string): Promise; public abstract async uninstallApplication(appIdentifier: string): Promise; public abstract async startApplication(appIdentifier: string): Promise; - public abstract async stopApplication(appIdentifier: string): Promise; + public abstract async stopApplication(appIdentifier: string, appName?: string): Promise; public abstract async getInstalledApplications(): Promise; public abstract async getApplicationInfo(applicationIdentifier: string): Promise; public abstract canStartApplication(): boolean; diff --git a/mobile/ios/device/ios-application-manager.ts b/mobile/ios/device/ios-application-manager.ts index 732a2ffe..a00bfe09 100644 --- a/mobile/ios/device/ios-application-manager.ts +++ b/mobile/ios/device/ios-application-manager.ts @@ -87,12 +87,12 @@ export class IOSApplicationManager extends ApplicationManagerBase { this.$logger.info(`Successfully run application ${appIdentifier} on device with ID ${this.device.deviceInfo.identifier}.`); } - public async stopApplication(appIdentifier: string): Promise { + public async stopApplication(appIdentifier: string, appName?: string): Promise { await this.$iosDeviceOperations.stop([{ deviceId: this.device.deviceInfo.identifier, ddi: this.$options.ddi, appId: appIdentifier }]); } - public async restartApplication(applicationId: string): Promise { - await this.stopApplication(applicationId); + public async restartApplication(applicationId: string, appName?: string): Promise { + await this.stopApplication(applicationId, appName); await this.runApplicationCore(applicationId); } diff --git a/mobile/ios/simulator/ios-simulator-application-manager.ts b/mobile/ios/simulator/ios-simulator-application-manager.ts index 680abc68..588bc345 100644 --- a/mobile/ios/simulator/ios-simulator-application-manager.ts +++ b/mobile/ios/simulator/ios-simulator-application-manager.ts @@ -20,7 +20,6 @@ export class IOSSimulatorApplicationManager extends ApplicationManagerBase { return this.iosSim.getInstalledApplications(this.identifier); } - // TODO: Remove Promise, reason: readDirectory - cannot until android and iOS implementatios have async calls. @hook('install') public async installApplication(packageFilePath: string): Promise { if (this.$fs.exists(packageFilePath) && path.extname(packageFilePath) === ".zip") { @@ -50,8 +49,8 @@ export class IOSSimulatorApplicationManager extends ApplicationManagerBase { } } - public async stopApplication(cfBundleExecutable: string): Promise { - return this.iosSim.stopApplication(this.identifier, cfBundleExecutable); + public async stopApplication(appIdentifier: string, appName: string): Promise { + return this.iosSim.stopApplication(this.identifier, appIdentifier, appName); } public canStartApplication(): boolean { diff --git a/package.json b/package.json index 76dadfa6..f4a0a2f4 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "iconv-lite": "0.4.3", "inquirer": "0.8.2", "ios-device-lib": "~0.3.0", - "ios-sim-portable": "~2.0.0", + "ios-sim-portable": "~3.0.0", "lodash": "4.13.1", "log4js": "0.6.9", "marked": "0.3.3",