mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 21:33:12 +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.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(); | ||||
|     } | ||||
|   | ||||
| @@ -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"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm