From 84ef7175f141c8d89a2334ce5dc951c5ae70a9ca Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Wed, 24 Oct 2018 09:35:06 +0000 Subject: [PATCH] Bug 1497944 - Hide wifi section in ConnectPage behind pref;r=daisuke Depends on D9222 . Differential Revision: https://phabricator.services.mozilla.com/D9223 --HG-- extra : moz-landing-system : lando --- devtools/client/aboutdebugging-new/src/components/App.js | 4 ++++ .../src/components/connect/ConnectPage.js | 7 ++++++- devtools/client/aboutdebugging-new/src/constants.js | 2 ++ devtools/client/aboutdebugging-new/src/create-store.js | 3 ++- .../client/aboutdebugging-new/src/reducers/ui-state.js | 3 ++- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/devtools/client/aboutdebugging-new/src/components/App.js b/devtools/client/aboutdebugging-new/src/components/App.js index a7e6ec3baa3e..38256e3d8017 100644 --- a/devtools/client/aboutdebugging-new/src/components/App.js +++ b/devtools/client/aboutdebugging-new/src/components/App.js @@ -33,6 +33,7 @@ class App extends PureComponent { networkRuntimes: PropTypes.arrayOf(Types.runtime).isRequired, selectedPage: PropTypes.string, usbRuntimes: PropTypes.arrayOf(Types.runtime).isRequired, + wifiEnabled: PropTypes.bool.isRequired, }; } @@ -43,6 +44,7 @@ class App extends PureComponent { networkEnabled, networkLocations, selectedPage, + wifiEnabled, } = this.props; if (!selectedPage) { @@ -57,6 +59,7 @@ class App extends PureComponent { dispatch, networkEnabled, networkLocations, + wifiEnabled, }); default: // All pages except for the CONNECT page are RUNTIME pages. @@ -105,6 +108,7 @@ const mapStateToProps = state => { networkRuntimes: state.runtimes.networkRuntimes, selectedPage: state.ui.selectedPage, usbRuntimes: state.runtimes.usbRuntimes, + wifiEnabled: state.ui.wifiEnabled, }; }; diff --git a/devtools/client/aboutdebugging-new/src/components/connect/ConnectPage.js b/devtools/client/aboutdebugging-new/src/components/connect/ConnectPage.js index 4d5cbfb202f2..85b7d1f57925 100644 --- a/devtools/client/aboutdebugging-new/src/components/connect/ConnectPage.js +++ b/devtools/client/aboutdebugging-new/src/components/connect/ConnectPage.js @@ -39,11 +39,16 @@ class ConnectPage extends PureComponent { getString: PropTypes.func.isRequired, networkEnabled: PropTypes.bool.isRequired, networkLocations: PropTypes.arrayOf(PropTypes.string).isRequired, + wifiEnabled: PropTypes.bool.isRequired, }; } renderWifi() { - const { getString } = this.props; + const { getString, wifiEnabled } = this.props; + if (!wifiEnabled) { + return null; + } + return Localized( { id: "about-debugging-connect-wifi", diff --git a/devtools/client/aboutdebugging-new/src/constants.js b/devtools/client/aboutdebugging-new/src/constants.js index 18c0412572b0..ab02f52c41f1 100644 --- a/devtools/client/aboutdebugging-new/src/constants.js +++ b/devtools/client/aboutdebugging-new/src/constants.js @@ -65,6 +65,8 @@ const PAGES = { const PREFERENCES = { // Temporary preference without any default value until network locations are enabled. NETWORK_ENABLED: "devtools.aboutdebugging.network", + // Temporary preference without any default value until wifi is enabled. + WIFI_ENABLED: "devtools.aboutdebugging.wifi", }; const RUNTIME_PREFERENCE = { diff --git a/devtools/client/aboutdebugging-new/src/create-store.js b/devtools/client/aboutdebugging-new/src/create-store.js index fc29b4e375c2..8567b46f80b7 100644 --- a/devtools/client/aboutdebugging-new/src/create-store.js +++ b/devtools/client/aboutdebugging-new/src/create-store.js @@ -42,7 +42,8 @@ function getUiState() { const collapsibilities = getDebugTargetCollapsibilities(); const locations = getNetworkLocations(); const networkEnabled = Services.prefs.getBoolPref(PREFERENCES.NETWORK_ENABLED, false); - return new UiState(locations, collapsibilities, networkEnabled); + const wifiEnabled = Services.prefs.getBoolPref(PREFERENCES.WIFI_ENABLED, false); + return new UiState(locations, collapsibilities, networkEnabled, wifiEnabled); } exports.configureStore = configureStore; diff --git a/devtools/client/aboutdebugging-new/src/reducers/ui-state.js b/devtools/client/aboutdebugging-new/src/reducers/ui-state.js index c545cfd66832..d81b91ed9433 100644 --- a/devtools/client/aboutdebugging-new/src/reducers/ui-state.js +++ b/devtools/client/aboutdebugging-new/src/reducers/ui-state.js @@ -12,13 +12,14 @@ const { } = require("../constants"); function UiState(locations = [], debugTargetCollapsibilities = {}, - networkEnabled = false) { + networkEnabled = false, wifiEnabled = false) { return { adbAddonStatus: null, debugTargetCollapsibilities, networkEnabled, networkLocations: locations, selectedPage: null, + wifiEnabled, }; }