From be539906137f72e5058884102650cfc32e090026 Mon Sep 17 00:00:00 2001 From: Denis Nedelyaev Date: Mon, 16 Dec 2019 06:59:48 -0800 Subject: [PATCH] Add setting for skipping fbsource version check Summary: Added a setting "Match local fbsource chekout", which inverserly corresponds to the `ignore_local_pin` setting in `flipper-launcher.toml`. Reviewed By: passy Differential Revision: D19030456 fbshipit-source-id: deaaf4e873a00bbc4e8bd3034353cf580df95a36 --- package.json | 2 +- src/chrome/SettingsSheet.tsx | 36 ++++++++++-- src/fb-stubs/LauncherSettingsPanel.tsx | 6 +- src/reducers/index.tsx | 22 +++++++ src/reducers/launcherSettings.tsx | 40 +++++++++++++ src/utils/launcher.tsx | 19 +++++++ src/utils/launcherSettingsStorage.tsx | 79 ++++++++++++++++++++++++++ yarn.lock | 14 ++--- 8 files changed, 202 insertions(+), 16 deletions(-) create mode 100644 src/reducers/launcherSettings.tsx create mode 100644 src/utils/launcherSettingsStorage.tsx diff --git a/package.json b/package.json index 78e6b2bb8..edabef149 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,6 @@ "@types/react-redux": "^7.1.5", "@types/react-virtualized-auto-sizer": "^1.0.0", "@types/react-window": "^1.8.1", - "@types/redux-persist": "^4.3.1", "@types/rsocket-core": "^0.0.3", "@types/testing-library__react": "^9.1.2", "@types/tmp": "^0.1.0", @@ -110,6 +109,7 @@ "dependencies": { "@emotion/core": "^10.0.22", "@emotion/styled": "^10.0.23", + "@iarna/toml": "^2.2.3", "@types/promise-retry": "^1.1.3", "@types/react-color": "^3.0.1", "@types/react-test-renderer": "^16.9.1", diff --git a/src/chrome/SettingsSheet.tsx b/src/chrome/SettingsSheet.tsx index 4903c3f9a..b8130aef7 100644 --- a/src/chrome/SettingsSheet.tsx +++ b/src/chrome/SettingsSheet.tsx @@ -10,6 +10,11 @@ import {FlexColumn, Button, styled, Text, FlexRow, Spacer} from 'flipper'; import React, {Component} from 'react'; import {updateSettings, Action} from '../reducers/settings'; +import { + Action as LauncherAction, + LauncherSettings, + updateLauncherSettings, +} from '../reducers/launcherSettings'; import {connect} from 'react-redux'; import {State as Store} from '../reducers'; import {Settings} from '../reducers/settings'; @@ -38,25 +43,30 @@ type OwnProps = { type StateFromProps = { settings: Settings; + launcherSettings: LauncherSettings; isXcodeDetected: boolean; }; type DispatchFromProps = { updateSettings: (settings: Settings) => Action; + updateLauncherSettings: (settings: LauncherSettings) => LauncherAction; }; type State = { updatedSettings: Settings; + updatedLauncherSettings: LauncherSettings; }; type Props = OwnProps & StateFromProps & DispatchFromProps; class SettingsSheet extends Component { state: State = { updatedSettings: {...this.props.settings}, + updatedLauncherSettings: {...this.props.launcherSettings}, }; applyChanges = async () => { this.props.updateSettings(this.state.updatedSettings); + this.props.updateLauncherSettings(this.state.updatedLauncherSettings); this.props.onHide(); flush().then(() => { restartFlipper(); @@ -104,8 +114,8 @@ class SettingsSheet extends Component { /> { + isPrefetchingEnabled={this.state.updatedSettings.enablePrefetching} + onEnablePrefetchingChange={v => { this.setState({ updatedSettings: { ...this.state.updatedSettings, @@ -113,6 +123,15 @@ class SettingsSheet extends Component { }, }); }} + isLocalPinIgnored={this.state.updatedLauncherSettings.ignoreLocalPin} + onIgnoreLocalPinChange={v => { + this.setState({ + updatedLauncherSettings: { + ...this.state.updatedLauncherSettings, + ignoreLocalPin: v, + }, + }); + }} />
@@ -121,7 +140,13 @@ class SettingsSheet extends Component { Cancel