This commit is contained in:
dlebu 2016-01-15 15:42:19 -08:00
Родитель 2dddb06560
Коммит 3516619a84
5 изменённых файлов: 15 добавлений и 22 удалений

Просмотреть файл

@ -58,12 +58,8 @@ var CodePush = (function () {
};
CodePush.prototype.getCurrentPackage = function (packageSuccess, packageError) {
NativeAppInfo.isPendingUpdate(function (pendingUpdate) {
if (pendingUpdate) {
LocalPackage.getPackageInfoOrNull(LocalPackage.OldPackageInfoFile, packageSuccess, packageError);
}
else {
LocalPackage.getPackageInfoOrNull(LocalPackage.PackageInfoFile, packageSuccess, packageError);
}
var packageInfoFile = pendingUpdate ? LocalPackage.OldPackageInfoFile : LocalPackage.PackageInfoFile;
LocalPackage.getPackageInfoOrNull(packageInfoFile, packageSuccess, packageError);
});
};
CodePush.prototype.getPendingPackage = function (packageSuccess, packageError) {

Просмотреть файл

@ -74,7 +74,7 @@ public class CodePush extends CordovaPlugin {
Reporting.saveStatus(Reporting.Status.UPDATE_CONFIRMED, currentMetadata.label, currentMetadata.appVersion);
}
this.codePushPackageManager.markUnconfirmedInstall(false);
this.codePushPackageManager.clearNotConfirmedInstall();
this.cleanOldPackageSilently();
callbackContext.success();
@ -177,7 +177,7 @@ public class CodePush extends CordovaPlugin {
private void markUpdate() {
/* this flag will clear when reloading the plugin */
this.didUpdate = true;
this.codePushPackageManager.markUnconfirmedInstall(true);
this.codePushPackageManager.markUnconfirmedInstall();
}
private void cleanOldPackageSilently() {
@ -260,7 +260,7 @@ public class CodePush extends CordovaPlugin {
this.codePushPackageManager.cleanDeployments();
this.codePushPackageManager.clearFailedUpdates();
this.codePushPackageManager.clearPendingInstall();
this.codePushPackageManager.markUnconfirmedInstall(false);
this.codePushPackageManager.clearNotConfirmedInstall();
Reporting.saveStatus(Reporting.Status.STORE_VERSION, null, null);
}
}
@ -278,7 +278,7 @@ public class CodePush extends CordovaPlugin {
Reporting.saveStatus(Reporting.Status.UPDATE_ROLLED_BACK, currentMetadata.label, currentMetadata.appVersion);
/* revert application to the previous version */
this.codePushPackageManager.markUnconfirmedInstall(false);
this.codePushPackageManager.clearNotConfirmedInstall();
this.codePushPackageManager.revertToPreviousVersion();
/* reload the previous version */

Просмотреть файл

@ -96,12 +96,12 @@ public class CodePushPackageManager {
this.codePushPreferences.clearPendingInstall();
}
public void markUnconfirmedInstall(boolean unconfirmed) {
if (unconfirmed) {
this.codePushPreferences.saveNotConfirmedInstall();
} else {
this.codePushPreferences.clearNotConfirmedInstall();
}
public void markUnconfirmedInstall() {
this.codePushPreferences.saveNotConfirmedInstall();
}
public void clearNotConfirmedInstall() {
this.codePushPreferences.clearNotConfirmedInstall();
}
public boolean isNotConfirmedInstall() {

Просмотреть файл

@ -87,7 +87,7 @@ function setupScenario(scenarioPath: string): Q.Promise<void> {
console.log("Body: " + JSON.stringify(req.body));
if (!testMessageResponse) {
console.log("Seding OK");
console.log("Sending OK");
res.sendStatus(200);
} else {
console.log("Sending body: " + testMessageResponse);

Просмотреть файл

@ -97,11 +97,8 @@ class CodePush implements CodePushCordovaPlugin {
*/
public getCurrentPackage(packageSuccess: SuccessCallback<LocalPackage>, packageError?: ErrorCallback): void {
NativeAppInfo.isPendingUpdate((pendingUpdate: boolean) => {
if (pendingUpdate) {
LocalPackage.getPackageInfoOrNull(LocalPackage.OldPackageInfoFile, packageSuccess, packageError);
} else {
LocalPackage.getPackageInfoOrNull(LocalPackage.PackageInfoFile, packageSuccess, packageError);
}
var packageInfoFile = pendingUpdate ? LocalPackage.OldPackageInfoFile : LocalPackage.PackageInfoFile;
LocalPackage.getPackageInfoOrNull(packageInfoFile, packageSuccess, packageError);
});
}