mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-05-14 02:14:52 +08:00
clear updates when app version changes
This commit is contained in:
@@ -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 };
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user