Force Restart Flipper When Applying Sandy
Summary: Discovered while testing D25584424, Sandy can't be applied and unapplied by regularly changing the setting. This diff forces restart Flipper to correctly apply or unapply Sandy. This diff adds forced restart updated setting to check if restart is needed or not. Then, it disables regular `Apply` when restart is needed Reviewed By: nikoant Differential Revision: D25632887 fbshipit-source-id: 88b31fd740d4a639e20fe45a82e2615b53cad5c3
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a28874cf29
commit
1e34561ae3
@@ -22,7 +22,7 @@ import {flush} from '../utils/persistor';
|
|||||||
import ToggledSection from './settings/ToggledSection';
|
import ToggledSection from './settings/ToggledSection';
|
||||||
import {FilePathConfigField, ConfigText} from './settings/configFields';
|
import {FilePathConfigField, ConfigText} from './settings/configFields';
|
||||||
import KeyboardShortcutInput from './settings/KeyboardShortcutInput';
|
import KeyboardShortcutInput from './settings/KeyboardShortcutInput';
|
||||||
import {isEqual} from 'lodash';
|
import {isEqual, isMatch, isEmpty} from 'lodash';
|
||||||
import restartFlipper from '../utils/restartFlipper';
|
import restartFlipper from '../utils/restartFlipper';
|
||||||
import LauncherSettingsPanel from '../fb-stubs/LauncherSettingsPanel';
|
import LauncherSettingsPanel from '../fb-stubs/LauncherSettingsPanel';
|
||||||
import SandySettingsPanel from '../fb-stubs/SandySettingsPanel';
|
import SandySettingsPanel from '../fb-stubs/SandySettingsPanel';
|
||||||
@@ -64,6 +64,8 @@ type DispatchFromProps = {
|
|||||||
type State = {
|
type State = {
|
||||||
updatedSettings: Settings;
|
updatedSettings: Settings;
|
||||||
updatedLauncherSettings: LauncherSettings;
|
updatedLauncherSettings: LauncherSettings;
|
||||||
|
forcedRestartSettings: Partial<Settings>;
|
||||||
|
forcedRestartLauncherSettings: Partial<LauncherSettings>;
|
||||||
};
|
};
|
||||||
|
|
||||||
type Props = OwnProps & StateFromProps & DispatchFromProps;
|
type Props = OwnProps & StateFromProps & DispatchFromProps;
|
||||||
@@ -71,6 +73,8 @@ class SettingsSheet extends Component<Props, State> {
|
|||||||
state: State = {
|
state: State = {
|
||||||
updatedSettings: {...this.props.settings},
|
updatedSettings: {...this.props.settings},
|
||||||
updatedLauncherSettings: {...this.props.launcherSettings},
|
updatedLauncherSettings: {...this.props.launcherSettings},
|
||||||
|
forcedRestartSettings: {},
|
||||||
|
forcedRestartLauncherSettings: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@@ -147,6 +151,15 @@ class SettingsSheet extends Component<Props, State> {
|
|||||||
isEqual(this.props.settings, this.state.updatedSettings) &&
|
isEqual(this.props.settings, this.state.updatedSettings) &&
|
||||||
isEqual(this.props.launcherSettings, this.state.updatedLauncherSettings);
|
isEqual(this.props.launcherSettings, this.state.updatedLauncherSettings);
|
||||||
|
|
||||||
|
const forcedRestart =
|
||||||
|
(!isEmpty(this.state.forcedRestartSettings) &&
|
||||||
|
!isMatch(this.props.settings, this.state.forcedRestartSettings)) ||
|
||||||
|
(!isEmpty(this.state.forcedRestartLauncherSettings) &&
|
||||||
|
!isMatch(
|
||||||
|
this.props.launcherSettings,
|
||||||
|
this.state.forcedRestartLauncherSettings,
|
||||||
|
));
|
||||||
|
|
||||||
const contents = (
|
const contents = (
|
||||||
<Layout.Container gap>
|
<Layout.Container gap>
|
||||||
<ToggledSection
|
<ToggledSection
|
||||||
@@ -245,6 +258,10 @@ class SettingsSheet extends Component<Props, State> {
|
|||||||
...this.state.updatedLauncherSettings,
|
...this.state.updatedLauncherSettings,
|
||||||
releaseChannel: v,
|
releaseChannel: v,
|
||||||
},
|
},
|
||||||
|
forcedRestartLauncherSettings: {
|
||||||
|
...this.state.forcedRestartLauncherSettings,
|
||||||
|
releaseChannel: v,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -256,6 +273,10 @@ class SettingsSheet extends Component<Props, State> {
|
|||||||
...this.state.updatedSettings,
|
...this.state.updatedSettings,
|
||||||
disableSandy: v,
|
disableSandy: v,
|
||||||
},
|
},
|
||||||
|
forcedRestartSettings: {
|
||||||
|
...this.state.forcedRestartSettings,
|
||||||
|
disableSandy: v,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -346,7 +367,7 @@ class SettingsSheet extends Component<Props, State> {
|
|||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
disabled={settingsPristine}
|
disabled={settingsPristine || forcedRestart}
|
||||||
compact
|
compact
|
||||||
padded
|
padded
|
||||||
onClick={this.applyChangesWithoutRestart}>
|
onClick={this.applyChangesWithoutRestart}>
|
||||||
|
|||||||
Reference in New Issue
Block a user