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

Commit 464a6ba

Browse files
Fatme Havaluovateobugslayer
Fatme Havaluova
authored andcommitted
Fix run, livesync, run workflow
Fixes NativeScript/nativescript-cli#896
1 parent 8f32e42 commit 464a6ba

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

definitions/mobile.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ declare module Mobile {
7070
getInstalledApplications(): IFuture<string[]>;
7171
installApplication(packageFilePath: string): IFuture<void>;
7272
uninstallApplication(appIdentifier: string): IFuture<void>;
73+
reinstallApplication(applicationId: string, packageFilePath: string): IFuture<void>;
7374
startApplication(appIdentifier: string): IFuture<void>;
7475
stopApplication(appIdentifier: string): IFuture<void>;
7576
restartApplication(applicationId: string): IFuture<void>;

mobile/android/android-application-manager.ts

+7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ export class AndroidApplicationManager implements Mobile.IDeviceApplicationManag
3131
return this.adb.executeShellCommand(["pm", "uninstall", `${appIdentifier}`]);
3232
}
3333

34+
public reinstallApplication(applicationId: string, packageFilePath: string): IFuture<void> {
35+
return (() => {
36+
this.uninstallApplication(applicationId).wait();
37+
this.installApplication(packageFilePath).wait();
38+
}).future<void>()();
39+
}
40+
3441
public startApplication(appIdentifier: string): IFuture<void> {
3542
return this.adb.executeShellCommand(["am", "start",
3643
"-a", "android.intent.action.MAIN",

mobile/android/android-device.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ export class AndroidDevice implements Mobile.IAndroidDevice {
4848

4949
public deploy(packageFile: string, packageName: string): IFuture<void> {
5050
return (() => {
51-
this.applicationManager.uninstallApplication(packageName).wait();
52-
this.applicationManager.installApplication(packageFile).wait();
51+
this.applicationManager.reinstallApplication(packageName, packageFile).wait();
5352
this.applicationManager.startApplication(packageName).wait();
5453
this.$logger.info("Successfully deployed on device with identifier '%s'", this.identifier);
5554
}).future<void>()();

mobile/ios/ios-application-manager.ts

+7
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ export class IOSApplicationManager implements Mobile.IDeviceApplicationManager {
5858
}).future<void>()();
5959
}
6060

61+
public reinstallApplication(applicationId: string, packageFilePath: string): IFuture<void> {
62+
return (() => {
63+
this.uninstallApplication(applicationId).wait();
64+
this.installApplication(packageFilePath).wait();
65+
}).future<void>()();
66+
}
67+
6168
public startApplication(applicationId: string): IFuture<void> {
6269
return (() => {
6370
if(this.$hostInfo.isWindows && !this.$staticConfig.enableDeviceRunCommandOnWindows) {

mobile/ios/ios-device.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ export class IOSDevice implements Mobile.IiOSDevice {
290290
return this.tryExecuteFunction<number>(func);
291291
}
292292

293-
public deploy(packageFile: string): IFuture<void> {
294-
return this.applicationManager.installApplication(packageFile);
293+
public deploy(packageFile: string, packageName: string): IFuture<void> {
294+
return this.applicationManager.reinstallApplication(packageName, packageFile);
295295
}
296296

297297
public openDeviceLogStream() {

0 commit comments

Comments
 (0)