keep telemetry modal state in sync with main process

This commit is contained in:
Christopher Willis-Ford 2020-12-02 14:03:57 -08:00
parent afb29bfdef
commit d56a3c5810

View file

@ -99,15 +99,18 @@ const ScratchDesktopHOC = function (WrappedComponent) {
}
handleTelemetryModalOptIn () {
ipcRenderer.send('setTelemetryDidOptIn', true);
this.forceUpdate();
}
handleTelemetryModalOptOut () {
ipcRenderer.send('setTelemetryDidOptIn', false);
this.forceUpdate();
}
handleUpdateProjectTitle (newTitle) {
this.setState({projectTitle: newTitle});
}
render () {
const shouldShowTelemetryModal = (typeof ipcRenderer.sendSync('getTelemetryDidOptIn') !== 'boolean');
const currentTelemetryState = ipcRenderer.sendSync('getTelemetryDidOptIn');
const shouldShowTelemetryModal = (typeof currentTelemetryState !== 'boolean');
const childProps = omit(this.props, Object.keys(ScratchDesktopComponent.propTypes));
@ -116,6 +119,7 @@ const ScratchDesktopHOC = function (WrappedComponent) {
canModifyCloudData={false}
canSave={false}
isScratchDesktop
isTelemetryEnabled={currentTelemetryState}
showTelemetryModal={shouldShowTelemetryModal}
onClickAbout={[
{