pass about menu items to GUI

This commit is contained in:
Christopher Willis-Ford 2020-11-17 15:02:47 -08:00
parent 4fe9e5b703
commit 25072c0046
3 changed files with 28 additions and 1 deletions

View file

@ -36,6 +36,9 @@ class ScratchDesktopTelemetry {
set didOptIn (value) {
this._telemetryClient.didOptIn = value;
}
clearDidOptIn () {
this._telemetryClient.clearDidOptIn();
}
appWasOpened () {
this._telemetryClient.addEvent('app::open', {...EVENT_TEMPLATE, ...APP_INFO});
@ -95,6 +98,11 @@ ipcMain.on('getTelemetryDidOptIn', event => {
});
ipcMain.on('setTelemetryDidOptIn', (event, arg) => {
scratchDesktopTelemetrySingleton.didOptIn = arg;
event.returnValue = null;
});
ipcMain.on('clearTelemetryDidOptIn', event => {
scratchDesktopTelemetrySingleton.clearDidOptIn();
event.returnValue = null;
});
ipcMain.on('projectDidLoad', (event, arg) => {
scratchDesktopTelemetrySingleton.projectDidLoad(arg);

View file

@ -185,6 +185,9 @@ class TelemetryClient {
set didOptIn (value) {
this._store.set('optIn', !!value);
}
clearDidOptIn () {
this._store.delete('optIn');
}
/**
* Semi-persistent unique ID for this client

View file

@ -116,7 +116,23 @@ const ScratchDesktopHOC = function (WrappedComponent) {
canSave={false}
isScratchDesktop
showTelemetryModal={shouldShowTelemetryModal}
onClickAbout={this.handleClickAbout}
onClickAbout={[
{
title: 'About',
onClick: () => this.handleClickAbout()
},
{
title: 'Privacy Policy',
onClick: () => showPrivacyPolicy()
},
{
title: 'Telemetry Settings',
onClick: () => {
// set to null (non-Boolean) to cause app to ask again
ipcRenderer.sendSync('clearTelemetryDidOptIn');
}
}
]}
onProjectTelemetryEvent={this.handleProjectTelemetryEvent}
onShowPrivacyPolicy={showPrivacyPolicy}
onStorageInit={this.handleStorageInit}