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
This commit is contained in:
Julian Descottes 2018-10-24 09:35:06 +00:00
Родитель cf9f2f85ba
Коммит 84ef7175f1
5 изменённых файлов: 16 добавлений и 3 удалений

Просмотреть файл

@ -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,
};
};

Просмотреть файл

@ -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",

Просмотреть файл

@ -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 = {

Просмотреть файл

@ -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;

Просмотреть файл

@ -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,
};
}