react-native-update 10.40.0 → 10.40.1
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.
|
@@ -31,7 +31,8 @@ final class ReactReloadManager {
|
|
|
31
31
|
Activity currentActivity = reactContext.getCurrentActivity();
|
|
32
32
|
String updateBundlePath = updateContext.getBundleUrl();
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
boolean newArchitectureEnabled = isNewArchitectureEnabled(application);
|
|
35
|
+
Object reactHost = newArchitectureEnabled ? getReactHost(currentActivity, application) : null;
|
|
35
36
|
if (reactHost != null) {
|
|
36
37
|
try {
|
|
37
38
|
reloadReactHost(reactHost, createBundleLoader(application, updateBundlePath, true));
|
|
@@ -63,6 +64,9 @@ final class ReactReloadManager {
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
try {
|
|
67
|
+
if (!newArchitectureEnabled) {
|
|
68
|
+
throw err;
|
|
69
|
+
}
|
|
66
70
|
Object currentReactHost = getReactHost(currentActivity, application);
|
|
67
71
|
if (currentReactHost == null) {
|
|
68
72
|
throw err;
|
|
@@ -180,6 +184,29 @@ final class ReactReloadManager {
|
|
|
180
184
|
return null;
|
|
181
185
|
}
|
|
182
186
|
|
|
187
|
+
private static boolean isNewArchitectureEnabled(Context application) {
|
|
188
|
+
try {
|
|
189
|
+
Class<?> buildConfigClass = Class.forName(application.getPackageName() + ".BuildConfig");
|
|
190
|
+
Field newArchitectureField = buildConfigClass.getField("IS_NEW_ARCHITECTURE_ENABLED");
|
|
191
|
+
return newArchitectureField.getBoolean(null);
|
|
192
|
+
} catch (Throwable ignored) {
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (application instanceof ReactApplication) {
|
|
196
|
+
try {
|
|
197
|
+
ReactNativeHost reactNativeHost = ((ReactApplication) application).getReactNativeHost();
|
|
198
|
+
Method isNewArchEnabledMethod =
|
|
199
|
+
reactNativeHost.getClass().getDeclaredMethod("isNewArchEnabled");
|
|
200
|
+
isNewArchEnabledMethod.setAccessible(true);
|
|
201
|
+
Object result = isNewArchEnabledMethod.invoke(reactNativeHost);
|
|
202
|
+
return result instanceof Boolean && (Boolean) result;
|
|
203
|
+
} catch (Throwable ignored) {
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
|
|
183
210
|
private static void reloadReactHost(Object reactHost, JSBundleLoader loader) throws Throwable {
|
|
184
211
|
try {
|
|
185
212
|
Field devSupportField = getCompatibleField(reactHost.getClass(), "useDevSupport");
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|