Option to use fallback bundle in dev mode

Summary: Changelog: [Android] [Added] - Adds option use fallback bundle instead of cached bundle when the packager isn't running in ReactInstanceManager

Reviewed By: ShikaSD

Differential Revision: D30899295

fbshipit-source-id: 7ea68fb13029bde9c3170cacee92b3c8a0a7367d
This commit is contained in:
Amy Nichol 2021-09-17 06:55:16 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 9f55bda50b
Коммит dd10134bdc
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -184,6 +184,7 @@ public class ReactInstanceManager {
private final @Nullable JSIModulePackage mJSIModulePackage; private final @Nullable JSIModulePackage mJSIModulePackage;
private final @Nullable ReactPackageTurboModuleManagerDelegate.Builder mTMMDelegateBuilder; private final @Nullable ReactPackageTurboModuleManagerDelegate.Builder mTMMDelegateBuilder;
private List<ViewManager> mViewManagers; private List<ViewManager> mViewManagers;
private boolean mUseFallbackBundle = false;
private class ReactContextInitParams { private class ReactContextInitParams {
private final JavaScriptExecutorFactory mJsExecutorFactory; private final JavaScriptExecutorFactory mJsExecutorFactory;
@ -350,6 +351,10 @@ public class ReactInstanceManager {
}; };
} }
public synchronized void setUseFallbackBundle(boolean useFallbackBundle) {
mUseFallbackBundle = useFallbackBundle;
}
private JavaScriptExecutorFactory getJSExecutorFactory() { private JavaScriptExecutorFactory getJSExecutorFactory() {
return mJavaScriptExecutorFactory; return mJavaScriptExecutorFactory;
} }
@ -452,7 +457,8 @@ public class ReactInstanceManager {
if (packagerIsRunning) { if (packagerIsRunning) {
mDevSupportManager.handleReloadJS(); mDevSupportManager.handleReloadJS();
} else if (mDevSupportManager.hasUpToDateJSBundleInCache() } else if (mDevSupportManager.hasUpToDateJSBundleInCache()
&& !devSettings.isRemoteJSDebugEnabled()) { && !devSettings.isRemoteJSDebugEnabled()
&& !mUseFallbackBundle) {
// If there is a up-to-date bundle downloaded from server, // If there is a up-to-date bundle downloaded from server,
// with remote JS debugging disabled, always use that. // with remote JS debugging disabled, always use that.
onJSBundleLoadedFromServer(); onJSBundleLoadedFromServer();