Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevSupport classes included in release build with proguard enabled. Resolves unnecessary usage of BridgeDevSupportManager in DevLoadingModule. #44698

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@
*/
public final class BridgeDevSupportManager extends DevSupportManagerBase {
private boolean mIsSamplingProfilerEnabled = false;
private ReactInstanceDevHelper mReactInstanceManagerHelper;
private @Nullable DevLoadingViewManager mDevLoadingViewManager;

public BridgeDevSupportManager(
Context applicationContext,
Expand All @@ -91,9 +89,6 @@ public BridgeDevSupportManager(
surfaceDelegateFactory,
devLoadingViewManager);

mReactInstanceManagerHelper = reactInstanceManagerHelper;
mDevLoadingViewManager = devLoadingViewManager;

if (getDevSettings().isStartSamplingProfilerOnInit()) {
// Only start the profiler. If its already running, there is an error
if (!mIsSamplingProfilerEnabled) {
Expand Down Expand Up @@ -133,14 +128,6 @@ public void onOptionSelected() {
}
}

public DevLoadingViewManager getDevLoadingViewManager() {
return mDevLoadingViewManager;
}

public ReactInstanceDevHelper getReactInstanceManagerHelper() {
return mReactInstanceManagerHelper;
}

@Override
protected String getUniqueTag() {
return "Bridge";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,11 @@ protected DevServerHelper getDevServerHelper() {
return mDevServerHelper;
}

protected ReactInstanceDevHelper getReactInstanceDevHelper() {
public DevLoadingViewManager getDevLoadingViewManager() {
return mDevLoadingViewManager;
}

public ReactInstanceDevHelper getReactInstanceDevHelper() {
return mReactInstanceDevHelper;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.common.SurfaceDelegate;
import com.facebook.react.devsupport.interfaces.BundleLoadCallback;
import com.facebook.react.devsupport.interfaces.DevLoadingViewManager;
import com.facebook.react.devsupport.interfaces.DevOptionHandler;
import com.facebook.react.devsupport.interfaces.DevSplitBundleCallback;
import com.facebook.react.devsupport.interfaces.DevSupportManager;
Expand Down Expand Up @@ -127,6 +128,11 @@ public String getDownloadedJSBundleFile() {
return null;
}

@Override
public DevLoadingViewManager getDevLoadingViewManager() {
return null;
}

@Override
public boolean hasUpToDateJSBundleInCache() {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public interface DevSupportManager extends JSExceptionHandler {

String getDownloadedJSBundleFile();

DevLoadingViewManager getDevLoadingViewManager();

boolean hasUpToDateJSBundleInCache();

void reloadSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.devsupport.BridgeDevSupportManager;
import com.facebook.react.devsupport.DefaultDevLoadingViewImplementation;
import com.facebook.react.devsupport.interfaces.DevSupportManager;
import com.facebook.react.devsupport.interfaces.DevLoadingViewManager;
import com.facebook.react.module.annotations.ReactModule;

Expand All @@ -28,14 +27,9 @@ public class DevLoadingModule extends NativeDevLoadingViewSpec {
public DevLoadingModule(ReactApplicationContext reactContext) {
super(reactContext);
mJSExceptionHandler = reactContext.getJSExceptionHandler();
if (mJSExceptionHandler != null && mJSExceptionHandler instanceof BridgeDevSupportManager) {
if (mJSExceptionHandler != null && mJSExceptionHandler instanceof DevSupportManager) {
mDevLoadingViewManager =
((BridgeDevSupportManager) mJSExceptionHandler).getDevLoadingViewManager();
mDevLoadingViewManager =
mDevLoadingViewManager != null
? mDevLoadingViewManager
: new DefaultDevLoadingViewImplementation(
((BridgeDevSupportManager) mJSExceptionHandler).getReactInstanceManagerHelper());
((DevSupportManager) mJSExceptionHandler).getDevLoadingViewManager();
}
}

Expand All @@ -46,7 +40,9 @@ public void showMessage(final String message, final Double color, final Double b
new Runnable() {
@Override
public void run() {
mDevLoadingViewManager.showMessage(message);
if (mDevLoadingViewManager != null) {
mDevLoadingViewManager.showMessage(message);
}
}
});
}
Expand Down
Loading