mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Minimal implementation of "paused in debugger" overlay (#44079)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44079 Changelog: [Internal] Implements an unstyled, non-interactive version of the "paused in debugger" in-app overlay in Fusebox on Android, based on the event introduced in D56068444. The implementation in `DevSupportManagerBase` is shared across Bridge and Bridgeless. In upcoming diffs in this stack, we'll add interactive features (namely "resume" and "step over" buttons, like in Chrome) and improve the visual styling of this overlay. Reviewed By: hoxyq Differential Revision: D56068445 fbshipit-source-id: a9ac2765d29d64615751b5cdf03939e0b84d2545
This commit is contained in:
committed by
Facebook GitHub Bot
parent
66fd1e8145
commit
6930f3daf7
@@ -2130,6 +2130,7 @@ public abstract class com/facebook/react/devsupport/DevSupportManagerBase : com/
|
||||
public fun handleException (Ljava/lang/Exception;)V
|
||||
public fun hasUpToDateJSBundleInCache ()Z
|
||||
protected fun hideDevLoadingView ()V
|
||||
public fun hidePausedInDebuggerOverlay ()V
|
||||
public fun hideRedboxDialog ()V
|
||||
public fun isPackagerRunning (Lcom/facebook/react/devsupport/interfaces/PackagerStatusCallback;)V
|
||||
public fun onNewReactContextCreated (Lcom/facebook/react/bridge/ReactContext;)V
|
||||
@@ -2149,6 +2150,7 @@ public abstract class com/facebook/react/devsupport/DevSupportManagerBase : com/
|
||||
public fun showDevOptionsDialog ()V
|
||||
public fun showNewJSError (Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;I)V
|
||||
public fun showNewJavaError (Ljava/lang/String;Ljava/lang/Throwable;)V
|
||||
public fun showPausedInDebuggerOverlay (Ljava/lang/String;)V
|
||||
public fun startInspector ()V
|
||||
public fun stopInspector ()V
|
||||
public fun toggleElementInspector ()V
|
||||
@@ -2294,6 +2296,7 @@ public class com/facebook/react/devsupport/ReleaseDevSupportManager : com/facebo
|
||||
public fun handleException (Ljava/lang/Exception;)V
|
||||
public fun handleReloadJS ()V
|
||||
public fun hasUpToDateJSBundleInCache ()Z
|
||||
public fun hidePausedInDebuggerOverlay ()V
|
||||
public fun hideRedboxDialog ()V
|
||||
public fun isPackagerRunning (Lcom/facebook/react/devsupport/interfaces/PackagerStatusCallback;)V
|
||||
public fun loadSplitBundleFromServer (Ljava/lang/String;Lcom/facebook/react/devsupport/interfaces/DevSplitBundleCallback;)V
|
||||
@@ -2313,6 +2316,7 @@ public class com/facebook/react/devsupport/ReleaseDevSupportManager : com/facebo
|
||||
public fun showDevOptionsDialog ()V
|
||||
public fun showNewJSError (Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;I)V
|
||||
public fun showNewJavaError (Ljava/lang/String;Ljava/lang/Throwable;)V
|
||||
public fun showPausedInDebuggerOverlay (Ljava/lang/String;)V
|
||||
public fun startInspector ()V
|
||||
public fun stopInspector ()V
|
||||
public fun toggleElementInspector ()V
|
||||
@@ -2404,6 +2408,7 @@ public abstract interface class com/facebook/react/devsupport/interfaces/DevSupp
|
||||
public abstract fun getSourceUrl ()Ljava/lang/String;
|
||||
public abstract fun handleReloadJS ()V
|
||||
public abstract fun hasUpToDateJSBundleInCache ()Z
|
||||
public abstract fun hidePausedInDebuggerOverlay ()V
|
||||
public abstract fun hideRedboxDialog ()V
|
||||
public abstract fun isPackagerRunning (Lcom/facebook/react/devsupport/interfaces/PackagerStatusCallback;)V
|
||||
public abstract fun loadSplitBundleFromServer (Ljava/lang/String;Lcom/facebook/react/devsupport/interfaces/DevSplitBundleCallback;)V
|
||||
@@ -2423,6 +2428,7 @@ public abstract interface class com/facebook/react/devsupport/interfaces/DevSupp
|
||||
public abstract fun showDevOptionsDialog ()V
|
||||
public abstract fun showNewJSError (Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;I)V
|
||||
public abstract fun showNewJavaError (Ljava/lang/String;Ljava/lang/Throwable;)V
|
||||
public abstract fun showPausedInDebuggerOverlay (Ljava/lang/String;)V
|
||||
public abstract fun startInspector ()V
|
||||
public abstract fun stopInspector ()V
|
||||
public abstract fun toggleElementInspector ()V
|
||||
|
||||
+5
-1
@@ -1502,7 +1502,11 @@ public class ReactInstanceManager {
|
||||
|
||||
@Override
|
||||
public void onSetPausedInDebuggerMessage(@Nullable String message) {
|
||||
// TODO(moti): Implement this
|
||||
if (message == null) {
|
||||
mDevSupportManager.hidePausedInDebuggerOverlay();
|
||||
} else {
|
||||
mDevSupportManager.showPausedInDebuggerOverlay(message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+30
@@ -1164,4 +1164,34 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
|
||||
mDevServerHelper.openDebugger(
|
||||
mCurrentContext, mApplicationContext.getString(R.string.catalyst_open_debugger_error));
|
||||
}
|
||||
|
||||
private @Nullable AlertDialog mPausedInDebuggerDialog;
|
||||
|
||||
@Override
|
||||
public void showPausedInDebuggerOverlay(String message) {
|
||||
UiThreadUtil.runOnUiThread(
|
||||
() -> {
|
||||
if (mPausedInDebuggerDialog != null) {
|
||||
mPausedInDebuggerDialog.dismiss();
|
||||
}
|
||||
Activity context = mReactInstanceDevHelper.getCurrentActivity();
|
||||
if (context == null || context.isFinishing()) {
|
||||
return;
|
||||
}
|
||||
mPausedInDebuggerDialog =
|
||||
new AlertDialog.Builder(context).setMessage(message).setCancelable(false).create();
|
||||
mPausedInDebuggerDialog.show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hidePausedInDebuggerOverlay() {
|
||||
UiThreadUtil.runOnUiThread(
|
||||
() -> {
|
||||
if (mPausedInDebuggerDialog != null) {
|
||||
mPausedInDebuggerDialog.dismiss();
|
||||
mPausedInDebuggerDialog = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -207,4 +207,10 @@ public class ReleaseDevSupportManager implements DevSupportManager {
|
||||
|
||||
@Override
|
||||
public void openDebugger() {}
|
||||
|
||||
@Override
|
||||
public void showPausedInDebuggerOverlay(String message) {}
|
||||
|
||||
@Override
|
||||
public void hidePausedInDebuggerOverlay() {}
|
||||
}
|
||||
|
||||
+6
@@ -105,6 +105,12 @@ public interface DevSupportManager : JSExceptionHandler {
|
||||
/** Attempt to open the JS debugger on the host machine. */
|
||||
public fun openDebugger()
|
||||
|
||||
/** Shows the "paused in debugger" overlay with the given message. */
|
||||
public fun showPausedInDebuggerOverlay(message: String)
|
||||
|
||||
/** Hides the "paused in debugger" overlay, if currently shown. */
|
||||
public fun hidePausedInDebuggerOverlay()
|
||||
|
||||
/**
|
||||
* The PackagerLocationCustomizer allows you to have a dynamic packager location that is
|
||||
* determined right before loading the packager. Your customizer must call |callback|, as loading
|
||||
|
||||
+5
-1
@@ -469,7 +469,11 @@ public class ReactHostImpl implements ReactHost {
|
||||
|
||||
@DoNotStrip
|
||||
private void setPausedInDebuggerMessage(@Nullable String message) {
|
||||
// TODO(moti): Implement this
|
||||
if (message == null) {
|
||||
mDevSupportManager.hidePausedInDebuggerOverlay();
|
||||
} else {
|
||||
mDevSupportManager.showPausedInDebuggerOverlay(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user