@onekeyfe/react-native-split-bundle-loader 1.1.53 → 1.1.54

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.
@@ -1,14 +1,11 @@
1
1
  #import "SplitBundleLoader.h"
2
2
  #import "SBLLogger.h"
3
- #import <React/RCTBridge.h>
3
+ #import <ReactCommon/RCTHost.h>
4
+ #import <ReactCommon/RCTHost+Internal.h>
5
+ #import <ReactCommon/RCTInstance.h>
4
6
  #import <objc/runtime.h>
5
7
  #include <jsi/jsi.h>
6
8
 
7
- // Bridgeless (New Architecture) support: RCTHost segment registration
8
- @interface RCTHost (SplitBundle)
9
- - (void)registerSegmentWithId:(NSNumber *)segmentId path:(NSString *)path;
10
- @end
11
-
12
9
  @implementation SplitBundleLoader
13
10
 
14
11
  - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
@@ -66,26 +63,16 @@
66
63
 
67
64
  // MARK: - Segment registration helper
68
65
 
69
- /// Registers a segment with the current runtime, supporting both legacy bridge
70
- /// and bridgeless (RCTHost) architectures (#13).
66
+ /// Registers a segment with the current runtime via bridgeless (RCTHost) architecture (#13).
71
67
  ///
72
68
  /// Thread safety (#57): This method is called from the TurboModule (JS thread).
73
- /// RCTBridge.registerSegmentWithId:path: internally registers the segment with
74
- /// the Hermes runtime on the JS thread, which is the correct calling context.
75
69
  /// No queue dispatch is needed.
76
70
  + (BOOL)registerSegment:(int)segmentId path:(NSString *)path error:(NSError **)outError
77
71
  {
78
- // Try legacy bridge first
79
- RCTBridge *bridge = [RCTBridge currentBridge];
80
- if (bridge && [bridge respondsToSelector:@selector(registerSegmentWithId:path:)]) {
81
- [bridge registerSegmentWithId:@(segmentId) path:path];
82
- return YES;
83
- }
84
-
85
- // Try bridgeless RCTHost via AppDelegate
72
+ // Bridgeless (New Architecture): get RCTHost via AppDelegate
86
73
  id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
87
74
  if ([appDelegate respondsToSelector:NSSelectorFromString(@"reactHost")]) {
88
- id host = [appDelegate performSelector:NSSelectorFromString(@"reactHost")];
75
+ RCTHost *host = [appDelegate performSelector:NSSelectorFromString(@"reactHost")];
89
76
  if (host && [host respondsToSelector:@selector(registerSegmentWithId:path:)]) {
90
77
  [host registerSegmentWithId:@(segmentId) path:path];
91
78
  return YES;
@@ -95,7 +82,7 @@
95
82
  if (outError) {
96
83
  *outError = [NSError errorWithDomain:@"SplitBundleLoader"
97
84
  code:1
98
- userInfo:@{NSLocalizedDescriptionKey: @"Neither RCTBridge nor RCTHost available for segment registration"}];
85
+ userInfo:@{NSLocalizedDescriptionKey: @"RCTHost not available for segment registration"}];
99
86
  }
100
87
  return NO;
101
88
  }
@@ -205,7 +192,7 @@
205
192
  return;
206
193
  }
207
194
 
208
- id instance = object_getIvar(host, ivar);
195
+ RCTInstance *instance = object_getIvar(host, ivar);
209
196
  if (!instance) {
210
197
  [SBLLogger warn:@"loadEntryBundle: _instance is nil"];
211
198
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-split-bundle-loader",
3
- "version": "1.1.53",
3
+ "version": "1.1.54",
4
4
  "description": "react-native-split-bundle-loader",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",