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

Commit ffb26fb

Browse files
chore: Remove canStartApplication method
Remove `canStartApplication` method from application managers as it does not have a useful usage. Previously we've used it on Windows and Linux as we did not have a way to start iOS applications. Now, as we have implemented such way through Safari, the method has lost its purpose.
1 parent 0d44865 commit ffb26fb

8 files changed

+1
-36
lines changed

definitions/mobile.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ declare module Mobile {
270270
startApplication(appData: IApplicationData): Promise<void>;
271271
stopApplication(appData: IApplicationData): Promise<void>;
272272
restartApplication(appData: IApplicationData): Promise<void>;
273-
canStartApplication(): boolean;
274273
checkForApplicationUpdates(): Promise<void>;
275274
isLiveSyncSupported(appIdentifier: string): Promise<boolean>;
276275
getApplicationInfo(applicationIdentifier: string): Promise<Mobile.IApplicationInfo>;

mobile/android/android-application-manager.ts

-4
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ export class AndroidApplicationManager extends ApplicationManagerBase {
9292
return Promise.resolve(null);
9393
}
9494

95-
public canStartApplication(): boolean {
96-
return true;
97-
}
98-
9995
public async isLiveSyncSupported(appIdentifier: string): Promise<boolean> {
10096
const liveSyncVersion = await this.adb.sendBroadcastToDevice(LiveSyncConstants.CHECK_LIVESYNC_INTENT_NAME, { "app-id": appIdentifier });
10197
return liveSyncVersion === LiveSyncConstants.VERSION_2 || liveSyncVersion === LiveSyncConstants.VERSION_3;

mobile/application-manager-base.ts

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export abstract class ApplicationManagerBase extends EventEmitter implements Mob
8484
public abstract async stopApplication(appData: Mobile.IApplicationData): Promise<void>;
8585
public abstract async getInstalledApplications(): Promise<string[]>;
8686
public abstract async getApplicationInfo(applicationIdentifier: string): Promise<Mobile.IApplicationInfo>;
87-
public abstract canStartApplication(): boolean;
8887
public abstract async getDebuggableApps(): Promise<Mobile.IDeviceApplicationInformation[]>;
8988
public abstract async getDebuggableAppViews(appIdentifiers: string[]): Promise<IDictionary<Mobile.IDebugWebViewInfo[]>>;
9089

mobile/ios/device/ios-application-manager.ts

-6
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ export class IOSApplicationManager extends ApplicationManagerBase {
1111
private device: Mobile.IDevice,
1212
private $errors: IErrors,
1313
private $iOSNotificationService: IiOSNotificationService,
14-
private $hostInfo: IHostInfo,
15-
private $staticConfig: Config.IStaticConfig,
1614
private $iosDeviceOperations: IIOSDeviceOperations,
1715
private $options: ICommonOptions,
1816
private $deviceLogProvider: Mobile.IDeviceLogProvider) {
@@ -124,10 +122,6 @@ export class IOSApplicationManager extends ApplicationManagerBase {
124122
await this.device.openDeviceLogStream();
125123
}
126124

127-
public canStartApplication(): boolean {
128-
return this.$hostInfo.isDarwin || (this.$hostInfo.isWindows && this.$staticConfig.enableDeviceRunCommandOnWindows);
129-
}
130-
131125
public getDebuggableApps(): Promise<Mobile.IDeviceApplicationInformation[]> {
132126
// Implement when we can find debuggable applications for iOS.
133127
return Promise.resolve([]);

mobile/ios/simulator/ios-simulator-application-manager.ts

-4
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ export class IOSSimulatorApplicationManager extends ApplicationManagerBase {
5454
return this.iosSim.stopApplication(this.identifier, appData.appId, appData.projectName);
5555
}
5656

57-
public canStartApplication(): boolean {
58-
return true;
59-
}
60-
6157
public async getApplicationInfo(applicationIdentifier: string): Promise<Mobile.IApplicationInfo> {
6258
let result: Mobile.IApplicationInfo = null;
6359
const plistContent = await this.getParsedPlistContent(applicationIdentifier);

services/livesync-service-base.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class LiveSyncServiceBase implements ILiveSyncServiceBase {
183183
shouldRefreshApplication = false;
184184
}
185185

186-
if (device.applicationManager.canStartApplication() && !shouldRefreshApplication) {
186+
if (!shouldRefreshApplication) {
187187
await device.applicationManager.startApplication({ appId: appIdentifier, projectName: "" });
188188
}
189189
wasInstalled = false;

test/unit-tests/mobile/application-manager-base.ts

-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ class ApplicationManager extends ApplicationManagerBase {
4040
return null;
4141
}
4242

43-
public canStartApplication(): boolean {
44-
return true;
45-
}
46-
4743
public async getDebuggableApps(): Promise<Mobile.IDeviceApplicationInformation[]> {
4844
return currentlyAvailableAppsForDebugging;
4945
}

test/unit-tests/mobile/devices-service.ts

-15
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ const iOSSimulator = {
7878
},
7979
applicationManager: {
8080
getInstalledApplications: () => Promise.resolve(["com.telerik.unitTest1", "com.telerik.unitTest2"]),
81-
canStartApplication: () => true,
8281
startApplication: (packageName: string, framework: string) => Promise.resolve(),
8382
tryStartApplication: (packageName: string, framework: string) => Promise.resolve(),
8483
reinstallApplication: (packageName: string, packageFile: string) => Promise.resolve(),
@@ -218,7 +217,6 @@ describe("devicesService", () => {
218217
},
219218
applicationManager: {
220219
getInstalledApplications: () => Promise.resolve(["com.telerik.unitTest1", "com.telerik.unitTest2"]),
221-
canStartApplication: () => true,
222220
startApplication: (appData: Mobile.IApplicationData) => Promise.resolve(),
223221
tryStartApplication: (appData: Mobile.IApplicationData) => Promise.resolve(),
224222
reinstallApplication: (packageName: string, packageFile: string) => Promise.resolve(),
@@ -238,7 +236,6 @@ describe("devicesService", () => {
238236
},
239237
applicationManager: {
240238
getInstalledApplications: () => Promise.resolve(["com.telerik.unitTest1", "com.telerik.unitTest2", "com.telerik.unitTest3"]),
241-
canStartApplication: () => true,
242239
startApplication: (appData: Mobile.IApplicationData) => Promise.resolve(),
243240
tryStartApplication: (appData: Mobile.IApplicationData) => Promise.resolve(),
244241
reinstallApplication: (packageName: string, packageFile: string) => Promise.resolve(),
@@ -935,18 +932,6 @@ describe("devicesService", () => {
935932
});
936933
});
937934

938-
it("does not call startApplication when canStartApplication returns false", async () => {
939-
iOSDevice.applicationManager.canStartApplication = () => false;
940-
iOSDevice.applicationManager.startApplication = (): Promise<void> => {
941-
throw new Error("Start application must not be called for iOSDevice when canStartApplication returns false.");
942-
};
943-
944-
const results = devicesService.deployOnDevices([androidDevice.deviceInfo.identifier, iOSDevice.deviceInfo.identifier], "path", "packageName", "cordova");
945-
assert.isTrue(results.length > 0);
946-
const deployOnDevicesResults = await Promise.all(results);
947-
assert.deepEqual(deployOnDevicesResults, [undefined, undefined]);
948-
});
949-
950935
it("throws error when invalid identifier is passed", async () => {
951936
const results = devicesService.deployOnDevices(["invalidDeviceId", iOSDevice.deviceInfo.identifier], "path", "packageName", "cordova");
952937
const expectedErrorMessage = getErrorMessage(testInjector, "NotFoundDeviceByIdentifierErrorMessageWithIdentifier", "invalidDeviceId");

0 commit comments

Comments
 (0)