mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-09-18 16:40:39 +08:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b6a08a19c8 | ||
![]() |
ef53716df3 | ||
![]() |
551cbc33cc | ||
![]() |
56e6d790c1 |
@@ -59,6 +59,8 @@ typedef NS_ENUM(NSInteger, HotUpdateType) {
|
|||||||
HotUpdateTypePatchFromPpk = 3,
|
HotUpdateTypePatchFromPpk = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static BOOL ignoreRollback = false;
|
||||||
|
|
||||||
@implementation RCTHotUpdate {
|
@implementation RCTHotUpdate {
|
||||||
RCTHotUpdateManager *_fileManager;
|
RCTHotUpdateManager *_fileManager;
|
||||||
}
|
}
|
||||||
@@ -92,7 +94,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;
|
BOOL needRollback = (!ignoreRollback && isFirstTime == NO && isFirstLoadOK == NO) || loadVersioin.length<=0;
|
||||||
if (needRollback) {
|
if (needRollback) {
|
||||||
loadVersioin = lastVersion;
|
loadVersioin = lastVersion;
|
||||||
|
|
||||||
@@ -112,7 +114,10 @@ RCT_EXPORT_MODULE(RCTHotUpdate);
|
|||||||
[defaults synchronize];
|
[defaults synchronize];
|
||||||
// ...need clear files later
|
// ...need clear files later
|
||||||
}
|
}
|
||||||
else if (isFirstTime){
|
else if (isFirstTime && !ignoreRollback){
|
||||||
|
// bundleURL may be called many times, ignore rollbacks before process restarted again.
|
||||||
|
ignoreRollback = true;
|
||||||
|
|
||||||
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];
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-update",
|
"name": "react-native-update",
|
||||||
"version": "5.2.1",
|
"version": "5.2.3",
|
||||||
"description": "react-native hot update",
|
"description": "react-native hot update",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Reference in New Issue
Block a user