react-native-update 10.17.1 → 10.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -117,8 +117,7 @@ public class UpdateModuleImpl {
|
|
|
117
117
|
public void run() {
|
|
118
118
|
try {
|
|
119
119
|
updateContext.switchVersion(hash);
|
|
120
|
-
|
|
121
|
-
Application application = activity.getApplication();
|
|
120
|
+
final Application application = (Application) getReactApplicationContext().getApplicationContext();
|
|
122
121
|
ReactInstanceManager instanceManager = updateContext.getCustomReactInstanceManager();
|
|
123
122
|
|
|
124
123
|
if (instanceManager == null) {
|
|
@@ -142,7 +141,9 @@ public class UpdateModuleImpl {
|
|
|
142
141
|
promise.resolve(true);
|
|
143
142
|
} catch (Throwable err) {
|
|
144
143
|
promise.reject("pushy:"+err.getMessage());
|
|
145
|
-
activity
|
|
144
|
+
if (activity != null) {
|
|
145
|
+
activity.recreate();
|
|
146
|
+
}
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
} catch (Throwable err) {
|
|
@@ -176,8 +176,7 @@ public class UpdateModule extends ReactContextBaseJavaModule {
|
|
|
176
176
|
public void run() {
|
|
177
177
|
try {
|
|
178
178
|
updateContext.switchVersion(hash);
|
|
179
|
-
|
|
180
|
-
Application application = activity.getApplication();
|
|
179
|
+
final Application application = (Application) getReactApplicationContext().getApplicationContext();
|
|
181
180
|
ReactInstanceManager instanceManager = updateContext.getCustomReactInstanceManager();
|
|
182
181
|
|
|
183
182
|
if (instanceManager == null) {
|
|
@@ -200,7 +199,9 @@ public class UpdateModule extends ReactContextBaseJavaModule {
|
|
|
200
199
|
instanceManager.recreateReactContextInBackground();
|
|
201
200
|
promise.resolve(null);
|
|
202
201
|
} catch (Throwable err) {
|
|
203
|
-
activity
|
|
202
|
+
if (activity != null) {
|
|
203
|
+
activity.recreate();
|
|
204
|
+
}
|
|
204
205
|
promise.reject(err);
|
|
205
206
|
}
|
|
206
207
|
|
package/ios/RCTPushy/RCTPushy.mm
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
#import "RCTPushy.h"
|
|
2
2
|
#import "RCTPushyDownloader.h"
|
|
3
3
|
#import "RCTPushyManager.h"
|
|
4
|
+
|
|
5
|
+
#if __has_include("RCTReloadCommand.h")
|
|
6
|
+
#import "RCTReloadCommand.h"
|
|
7
|
+
#endif
|
|
4
8
|
// Thanks to this guard, we won't import this header when we build for the old architecture.
|
|
5
9
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
6
10
|
#import "RCTPushySpec.h"
|
|
@@ -311,14 +315,17 @@ RCT_EXPORT_METHOD(reloadUpdate:(NSDictionary *)options
|
|
|
311
315
|
if (hash.length) {
|
|
312
316
|
[self setNeedUpdate:options resolver:resolve rejecter:reject];
|
|
313
317
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
318
|
+
#if __has_include("RCTReloadCommand.h")
|
|
319
|
+
// reload 0.62+
|
|
320
|
+
RCTReloadCommandSetBundleURL([[self class] bundleURL]);
|
|
321
|
+
RCTTriggerReloadCommandListeners(@"pushy reload");
|
|
322
|
+
#else
|
|
323
|
+
// reload in earlier version
|
|
324
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
325
|
+
[self.bridge setValue:[[self class] bundleURL] forKey:@"bundleURL"];
|
|
326
|
+
[self.bridge reload];
|
|
327
|
+
});
|
|
328
|
+
#endif
|
|
322
329
|
resolve(@true);
|
|
323
330
|
}else{
|
|
324
331
|
reject(@"执行报错", nil, nil);
|