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

Commit b661d48

Browse files
Fatme HavaluovaFatme Havaluova
Fatme Havaluova
authored and
Fatme Havaluova
committed
Don't cache installed applications
If livesync android --watch command is executed and the application is not deployed on device, {N} deploys the app on every change. This happens because the installed applications are cached and actually the new application never appears in installed applications. Fixes NativeScript/nativescript-cli#977
1 parent c8562dc commit b661d48

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

mobile/android/android-application-manager.ts

+8-11
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,20 @@
33
import {EOL} from "os";
44

55
export class AndroidApplicationManager implements Mobile.IDeviceApplicationManager {
6-
private _installedApplications: string[];
76

87
constructor(private adb: Mobile.IAndroidDebugBridge,
98
private $staticConfig: Config.IStaticConfig) { }
109

1110
public getInstalledApplications(): IFuture<string[]> {
1211
return (() => {
13-
if (!this._installedApplications) {
14-
let result = this.adb.executeShellCommand(["pm", "list", "packages"]).wait();
15-
let regex = /package:(.+)/;
16-
this._installedApplications = _.map(result.split(EOL), (packageString: string) => {
17-
let match = packageString.match(regex);
18-
return match ? match[1] : null;
19-
}).filter(parsedPackage => parsedPackage !== null);
20-
}
21-
22-
return this._installedApplications;
12+
let result = this.adb.executeShellCommand(["pm", "list", "packages"]).wait();
13+
let regex = /package:(.+)/;
14+
let installedApplications = _.map(result.split(EOL), (packageString: string) => {
15+
let match = packageString.match(regex);
16+
return match ? match[1] : null;
17+
}).filter(parsedPackage => parsedPackage !== null);
18+
19+
return installedApplications;
2320
}).future<string[]>()();
2421
}
2522

0 commit comments

Comments
 (0)