@@ -26,13 +26,25 @@ const UIStrings = {
2626 * "Reconnect when ready", refers to the state of the mobile device. The developer first has to put the mobile
2727 * device back in a state where it can be inspected, before DevTools can reconnect to it.
2828 */
29- reconnectWhenReadyByReopening : 'Reconnect when ready by reopening DevTools.' ,
29+ reconnectWhenReadyByReopening : 'Reconnect when ready (will reload DevTools).' ,
30+ /**
31+ * @description Text in a dialog box to explain `DevTools` can still be used while disconnected.
32+ */
33+ perserveState : 'Dismiss this dialog and continue using `DevTools` while disconnected.' ,
34+ /**
35+ * @description Text on a button to dismiss the dialog
36+ */
37+ closeDialog : 'Dismiss dialog' ,
3038 /**
3139 * @description Text on a button to reconnect Devtools when remote debugging terminated.
3240 * "Remote debugging" here means that DevTools on a PC is inspecting a website running on an actual mobile device
3341 * (see https://developer.chrome.com/docs/devtools/remote-debugging/).
3442 */
3543 reconnectDevtools : 'Reconnect `DevTools`' ,
44+ /**
45+ * @description Text in a dialog box to prompt for feedback if the disconnection is unexpected.
46+ */
47+ sendFeedbackMessage : '[FB-only] Please send feedback if this disconnection is unexpected.' ,
3648 /**
3749 * @description Label of the FB-only 'send feedback' button.
3850 */
@@ -41,7 +53,7 @@ const UIStrings = {
4153const str_ = i18n . i18n . registerUIStrings ( 'ui/legacy/RemoteDebuggingTerminatedScreen.ts' , UIStrings ) ;
4254const i18nString = i18n . i18n . getLocalizedString . bind ( undefined , str_ ) ;
4355export class RemoteDebuggingTerminatedScreen extends VBox {
44- constructor ( reason : string ) {
56+ constructor ( reason : string , onClose ?: ( ) => void ) {
4557 super ( true ) ;
4658 this . registerRequiredCSS ( remoteDebuggingTerminatedScreenStyles ) ;
4759 const message = this . contentElement . createChild ( 'div' , 'message' ) ;
@@ -50,26 +62,34 @@ export class RemoteDebuggingTerminatedScreen extends VBox {
5062 const reasonElement = span . createChild ( 'span' , 'reason' ) ;
5163 reasonElement . textContent = reason ;
5264 this . contentElement . createChild ( 'div' , 'message' ) . textContent = i18nString ( UIStrings . reconnectWhenReadyByReopening ) ;
53- const button = createTextButton (
65+
66+ const reconnectButton = createTextButton (
5467 i18nString ( UIStrings . reconnectDevtools ) , ( ) => window . location . reload ( ) , { jslogContext : 'reconnect' } ) ;
55- const buttonRow = this . contentElement . createChild ( 'div' , 'button' ) ;
56- buttonRow . appendChild ( button ) ;
68+ this . contentElement . createChild ( 'div' , 'button' ) . appendChild ( reconnectButton ) ;
69+
70+ if ( onClose ) {
71+ this . contentElement . createChild ( 'div' , 'message' ) . textContent = i18nString ( UIStrings . perserveState ) ;
72+
73+ const closeButton = createTextButton ( i18nString ( UIStrings . closeDialog ) , onClose , { jslogContext : 'dismiss' } ) ;
74+ this . contentElement . createChild ( 'div' , 'button' ) . appendChild ( closeButton ) ;
75+ }
5776
5877 if ( globalThis . FB_ONLY__reactNativeFeedbackLink ) {
78+ this . contentElement . createChild ( 'div' , 'message' ) . textContent = i18nString ( UIStrings . sendFeedbackMessage ) ;
79+
5980 const feedbackLink = globalThis . FB_ONLY__reactNativeFeedbackLink as Platform . DevToolsPath . UrlString ;
6081 const feedbackButton = createTextButton ( i18nString ( UIStrings . sendFeedback ) , ( ) => {
6182 Host . InspectorFrontendHost . InspectorFrontendHostInstance . openInNewTab ( feedbackLink ) ;
6283 } , { className : 'primary-button' , jslogContext : 'sendFeedback' } ) ;
63- buttonRow . appendChild ( feedbackButton ) ;
84+ this . contentElement . createChild ( 'div' , 'button' ) . appendChild ( feedbackButton ) ;
6485 }
6586 }
6687
6788 static show ( reason : string ) : void {
6889 const dialog = new Dialog ( 'remote-debnugging-terminated' ) ;
6990 dialog . setSizeBehavior ( SizeBehavior . MeasureContent ) ;
70- dialog . addCloseButton ( ) ;
7191 dialog . setDimmed ( true ) ;
72- new RemoteDebuggingTerminatedScreen ( reason ) . show ( dialog . contentElement ) ;
92+ new RemoteDebuggingTerminatedScreen ( reason , ( ) => dialog . hide ( ) ) . show ( dialog . contentElement ) ;
7393 dialog . show ( ) ;
7494 Host . rnPerfMetrics . remoteDebuggingTerminated ( reason ) ;
7595 }
0 commit comments