@hot-updater/react-native 0.16.7-0 → 0.17.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.
@@ -3,7 +3,9 @@ package com.hotupdater
3
3
  import android.content.Context
4
4
  import android.util.Log
5
5
  import com.facebook.react.ReactApplication
6
+ import com.facebook.react.bridge.JSBundleLoader
6
7
  import com.facebook.react.common.LifecycleState
8
+ import java.lang.reflect.Field
7
9
 
8
10
  class ReactIntegrationManager(
9
11
  context: Context,
@@ -25,8 +27,22 @@ class ReactIntegrationManager(
25
27
  jsBundleLoaderField.isAccessible = true
26
28
  jsBundleLoaderField.set(reactHostDelegate, getJSBundlerLoader(bundleURL))
27
29
  } catch (e: Exception) {
30
+ try {
31
+ val instanceManager = application.reactNativeHost.reactInstanceManager
32
+ val bundleLoader: JSBundleLoader? = this.getJSBundlerLoader(bundleURL)
33
+ val bundleLoaderField: Field =
34
+ instanceManager::class.java.getDeclaredField("mBundleLoader")
35
+ bundleLoaderField.isAccessible = true
36
+
37
+ if (bundleLoader != null) {
38
+ bundleLoaderField.set(instanceManager, bundleLoader)
39
+ } else {
40
+ bundleLoaderField.set(instanceManager, null)
41
+ }
42
+ } catch (e: Exception) {
43
+ Log.d("HotUpdater", "Failed to setJSBundle (fallback): ${e.message}")
44
+ }
28
45
  Log.d("HotUpdater", "Failed to setJSBundle: ${e.message}")
29
- throw IllegalAccessException("Could not setJSBundle")
30
46
  }
31
47
  }
32
48
 
@@ -57,12 +73,10 @@ class ReactIntegrationManager(
57
73
  }
58
74
  } catch (e: Exception) {
59
75
  Log.d("HotUpdater", "Failed to reload: ${e.message}")
60
- throw e
61
76
  }
62
77
  }
63
78
  } catch (e: Exception) {
64
79
  Log.d("HotUpdater", "Failed to reload: ${e.message}")
65
- throw e
66
80
  }
67
81
  }
68
82
  }
@@ -27,7 +27,6 @@ class ReactIntegrationManager(
27
27
  }
28
28
  } catch (e: Exception) {
29
29
  Log.d("HotUpdater", "Failed to setJSBundle: ${e.message}")
30
- throw IllegalAccessException("Could not setJSBundle")
31
30
  }
32
31
  }
33
32
 
@@ -49,7 +48,6 @@ class ReactIntegrationManager(
49
48
  }
50
49
  } catch (e: Exception) {
51
50
  Log.d("HotUpdater", "Failed to reload: ${e.message}")
52
- throw e
53
51
  }
54
52
  }
55
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/react-native",
3
- "version": "0.16.7-0",
3
+ "version": "0.17.0",
4
4
  "description": "React Native OTA solution for self-hosted",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -90,8 +90,8 @@
90
90
  },
91
91
  "dependencies": {
92
92
  "use-sync-external-store": "1.4.0",
93
- "@hot-updater/js": "0.16.7-0",
94
- "@hot-updater/core": "0.16.7-0"
93
+ "@hot-updater/js": "0.17.0",
94
+ "@hot-updater/core": "0.17.0"
95
95
  },
96
96
  "scripts": {
97
97
  "build": "rslib build && npm run build:plugin",