clear updates when app version changes

This commit is contained in:
Geoffrey Goh
2016-03-07 18:34:45 -08:00
parent 9eb5131721
commit 89d0ffaeb8
3 changed files with 8 additions and 3 deletions

View File

@@ -40,7 +40,7 @@ async function checkForUpdate(deploymentKey = null) {
* in any updates for current app store version, regardless of hash.
*/
let queryPackage;
if (localPackage && localPackage.appVersion && localPackage.appVersion === config.appVersion) {
if (localPackage) {
queryPackage = localPackage;
} else {
queryPackage = { appVersion: config.appVersion };

View File

@@ -162,7 +162,7 @@ public class CodePush {
} else {
// The binary version is newer.
didUpdate = false;
if (!this.isDebugMode) {
if (!this.isDebugMode || !this.appVersion.equals(packageAppVersion)) {
this.clearUpdates();
}

View File

@@ -100,10 +100,15 @@ static NSString *bundleResourceName = @"main";
isRunningBinaryVersion = NO;
return packageUrl;
} else {
BOOL isRelease = NO;
#ifndef DEBUG
[CodePush clearUpdates];
isRelease = YES;
#endif
if (isRelease || ![binaryAppVersion isEqualToString:packageAppVersion]) {
[CodePush clearUpdates];
}
NSLog(logMessageFormat, binaryBundleURL);
isRunningBinaryVersion = YES;
return binaryBundleURL;