1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-16 10:21:37 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Merge branch 'customInstanceManager'

This commit is contained in:
sunnylqm
2020-04-02 12:08:14 +08:00
4 changed files with 18 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.Log;
import com.facebook.react.ReactInstanceManager;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
@@ -21,6 +22,7 @@ public class UpdateContext {
private Executor executor;
public static boolean DEBUG = false;
private static ReactInstanceManager mReactInstanceManager;
public UpdateContext(Context context) {
this.context = context;
@@ -160,6 +162,15 @@ public class UpdateContext {
this.clearUp();
}
public static void setCustomInstanceManager(ReactInstanceManager instanceManager) {
mReactInstanceManager = instanceManager;
}
public ReactInstanceManager getCustomReactInstanceManager() {
return mReactInstanceManager;
}
public static String getBundleUrl(Context context) {
return new UpdateContext(context.getApplicationContext()).getBundleUrl();
}

View File

@@ -127,7 +127,11 @@ public class UpdateModule extends ReactContextBaseJavaModule{
updateContext.switchVersion(hash);
Activity activity = getCurrentActivity();
Application application = activity.getApplication();
ReactInstanceManager instanceManager = ((ReactApplication) application).getReactNativeHost().getReactInstanceManager();
ReactInstanceManager instanceManager = updateContext.getCustomReactInstanceManager();
if (instanceManager == null) {
instanceManager = ((ReactApplication) application).getReactNativeHost().getReactInstanceManager();
}
try {
Field jsBundleField = instanceManager.getClass().getDeclaredField("mJSBundleFile");

View File

@@ -1,4 +1,4 @@
let availableDomain = 'update.reactnative.cn';
let availableDomain = 'update.react-native.cn';
function ping(domain, rejectImmediate) {
return new Promise((resolve, reject) => {

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-update",
"version": "5.5.6",
"version": "5.5.7",
"description": "react-native hot update",
"main": "lib/index.js",
"scripts": {