isRolledBack bug fixed
This commit is contained in:
parent
702ddbe011
commit
1725699409
@ -20,7 +20,7 @@ static NSString *const paramLastVersion = @"lastVersion";
|
|||||||
static NSString *const paramCurrentVersion = @"currentVersion";
|
static NSString *const paramCurrentVersion = @"currentVersion";
|
||||||
static NSString *const paramIsFirstTime = @"isFirstTime";
|
static NSString *const paramIsFirstTime = @"isFirstTime";
|
||||||
static NSString *const paramIsFirstLoadOk = @"isFirstLoadOK";
|
static NSString *const paramIsFirstLoadOk = @"isFirstLoadOK";
|
||||||
static NSString *const keyFirstLoadLoadMarked = @"REACTNATIVECN_HOTUPDATE_FIRSTLOADMARKED_KEY";
|
static NSString *const keyFirstLoadMarked = @"REACTNATIVECN_HOTUPDATE_FIRSTLOADMARKED_KEY";
|
||||||
static NSString *const keyRolledBackMarked = @"REACTNATIVECN_HOTUPDATE_ROLLEDBACKMARKED_KEY";
|
static NSString *const keyRolledBackMarked = @"REACTNATIVECN_HOTUPDATE_ROLLEDBACKMARKED_KEY";
|
||||||
static NSString *const KeyPackageUpdatedMarked = @"REACTNATIVECN_HOTUPDATE_ISPACKAGEUPDATEDMARKED_KEY";
|
static NSString *const KeyPackageUpdatedMarked = @"REACTNATIVECN_HOTUPDATE_ISPACKAGEUPDATEDMARKED_KEY";
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ RCT_EXPORT_MODULE(RCTHotUpdate);
|
|||||||
BOOL isFirstLoadOK = [updateInfo[paramIsFirstLoadOk] boolValue];
|
BOOL isFirstLoadOK = [updateInfo[paramIsFirstLoadOk] boolValue];
|
||||||
|
|
||||||
NSString *loadVersioin = curVersion;
|
NSString *loadVersioin = curVersion;
|
||||||
BOOL needRollback = (isFirstTime == NO && isFirstLoadOK == NO) || (loadVersioin.length<=0 && lastVersion.length>0);
|
BOOL needRollback = (isFirstTime == NO && isFirstLoadOK == NO) || loadVersioin.length<=0;
|
||||||
if (needRollback) {
|
if (needRollback) {
|
||||||
loadVersioin = lastVersion;
|
loadVersioin = lastVersion;
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ RCT_EXPORT_MODULE(RCTHotUpdate);
|
|||||||
NSMutableDictionary *newInfo = [[NSMutableDictionary alloc] initWithDictionary:updateInfo];
|
NSMutableDictionary *newInfo = [[NSMutableDictionary alloc] initWithDictionary:updateInfo];
|
||||||
newInfo[paramIsFirstTime] = @(NO);
|
newInfo[paramIsFirstTime] = @(NO);
|
||||||
[defaults setObject:newInfo forKey:keyUpdateInfo];
|
[defaults setObject:newInfo forKey:keyUpdateInfo];
|
||||||
[defaults setObject:@(YES) forKey:keyFirstLoadLoadMarked];
|
[defaults setObject:@(YES) forKey:keyFirstLoadMarked];
|
||||||
[defaults synchronize];
|
[defaults synchronize];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,13 +136,13 @@ RCT_EXPORT_MODULE(RCTHotUpdate);
|
|||||||
ret[@"downloadRootDir"] = [RCTHotUpdate downloadDir];
|
ret[@"downloadRootDir"] = [RCTHotUpdate downloadDir];
|
||||||
ret[@"packageVersion"] = [RCTHotUpdate packageVersion];
|
ret[@"packageVersion"] = [RCTHotUpdate packageVersion];
|
||||||
ret[@"isRolledBack"] = [defaults objectForKey:keyRolledBackMarked];
|
ret[@"isRolledBack"] = [defaults objectForKey:keyRolledBackMarked];
|
||||||
ret[@"isFirstTime"] = [defaults objectForKey:keyFirstLoadLoadMarked];
|
ret[@"isFirstTime"] = [defaults objectForKey:keyFirstLoadMarked];
|
||||||
NSDictionary *updateInfo = [defaults dictionaryForKey:keyUpdateInfo];
|
NSDictionary *updateInfo = [defaults dictionaryForKey:keyUpdateInfo];
|
||||||
ret[@"currentVersion"] = [updateInfo objectForKey:paramCurrentVersion];
|
ret[@"currentVersion"] = [updateInfo objectForKey:paramCurrentVersion];
|
||||||
|
|
||||||
// clear isFirstTime
|
// clear isFirstTimemarked
|
||||||
if ([[defaults objectForKey:keyFirstLoadLoadMarked] boolValue]) {
|
if ([[defaults objectForKey:keyFirstLoadMarked] boolValue]) {
|
||||||
[defaults setObject:nil forKey:keyFirstLoadLoadMarked];
|
[defaults setObject:nil forKey:keyFirstLoadMarked];
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear rolledbackmark
|
// clear rolledbackmark
|
||||||
|
Loading…
x
Reference in New Issue
Block a user