Skip to content

Commit d7b5562

Browse files
committed
improve iOS reload handling
1 parent 6a0a5b2 commit d7b5562

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

ios/RCTPushy/RCTPushy.mm

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -315,16 +315,15 @@ - (instancetype)init
315315
if (hash.length) {
316316
// 只在 setNeedUpdate 成功后 resolve
317317
[self setNeedUpdate:options resolver:^(id result) {
318-
// reload in earlier version
319318
dispatch_async(dispatch_get_main_queue(), ^{
320-
[self.bridge setValue:[[self class] bundleURL] forKey:@"bundleURL"];
321-
[self.bridge reload];
319+
#if __has_include("RCTReloadCommand.h")
320+
// reload 0.62+
321+
RCTReloadCommandSetBundleURL([[self class] bundleURL]);
322+
RCTTriggerReloadCommandListeners(@"pushy reloadUpdate");
323+
#else
324+
[self.bridge reload];
325+
#endif
322326
});
323-
#if __has_include("RCTReloadCommand.h")
324-
// reload 0.62+
325-
RCTReloadCommandSetBundleURL([[self class] bundleURL]);
326-
RCTTriggerReloadCommandListeners(@"pushy reload");
327-
#endif
328327
resolve(@true);
329328
} rejecter:^(NSString *code, NSString *message, NSError *error) {
330329
reject(code, message, error);
@@ -343,13 +342,14 @@ - (instancetype)init
343342
{
344343
@try {
345344
dispatch_async(dispatch_get_main_queue(), ^{
346-
[self.bridge reload];
345+
#if __has_include("RCTReloadCommand.h")
346+
// reload 0.62+
347+
RCTReloadCommandSetBundleURL([[self class] bundleURL]);
348+
RCTTriggerReloadCommandListeners(@"pushy restartApp");
349+
#else
350+
[self.bridge reload];
351+
#endif
347352
});
348-
#if __has_include("RCTReloadCommand.h")
349-
// reload 0.62+
350-
RCTReloadCommandSetBundleURL([[self class] bundleURL]);
351-
RCTTriggerReloadCommandListeners(@"pushy restartApp");
352-
#endif
353353

354354
resolve(@true);
355355
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-update",
3-
"version": "10.29.5",
3+
"version": "10.29.6",
44
"description": "react-native hot update",
55
"main": "src/index",
66
"scripts": {

0 commit comments

Comments
 (0)