mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 13:23:12 +08:00 
			
		
		
		
	Allow custom instance manager
This commit is contained in:
		| @@ -20,7 +20,8 @@ public class UpdateContext { | ||||
|     private File rootDir; | ||||
|     private Executor executor; | ||||
|  | ||||
|     public static boolean DEBUG = false; | ||||
|     public static boolean DEBUG = true; | ||||
|     private static ReactInstanceManager mReactInstanceManager; | ||||
|  | ||||
|     public UpdateContext(Context context) { | ||||
|         this.context = context; | ||||
| @@ -160,6 +161,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