1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-16 07:01:38 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

improve iOS reload handling

This commit is contained in:
sunnylqm
2025-06-28 21:40:06 +08:00
parent 6a0a5b2d49
commit d7b5562ab7
2 changed files with 15 additions and 15 deletions

View File

@@ -315,16 +315,15 @@ RCT_EXPORT_METHOD(reloadUpdate:(NSDictionary *)options
if (hash.length) {
// 只在 setNeedUpdate 成功后 resolve
[self setNeedUpdate:options resolver:^(id result) {
// reload in earlier version
dispatch_async(dispatch_get_main_queue(), ^{
[self.bridge setValue:[[self class] bundleURL] forKey:@"bundleURL"];
[self.bridge reload];
#if __has_include("RCTReloadCommand.h")
// reload 0.62+
RCTReloadCommandSetBundleURL([[self class] bundleURL]);
RCTTriggerReloadCommandListeners(@"pushy reloadUpdate");
#else
[self.bridge reload];
#endif
});
#if __has_include("RCTReloadCommand.h")
// reload 0.62+
RCTReloadCommandSetBundleURL([[self class] bundleURL]);
RCTTriggerReloadCommandListeners(@"pushy reload");
#endif
resolve(@true);
} rejecter:^(NSString *code, NSString *message, NSError *error) {
reject(code, message, error);
@@ -343,13 +342,14 @@ RCT_EXPORT_METHOD(restartApp:(RCTPromiseResolveBlock)resolve
{
@try {
dispatch_async(dispatch_get_main_queue(), ^{
[self.bridge reload];
#if __has_include("RCTReloadCommand.h")
// reload 0.62+
RCTReloadCommandSetBundleURL([[self class] bundleURL]);
RCTTriggerReloadCommandListeners(@"pushy restartApp");
#else
[self.bridge reload];
#endif
});
#if __has_include("RCTReloadCommand.h")
// reload 0.62+
RCTReloadCommandSetBundleURL([[self class] bundleURL]);
RCTTriggerReloadCommandListeners(@"pushy restartApp");
#endif
resolve(@true);
}

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-update",
"version": "10.29.5",
"version": "10.29.6",
"description": "react-native hot update",
"main": "src/index",
"scripts": {