@hot-updater/react-native 0.25.7 → 0.25.8

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.
@@ -102,8 +102,8 @@ public protocol BundleStorageService {
102
102
  // Bundle URL operations
103
103
  func setBundleURL(localPath: String?) -> Result<Void, Error>
104
104
  func getCachedBundleURL() -> URL?
105
- func getFallbackBundleURL() -> URL? // Synchronous as it's lightweight
106
- func getBundleURL() -> URL?
105
+ func getFallbackBundleURL(bundle: Bundle) -> URL? // Synchronous as it's lightweight
106
+ func getBundleURL(bundle: Bundle) -> URL?
107
107
 
108
108
  // Bundle update
109
109
  func updateBundle(bundleId: String, fileUrl: URL?, fileHash: String?, progressHandler: @escaping (Double) -> Void, completion: @escaping (Result<Bool, Error>) -> Void)
@@ -588,20 +588,21 @@ class BundleFileStorageService: BundleStorageService {
588
588
 
589
589
  /**
590
590
  * Gets the URL to the fallback bundle included in the app.
591
+ * @param bundle instance to lookup the JavaScript bundle resource.
591
592
  * @return URL to the fallback bundle or nil if not found
592
593
  */
593
- func getFallbackBundleURL() -> URL? {
594
- return Bundle.main.url(forResource: "main", withExtension: "jsbundle")
594
+ func getFallbackBundleURL(bundle: Bundle) -> URL? {
595
+ return bundle.url(forResource: "main", withExtension: "jsbundle")
595
596
  }
596
597
 
597
- public func getBundleURL() -> URL? {
598
+ public func getBundleURL(bundle: Bundle) -> URL? {
598
599
  // Try to load metadata
599
600
  let metadata = loadMetadataOrNull()
600
601
 
601
602
  // If no metadata exists, use legacy behavior (backwards compatible)
602
603
  guard let metadata = metadata else {
603
604
  let cached = getCachedBundleURL()
604
- return cached ?? getFallbackBundleURL()
605
+ return cached ?? getFallbackBundleURL(bundle: bundle)
605
606
  }
606
607
 
607
608
  // Check if we need to handle crash recovery
@@ -626,7 +627,7 @@ class BundleFileStorageService: BundleStorageService {
626
627
 
627
628
  // Reload metadata after potential rollback
628
629
  guard let currentMetadata = loadMetadataOrNull() else {
629
- return getCachedBundleURL() ?? getFallbackBundleURL()
630
+ return getCachedBundleURL() ?? getFallbackBundleURL(bundle: bundle)
630
631
  }
631
632
 
632
633
  // If verification is pending, return staging bundle URL
@@ -652,7 +653,7 @@ class BundleFileStorageService: BundleStorageService {
652
653
  }
653
654
 
654
655
  // Fallback to app bundle
655
- return getFallbackBundleURL()
656
+ return getFallbackBundleURL(bundle: bundle)
656
657
  }
657
658
 
658
659
  // MARK: - Bundle Update
@@ -177,16 +177,25 @@ RCT_EXPORT_MODULE();
177
177
  }
178
178
 
179
179
 
180
- // Get bundleURL using singleton
180
+ // Get bundleURL with default bundle using singleton
181
181
  + (NSURL *)bundleURL {
182
- return [[HotUpdater sharedImpl] bundleURL];
182
+ return [[HotUpdater sharedImpl] bundleURLWithBundle:[NSBundle mainBundle]];
183
183
  }
184
184
 
185
- // Get bundleURL using instance impl
185
+ // Get bundleURL with specific bundle using singleton
186
+ + (NSURL *)bundleURLWithBundle:(NSBundle *)bundle {
187
+ return [[HotUpdater sharedImpl] bundleURLWithBundle:bundle];
188
+ }
189
+
190
+ // Get bundleURL with default bundle using instance impl
186
191
  - (NSURL *)bundleURL {
187
- return [[HotUpdater sharedImpl] bundleURL];
192
+ return [[HotUpdater sharedImpl] bundleURLWithBundle:[NSBundle mainBundle]];
188
193
  }
189
194
 
195
+ // Get bundleURL with specific bundle using instance impl
196
+ - (NSURL *)bundleURLWithBundle:(NSBundle *)bundle {
197
+ return [[HotUpdater sharedImpl] bundleURLWithBundle:bundle];
198
+ }
190
199
 
191
200
  #pragma mark - Progress Updates & Event Emitting (Keep in ObjC Wrapper)
192
201
 
@@ -247,7 +256,7 @@ RCT_EXPORT_MODULE();
247
256
  dispatch_async(dispatch_get_main_queue(), ^{
248
257
  @try {
249
258
  HotUpdaterImpl *impl = [HotUpdater sharedImpl];
250
- NSURL *bundleURL = [impl bundleURL];
259
+ NSURL *bundleURL = [impl bundleURLWithBundle:[NSBundle mainBundle]];
251
260
  RCTLogInfo(@"[HotUpdater.mm] Reloading with bundle URL: %@", bundleURL);
252
261
  if (bundleURL && super.bridge) {
253
262
  [super.bridge setValue:bundleURL forKey:@"bundleURL"];
@@ -337,7 +346,7 @@ RCT_EXPORT_METHOD(reload:(RCTPromiseResolveBlock)resolve
337
346
  dispatch_async(dispatch_get_main_queue(), ^{
338
347
  @try {
339
348
  HotUpdaterImpl *impl = [HotUpdater sharedImpl];
340
- NSURL *bundleURL = [impl bundleURL];
349
+ NSURL *bundleURL = [impl bundleURLWithBundle:[NSBundle mainBundle]];
341
350
  RCTLogInfo(@"[HotUpdater.mm] Reloading with bundle URL: %@", bundleURL);
342
351
  if (bundleURL && super.bridge) {
343
352
  [super.bridge setValue:bundleURL forKey:@"bundleURL"];
@@ -106,10 +106,11 @@ import React
106
106
 
107
107
  /**
108
108
  * Gets the URL to the bundle file.
109
+ * @param bundle instance to lookup the JavaScript bundle resource. Defaults to Bundle.main.
109
110
  * @return URL to the bundle or nil
110
111
  */
111
- public func bundleURL() -> URL? {
112
- return bundleStorage.getBundleURL()
112
+ public func bundleURL(bundle: Bundle = Bundle.main) -> URL? {
113
+ return bundleStorage.getBundleURL(bundle: bundle)
113
114
  }
114
115
 
115
116
  // MARK: - Bundle Update
@@ -16,12 +16,25 @@
16
16
  */
17
17
  + (NSURL *)bundleURL;
18
18
 
19
+ /**
20
+ * Returns the currently active bundle URL with specific bundle from the default (static) instance.
21
+ * Callable from Objective-C (e.g., AppDelegate).
22
+ * This is implemented in HotUpdater.mm and calls the Swift static method.
23
+ */
24
+ + (NSURL *)bundleURLWithBundle:(NSBundle *)bundle NS_SWIFT_NAME(bundleURL(bundle:));
25
+
19
26
  /**
20
27
  * Returns the bundle URL for this specific instance.
21
28
  * @return The bundle URL for this instance
22
29
  */
23
30
  - (NSURL *)bundleURL;
24
31
 
32
+ /**
33
+ * Returns the bundle URL with specific bundle for this specific instance.
34
+ * @return The bundle URL for this instance
35
+ */
36
+ - (NSURL *)bundleURLWithBundle:(NSBundle *)bundle NS_SWIFT_NAME(bundleURL(bundle:));
37
+
25
38
  /**
26
39
  * 다운로드 진행 상황 업데이트 시간을 추적하는 속성
27
40
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/react-native",
3
- "version": "0.25.7",
3
+ "version": "0.25.8",
4
4
  "description": "React Native OTA solution for self-hosted",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -120,14 +120,14 @@
120
120
  "react-native": "0.79.1",
121
121
  "react-native-builder-bob": "^0.40.10",
122
122
  "typescript": "^5.8.3",
123
- "hot-updater": "0.25.7"
123
+ "hot-updater": "0.25.8"
124
124
  },
125
125
  "dependencies": {
126
126
  "use-sync-external-store": "1.5.0",
127
- "@hot-updater/cli-tools": "0.25.7",
128
- "@hot-updater/core": "0.25.7",
129
- "@hot-updater/js": "0.25.7",
130
- "@hot-updater/plugin-core": "0.25.7"
127
+ "@hot-updater/cli-tools": "0.25.8",
128
+ "@hot-updater/core": "0.25.8",
129
+ "@hot-updater/plugin-core": "0.25.8",
130
+ "@hot-updater/js": "0.25.8"
131
131
  },
132
132
  "scripts": {
133
133
  "build": "bob build && tsc -p plugin/tsconfig.build.json",