view built-in privacy policy from telemetry dialog

This commit is contained in:
Christopher Willis-Ford 2020-10-06 14:34:04 -07:00
parent ca7eeb9b7a
commit 73819d8eb7
3 changed files with 16 additions and 11 deletions

View file

@ -1,20 +1,10 @@
import {ipcRenderer} from 'electron';
import React from 'react';
import ReactDOM from 'react-dom';
import {productName, version} from '../../package.json';
import logo from '../icon/ScratchDesktop.svg';
import styles from './about.css';
// don't actually follow the link in the `href` attribute
// instead, tell the main process to open the privacy policy window
const showPrivacyPolicy = event => {
if (event) {
event.preventDefault();
}
ipcRenderer.send('open-privacy-policy-window');
return false;
};
import showPrivacyPolicy from './showPrivacyPolicy';
const AboutElement = () => (
<div className={styles.aboutBox}>

View file

@ -26,6 +26,7 @@ import {
import ElectronStorageHelper from '../common/ElectronStorageHelper';
import showPrivacyPolicy from './showPrivacyPolicy';
import styles from './app.css';
const appTarget = document.getElementById('app');
@ -118,6 +119,7 @@ const ScratchDesktopHOC = function (WrappedComponent) {
showTelemetryModal={shouldShowTelemetryModal}
onClickAbout={this.handleClickAbout}
onProjectTelemetryEvent={this.handleProjectTelemetryEvent}
onShowPrivacyPolicy={showPrivacyPolicy}
onStorageInit={this.handleStorageInit}
onTelemetryModalOptIn={this.handleTelemetryModalOptIn}
onTelemetryModalOptOut={this.handleTelemetryModalOptOut}

View file

@ -0,0 +1,13 @@
import {ipcRenderer} from 'electron';
const showPrivacyPolicy = event => {
if (event) {
// Probably a click on a link; don't actually follow the link in the `href` attribute.
event.preventDefault();
}
// tell the main process to open the privacy policy window
ipcRenderer.send('open-privacy-policy-window');
return false;
};
export default showPrivacyPolicy;