mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 21:33:12 +08:00 
			
		
		
		
	improve iOS reload handling
This commit is contained in:
		| @@ -315,16 +315,15 @@ RCT_EXPORT_METHOD(reloadUpdate:(NSDictionary *)options | |||||||
|         if (hash.length) { |         if (hash.length) { | ||||||
|             // 只在 setNeedUpdate 成功后 resolve |             // 只在 setNeedUpdate 成功后 resolve | ||||||
|             [self setNeedUpdate:options resolver:^(id result) { |             [self setNeedUpdate:options resolver:^(id result) { | ||||||
|                 // reload in earlier version |  | ||||||
|                 dispatch_async(dispatch_get_main_queue(), ^{ |                 dispatch_async(dispatch_get_main_queue(), ^{ | ||||||
|                     [self.bridge setValue:[[self class] bundleURL] forKey:@"bundleURL"]; |  | ||||||
|                     [self.bridge reload]; |  | ||||||
|                 }); |  | ||||||
|                     #if __has_include("RCTReloadCommand.h") |                     #if __has_include("RCTReloadCommand.h") | ||||||
|                         // reload 0.62+ |                         // reload 0.62+ | ||||||
|                         RCTReloadCommandSetBundleURL([[self class] bundleURL]); |                         RCTReloadCommandSetBundleURL([[self class] bundleURL]); | ||||||
|                     RCTTriggerReloadCommandListeners(@"pushy reload"); |                         RCTTriggerReloadCommandListeners(@"pushy reloadUpdate"); | ||||||
|  |                     #else | ||||||
|  |                         [self.bridge reload]; | ||||||
|                     #endif |                     #endif | ||||||
|  |                 }); | ||||||
|                 resolve(@true); |                 resolve(@true); | ||||||
|             } rejecter:^(NSString *code, NSString *message, NSError *error) { |             } rejecter:^(NSString *code, NSString *message, NSError *error) { | ||||||
|                 reject(code, message, error); |                 reject(code, message, error); | ||||||
| @@ -343,13 +342,14 @@ RCT_EXPORT_METHOD(restartApp:(RCTPromiseResolveBlock)resolve | |||||||
| { | { | ||||||
|     @try { |     @try { | ||||||
|         dispatch_async(dispatch_get_main_queue(), ^{ |         dispatch_async(dispatch_get_main_queue(), ^{ | ||||||
|             [self.bridge reload]; |  | ||||||
|         }); |  | ||||||
|             #if __has_include("RCTReloadCommand.h") |             #if __has_include("RCTReloadCommand.h") | ||||||
|                 // reload 0.62+ |                 // reload 0.62+ | ||||||
|                 RCTReloadCommandSetBundleURL([[self class] bundleURL]); |                 RCTReloadCommandSetBundleURL([[self class] bundleURL]); | ||||||
|                 RCTTriggerReloadCommandListeners(@"pushy restartApp"); |                 RCTTriggerReloadCommandListeners(@"pushy restartApp"); | ||||||
|  |             #else | ||||||
|  |                 [self.bridge reload]; | ||||||
|             #endif |             #endif | ||||||
|  |         }); | ||||||
|  |  | ||||||
|         resolve(@true); |         resolve(@true); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "react-native-update", |   "name": "react-native-update", | ||||||
|   "version": "10.29.5", |   "version": "10.29.6", | ||||||
|   "description": "react-native hot update", |   "description": "react-native hot update", | ||||||
|   "main": "src/index", |   "main": "src/index", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm