@@ -13,19 +13,24 @@ import FuseboxWindowTitleManager from './FuseboxWindowTitleManager.js';
1313
1414const UIStrings = {
1515 /**
16- * @description Message for the "settings changed" banner shown when a reload is required.
16+ * @description Message for the "settings changed" banner shown when a reload is required for the Performance panel .
1717 */
18- reloadRequiredMessage : '[Profiling build first run] One or more settings have changed. Please reload to access the Performance panel.' ,
18+ reloadRequiredForPerformancePanelMessage :
19+ '[Profiling build first run] One or more settings have changed. Please reload to access the Performance panel.' ,
20+ /**
21+ * @description Message for the "settings changed" banner shown when a reload is required for the Network panel.
22+ */
23+ reloadRequiredForNetworkPanelMessage : 'Network panel is now available for dogfooding. Please reload to access it.' ,
1924} ;
2025
21- const str_ = i18n . i18n . registerUIStrings ( 'entrypoints/rn_fusebox/FuseboxProfilingBuildModeObserver .ts' , UIStrings ) ;
26+ const str_ = i18n . i18n . registerUIStrings ( 'entrypoints/rn_fusebox/FuseboxExperimentsObserver .ts' , UIStrings ) ;
2227const i18nString = i18n . i18n . getLocalizedString . bind ( undefined , str_ ) ;
2328
2429/**
2530 * [Experimental] Model observer which configures available DevTools features
26- * when a profiling build is identified.
31+ * based on the target's capabilities, e.g. when a profiling build is identified, or when network inspection is supported .
2732 */
28- export default class FuseboxProfilingBuildObserver implements
33+ export default class FuseboxFeatureObserver implements
2934 SDK . TargetManager . SDKModelObserver < SDK . ReactNativeApplicationModel . ReactNativeApplicationModel > {
3035 constructor ( targetManager : SDK . TargetManager . TargetManager ) {
3136 targetManager . observeModels ( SDK . ReactNativeApplicationModel . ReactNativeApplicationModel , this ) ;
@@ -43,16 +48,20 @@ export default class FuseboxProfilingBuildObserver implements
4348
4449 #handleMetadataUpdated(
4550 event : Common . EventTarget . EventTargetEvent < Protocol . ReactNativeApplication . MetadataUpdatedEvent > ) : void {
46- const { unstable_isProfilingBuild} = event . data ;
51+ const { unstable_isProfilingBuild, unstable_networkInspectionEnabled } = event . data ;
4752
4853 if ( unstable_isProfilingBuild ) {
4954 FuseboxWindowTitleManager . instance ( ) . setSuffix ( '[PROFILING]' ) ;
50- this . #hideUnsupportedFeatures ( ) ;
55+ this . #hideUnsupportedFeaturesForProfilingBuilds ( ) ;
5156 this . #ensurePerformancePanelEnabled( ) ;
5257 }
58+
59+ if ( unstable_networkInspectionEnabled ) {
60+ this . #ensureNetworkPanelEnabled( ) ;
61+ }
5362 }
5463
55- #hideUnsupportedFeatures ( ) : void {
64+ #hideUnsupportedFeaturesForProfilingBuilds ( ) : void {
5665 UI . ViewManager . ViewManager . instance ( )
5766 . resolveLocation ( UI . ViewManager . ViewLocationValues . PANEL )
5867 . then ( location => {
@@ -83,9 +92,24 @@ export default class FuseboxProfilingBuildObserver implements
8392 const inspectorView = UI . InspectorView ?. InspectorView ?. instance ( ) ;
8493 if ( inspectorView ) {
8594 inspectorView . displayReloadRequiredWarning (
86- i18nString ( UIStrings . reloadRequiredMessage ) ,
95+ i18nString ( UIStrings . reloadRequiredForPerformancePanelMessage ) ,
8796 ) ;
8897 }
8998 }
9099 }
100+
101+ #ensureNetworkPanelEnabled( ) : void {
102+ if ( Root . Runtime . experiments . isEnabled ( Root . Runtime . ExperimentName . ENABLE_NETWORK_PANEL ) ) {
103+ return ;
104+ }
105+
106+ Root . Runtime . experiments . setEnabled (
107+ Root . Runtime . ExperimentName . ENABLE_NETWORK_PANEL ,
108+ true ,
109+ ) ;
110+
111+ UI . InspectorView ?. InspectorView ?. instance ( ) ?. displayReloadRequiredWarning (
112+ i18nString ( UIStrings . reloadRequiredForNetworkPanelMessage ) ,
113+ ) ;
114+ }
91115}
0 commit comments