diff --git a/src/browser/components/UpdaterPage.jsx b/src/browser/components/UpdaterPage.jsx index 7fa356e9..3b9be435 100644 --- a/src/browser/components/UpdaterPage.jsx +++ b/src/browser/components/UpdaterPage.jsx @@ -1,24 +1,31 @@ -const React = require('react'); -const propTypes = require('prop-types'); -const {Button, Navbar, ProgressBar} = require('react-bootstrap'); +// Copyright (c) 2015-2016 Yuya Ochiai +// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. +import React from 'react'; +import propTypes from 'prop-types'; +import {Button, Navbar, ProgressBar} from 'react-bootstrap'; function InstallButton(props) { if (props.notifyOnly) { - return (); + return ( + + ); } - return (); + return ( + + ); } InstallButton.propTypes = { notifyOnly: propTypes.bool.isRequired, onClickInstall: propTypes.func.isRequired, - onClickDownload: propTypes.func.isRequired + onClickDownload: propTypes.func.isRequired, }; function UpdaterPage(props) { @@ -84,7 +91,7 @@ UpdaterPage.propTypes = { onClickDownload: propTypes.func.isRequired, onClickReleaseNotes: propTypes.func.isRequired, onClickRemind: propTypes.func.isRequired, - onClickSkip: propTypes.func.isRequired + onClickSkip: propTypes.func.isRequired, }; -module.exports = UpdaterPage; +export default UpdaterPage; diff --git a/src/browser/updater.jsx b/src/browser/updater.jsx index a6a1d74d..a10b6d66 100644 --- a/src/browser/updater.jsx +++ b/src/browser/updater.jsx @@ -1,9 +1,14 @@ -const React = require('react'); -const ReactDOM = require('react-dom'); -const propTypes = require('prop-types'); -const {ipcRenderer} = require('electron'); -const url = require('url'); -const UpdaterPage = require('./components/UpdaterPage.jsx'); +// Copyright (c) 2015-2016 Yuya Ochiai +// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. +import url from 'url'; + +import React from 'react'; +import ReactDOM from 'react-dom'; +import propTypes from 'prop-types'; +import {ipcRenderer} from 'electron'; + +import UpdaterPage from './components/UpdaterPage.jsx'; const thisURL = url.parse(location.href, true); const notifyOnly = thisURL.query.notifyOnly === 'true'; @@ -17,12 +22,12 @@ class UpdaterPageContainer extends React.Component { componentDidMount() { ipcRenderer.on('start-download', () => { this.setState({ - isDownloading: true + isDownloading: true, }); }); ipcRenderer.on('progress', (event, progress) => { this.setState({ - progress + progress, }); }); } @@ -54,7 +59,7 @@ class UpdaterPageContainer extends React.Component { UpdaterPageContainer.propTypes = { notifyOnly: propTypes.bool, - initialState: propTypes.object + initialState: propTypes.object, }; ReactDOM.render( diff --git a/src/main.js b/src/main.js index d943b2c8..36246d41 100644 --- a/src/main.js +++ b/src/main.js @@ -25,7 +25,7 @@ import {parse as parseArgv} from 'yargs'; import {protocols} from '../electron-builder.json'; import CriticalErrorHandler from './main/CriticalErrorHandler'; -import {upgradeAutoLaunch} from './main/autoLaunch'; +import upgradeAutoLaunch from './main/autoLaunch'; import buildConfig from './common/config/buildConfig'; const criticalErrorHandler = new CriticalErrorHandler(); diff --git a/src/main/autoLaunch.js b/src/main/autoLaunch.js index 85fd0e92..72eac789 100644 --- a/src/main/autoLaunch.js +++ b/src/main/autoLaunch.js @@ -1,4 +1,7 @@ -const AutoLaunch = require('auto-launch'); +// Copyright (c) 2015-2016 Yuya Ochiai +// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. +import AutoLaunch from 'auto-launch'; async function upgradeAutoLaunch() { if (process.platform === 'darwin') { @@ -6,7 +9,7 @@ async function upgradeAutoLaunch() { } const appLauncher = new AutoLaunch({ name: 'Mattermost', - isHidden: true + isHidden: true, }); const enabled = await appLauncher.isEnabled(); if (enabled) { @@ -14,4 +17,4 @@ async function upgradeAutoLaunch() { } } -module.exports = {upgradeAutoLaunch}; +export default upgradeAutoLaunch; diff --git a/src/main/autoUpdater.js b/src/main/autoUpdater.js index 63f57c54..035d268a 100644 --- a/src/main/autoUpdater.js +++ b/src/main/autoUpdater.js @@ -1,8 +1,14 @@ -const {app, BrowserWindow, dialog, ipcMain, shell} = require('electron'); -const fs = require('fs'); -const path = require('path'); -const {autoUpdater} = require('electron-updater'); -const semver = require('semver'); +// Copyright (c) 2015-2016 Yuya Ochiai +// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import fs from 'fs'; +import path from 'path'; + +import {app, BrowserWindow, dialog, ipcMain, shell} from 'electron'; + +import {autoUpdater} from 'electron-updater'; +import semver from 'semver'; const INTERVAL_48_HOURS_IN_MS = 172800000; // 48 * 60 * 60 * 1000 [ms] @@ -28,7 +34,7 @@ function createUpdaterModal(parentWindow, options) { width: windowWidth, height: windowHeight, resizable: false, - autoHideMenuBar: true + autoHideMenuBar: true, }; if (process.platform === 'linux') { windowOptions.icon = options.linuxAppIcon; @@ -87,7 +93,7 @@ function initialize(appState, mainWindow, notifyOnly = false) { if (isUpdateApplicable(new Date(), appState.skippedVersion, info)) { updaterModal = createUpdaterModal(mainWindow, { linuxAppIcon: path.join(assetsDir, 'appicon.png'), - notifyOnly + notifyOnly, }); updaterModal.on('closed', () => { updaterModal = null; @@ -123,7 +129,7 @@ function initialize(appState, mainWindow, notifyOnly = false) { type: 'info', buttons: ['Close'], title: 'Your Desktop App is up to date', - message: 'You have the latest version of the Mattermost Desktop App.' + message: 'You have the latest version of the Mattermost Desktop App.', }, () => {}); // eslint-disable-line no-empty-function } setTimeout(() => { @@ -169,10 +175,10 @@ function loadConfig(file) { return new AutoUpdaterConfig(file); } -module.exports = { +export default { INTERVAL_48_HOURS_IN_MS, checkForUpdates, shouldCheckForUpdatesOnStart, initialize, - loadConfig + loadConfig, };