From 73819d8eb7ed540c1101c5124b3537a092e1fdb3 Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Tue, 6 Oct 2020 14:34:04 -0700 Subject: [PATCH] view built-in privacy policy from telemetry dialog --- src/renderer/about.jsx | 12 +----------- src/renderer/app.jsx | 2 ++ src/renderer/showPrivacyPolicy.js | 13 +++++++++++++ 3 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 src/renderer/showPrivacyPolicy.js diff --git a/src/renderer/about.jsx b/src/renderer/about.jsx index da1ff42..31a6884 100644 --- a/src/renderer/about.jsx +++ b/src/renderer/about.jsx @@ -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 = () => (
diff --git a/src/renderer/app.jsx b/src/renderer/app.jsx index 85a2409..a8923bd 100644 --- a/src/renderer/app.jsx +++ b/src/renderer/app.jsx @@ -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} diff --git a/src/renderer/showPrivacyPolicy.js b/src/renderer/showPrivacyPolicy.js new file mode 100644 index 0000000..5f4371c --- /dev/null +++ b/src/renderer/showPrivacyPolicy.js @@ -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;