Restart after changing settings

Summary:
Gets flipper to restart when settings are updated.

In theory most settings should not need this, but the current only one does (android home) because the path is set at startup only, and this modifies the input to it.
It would be a bit awkward to modify the path more than once, but doable.

Reviewed By: passy

Differential Revision: D17737582

fbshipit-source-id: d4669dcc7acc95469f15783fc6a5ba6794750234
This commit is contained in:
John Knox
2019-10-07 08:49:05 -07:00
committed by Facebook Github Bot
parent 729e74f2fc
commit b50aef8f15
3 changed files with 30 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ import {updateSettings, Action} from '../reducers/settings';
import {connect} from 'react-redux';
import {State as Store} from '../reducers';
import {Settings} from '../reducers/settings';
import {flush} from '../utils/persistor';
import {promises as fs} from 'fs';
import {remote} from 'electron';
import path from 'path';
@@ -129,6 +130,10 @@ class SignInSheet extends Component<Props, State> {
applyChanges = async () => {
this.props.updateSettings(this.state.updatedSettings);
this.props.onHide();
flush().then(() => {
remote.app.relaunch();
remote.app.exit();
});
};
render() {
@@ -154,7 +159,7 @@ class SignInSheet extends Component<Props, State> {
Cancel
</Button>
<Button type="primary" compact padded onClick={this.applyChanges}>
Apply
Apply and Restart
</Button>
</FlexRow>
</Container>