@onekeyfe/react-native-background-thread 3.0.89 → 3.0.90

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.
@@ -66,6 +66,17 @@ typedef NS_ENUM(NSInteger, EBgMgrSegmentEvalError) {
66
66
  /// @param host The RCTHost for the main runtime
67
67
  + (void)installSharedBridgeInMainRuntime:(RCTHost *)host;
68
68
 
69
+ /// Install the main-runtime bridge and start the background runtime only after
70
+ /// that installation has executed on the main JS runtime. Expo initializes its
71
+ /// module registry on the JS thread, so this ordered entry point prevents a
72
+ /// second Expo-backed runtime from registering modules during foreground
73
+ /// runtime startup.
74
+ ///
75
+ /// @param host The RCTHost for the main runtime
76
+ /// @param entryURL The custom entry URL for the background runner
77
+ + (void)installSharedBridgeInMainRuntime:(RCTHost *)host
78
+ thenStartBackgroundRunnerWithEntryURL:(NSString *)entryURL;
79
+
69
80
  /// Start background runner with default entry URL
70
81
  - (void)startBackgroundRunner;
71
82
 
@@ -185,7 +185,8 @@ static NSString *const MODULE_DEBUG_URL = @"http://localhost:8082/apps/mobile/ba
185
185
 
186
186
  #pragma mark - SharedBridge
187
187
 
188
- + (void)installSharedBridgeInMainRuntime:(RCTHost *)host {
188
+ + (void)installSharedBridgeInMainRuntime:(RCTHost *)host
189
+ completion:(dispatch_block_t)completion {
189
190
  if (!host) {
190
191
  [BTLogger error:@"Cannot install SharedBridge: RCTHost is nil"];
191
192
  return;
@@ -225,6 +226,21 @@ static NSString *const MODULE_DEBUG_URL = @"http://localhost:8082/apps/mobile/ba
225
226
  // reload observer reads this to detect host hostDidStart: omissions.
226
227
  [BackgroundThreadManager sharedInstance].mainSharedBridgeInstalled = YES;
227
228
  [BTLogger info:@"SharedStore and SharedRPC installed in main runtime"];
229
+ if (completion) {
230
+ completion();
231
+ }
232
+ }];
233
+ }
234
+
235
+ + (void)installSharedBridgeInMainRuntime:(RCTHost *)host {
236
+ [self installSharedBridgeInMainRuntime:host completion:nil];
237
+ }
238
+
239
+ + (void)installSharedBridgeInMainRuntime:(RCTHost *)host
240
+ thenStartBackgroundRunnerWithEntryURL:(NSString *)entryURL {
241
+ [self installSharedBridgeInMainRuntime:host completion:^{
242
+ [[BackgroundThreadManager sharedInstance]
243
+ startBackgroundRunnerWithEntryURL:entryURL];
228
244
  }];
229
245
  }
230
246
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-background-thread",
3
- "version": "3.0.89",
3
+ "version": "3.0.90",
4
4
  "description": "react-native-background-thread",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",