mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-09-16 12:11:39 +08:00
Merge branch 'customInstanceManager'
This commit is contained in:
@@ -5,6 +5,7 @@ import android.content.SharedPreferences;
|
|||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import com.facebook.react.ReactInstanceManager;
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
@@ -21,6 +22,7 @@ public class UpdateContext {
|
|||||||
private Executor executor;
|
private Executor executor;
|
||||||
|
|
||||||
public static boolean DEBUG = false;
|
public static boolean DEBUG = false;
|
||||||
|
private static ReactInstanceManager mReactInstanceManager;
|
||||||
|
|
||||||
public UpdateContext(Context context) {
|
public UpdateContext(Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
@@ -160,6 +162,15 @@ public class UpdateContext {
|
|||||||
this.clearUp();
|
this.clearUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void setCustomInstanceManager(ReactInstanceManager instanceManager) {
|
||||||
|
mReactInstanceManager = instanceManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReactInstanceManager getCustomReactInstanceManager() {
|
||||||
|
return mReactInstanceManager;
|
||||||
|
}
|
||||||
|
|
||||||
public static String getBundleUrl(Context context) {
|
public static String getBundleUrl(Context context) {
|
||||||
return new UpdateContext(context.getApplicationContext()).getBundleUrl();
|
return new UpdateContext(context.getApplicationContext()).getBundleUrl();
|
||||||
}
|
}
|
||||||
|
@@ -127,7 +127,11 @@ public class UpdateModule extends ReactContextBaseJavaModule{
|
|||||||
updateContext.switchVersion(hash);
|
updateContext.switchVersion(hash);
|
||||||
Activity activity = getCurrentActivity();
|
Activity activity = getCurrentActivity();
|
||||||
Application application = activity.getApplication();
|
Application application = activity.getApplication();
|
||||||
ReactInstanceManager instanceManager = ((ReactApplication) application).getReactNativeHost().getReactInstanceManager();
|
ReactInstanceManager instanceManager = updateContext.getCustomReactInstanceManager();
|
||||||
|
|
||||||
|
if (instanceManager == null) {
|
||||||
|
instanceManager = ((ReactApplication) application).getReactNativeHost().getReactInstanceManager();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Field jsBundleField = instanceManager.getClass().getDeclaredField("mJSBundleFile");
|
Field jsBundleField = instanceManager.getClass().getDeclaredField("mJSBundleFile");
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
let availableDomain = 'update.reactnative.cn';
|
let availableDomain = 'update.react-native.cn';
|
||||||
|
|
||||||
function ping(domain, rejectImmediate) {
|
function ping(domain, rejectImmediate) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-update",
|
"name": "react-native-update",
|
||||||
"version": "5.5.6",
|
"version": "5.5.7",
|
||||||
"description": "react-native hot update",
|
"description": "react-native hot update",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Reference in New Issue
Block a user