Fix ESLint error
This commit is contained in:
@@ -1,24 +1,31 @@
|
|||||||
const React = require('react');
|
// Copyright (c) 2015-2016 Yuya Ochiai
|
||||||
const propTypes = require('prop-types');
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||||
const {Button, Navbar, ProgressBar} = require('react-bootstrap');
|
// 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) {
|
function InstallButton(props) {
|
||||||
if (props.notifyOnly) {
|
if (props.notifyOnly) {
|
||||||
return (<Button
|
return (
|
||||||
|
<Button
|
||||||
bsStyle='primary'
|
bsStyle='primary'
|
||||||
onClick={props.onClickDownload}
|
onClick={props.onClickDownload}
|
||||||
>{'Download Update'}</Button>);
|
>{'Download Update'}</Button>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return (<Button
|
return (
|
||||||
|
<Button
|
||||||
bsStyle='primary'
|
bsStyle='primary'
|
||||||
onClick={props.onClickInstall}
|
onClick={props.onClickInstall}
|
||||||
>{'Install Update'}</Button>);
|
>{'Install Update'}</Button>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
InstallButton.propTypes = {
|
InstallButton.propTypes = {
|
||||||
notifyOnly: propTypes.bool.isRequired,
|
notifyOnly: propTypes.bool.isRequired,
|
||||||
onClickInstall: propTypes.func.isRequired,
|
onClickInstall: propTypes.func.isRequired,
|
||||||
onClickDownload: propTypes.func.isRequired
|
onClickDownload: propTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
function UpdaterPage(props) {
|
function UpdaterPage(props) {
|
||||||
@@ -84,7 +91,7 @@ UpdaterPage.propTypes = {
|
|||||||
onClickDownload: propTypes.func.isRequired,
|
onClickDownload: propTypes.func.isRequired,
|
||||||
onClickReleaseNotes: propTypes.func.isRequired,
|
onClickReleaseNotes: propTypes.func.isRequired,
|
||||||
onClickRemind: propTypes.func.isRequired,
|
onClickRemind: propTypes.func.isRequired,
|
||||||
onClickSkip: propTypes.func.isRequired
|
onClickSkip: propTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = UpdaterPage;
|
export default UpdaterPage;
|
||||||
|
@@ -1,9 +1,14 @@
|
|||||||
const React = require('react');
|
// Copyright (c) 2015-2016 Yuya Ochiai
|
||||||
const ReactDOM = require('react-dom');
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||||
const propTypes = require('prop-types');
|
// See LICENSE.txt for license information.
|
||||||
const {ipcRenderer} = require('electron');
|
import url from 'url';
|
||||||
const url = require('url');
|
|
||||||
const UpdaterPage = require('./components/UpdaterPage.jsx');
|
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 thisURL = url.parse(location.href, true);
|
||||||
const notifyOnly = thisURL.query.notifyOnly === 'true';
|
const notifyOnly = thisURL.query.notifyOnly === 'true';
|
||||||
@@ -17,12 +22,12 @@ class UpdaterPageContainer extends React.Component {
|
|||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
ipcRenderer.on('start-download', () => {
|
ipcRenderer.on('start-download', () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isDownloading: true
|
isDownloading: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
ipcRenderer.on('progress', (event, progress) => {
|
ipcRenderer.on('progress', (event, progress) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
progress
|
progress,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -54,7 +59,7 @@ class UpdaterPageContainer extends React.Component {
|
|||||||
|
|
||||||
UpdaterPageContainer.propTypes = {
|
UpdaterPageContainer.propTypes = {
|
||||||
notifyOnly: propTypes.bool,
|
notifyOnly: propTypes.bool,
|
||||||
initialState: propTypes.object
|
initialState: propTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
|
@@ -25,7 +25,7 @@ import {parse as parseArgv} from 'yargs';
|
|||||||
import {protocols} from '../electron-builder.json';
|
import {protocols} from '../electron-builder.json';
|
||||||
|
|
||||||
import CriticalErrorHandler from './main/CriticalErrorHandler';
|
import CriticalErrorHandler from './main/CriticalErrorHandler';
|
||||||
import {upgradeAutoLaunch} from './main/autoLaunch';
|
import upgradeAutoLaunch from './main/autoLaunch';
|
||||||
import buildConfig from './common/config/buildConfig';
|
import buildConfig from './common/config/buildConfig';
|
||||||
|
|
||||||
const criticalErrorHandler = new CriticalErrorHandler();
|
const criticalErrorHandler = new CriticalErrorHandler();
|
||||||
|
@@ -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() {
|
async function upgradeAutoLaunch() {
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
@@ -6,7 +9,7 @@ async function upgradeAutoLaunch() {
|
|||||||
}
|
}
|
||||||
const appLauncher = new AutoLaunch({
|
const appLauncher = new AutoLaunch({
|
||||||
name: 'Mattermost',
|
name: 'Mattermost',
|
||||||
isHidden: true
|
isHidden: true,
|
||||||
});
|
});
|
||||||
const enabled = await appLauncher.isEnabled();
|
const enabled = await appLauncher.isEnabled();
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
@@ -14,4 +17,4 @@ async function upgradeAutoLaunch() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {upgradeAutoLaunch};
|
export default upgradeAutoLaunch;
|
||||||
|
@@ -1,8 +1,14 @@
|
|||||||
const {app, BrowserWindow, dialog, ipcMain, shell} = require('electron');
|
// Copyright (c) 2015-2016 Yuya Ochiai
|
||||||
const fs = require('fs');
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||||
const path = require('path');
|
// See LICENSE.txt for license information.
|
||||||
const {autoUpdater} = require('electron-updater');
|
|
||||||
const semver = require('semver');
|
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]
|
const INTERVAL_48_HOURS_IN_MS = 172800000; // 48 * 60 * 60 * 1000 [ms]
|
||||||
|
|
||||||
@@ -28,7 +34,7 @@ function createUpdaterModal(parentWindow, options) {
|
|||||||
width: windowWidth,
|
width: windowWidth,
|
||||||
height: windowHeight,
|
height: windowHeight,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
autoHideMenuBar: true
|
autoHideMenuBar: true,
|
||||||
};
|
};
|
||||||
if (process.platform === 'linux') {
|
if (process.platform === 'linux') {
|
||||||
windowOptions.icon = options.linuxAppIcon;
|
windowOptions.icon = options.linuxAppIcon;
|
||||||
@@ -87,7 +93,7 @@ function initialize(appState, mainWindow, notifyOnly = false) {
|
|||||||
if (isUpdateApplicable(new Date(), appState.skippedVersion, info)) {
|
if (isUpdateApplicable(new Date(), appState.skippedVersion, info)) {
|
||||||
updaterModal = createUpdaterModal(mainWindow, {
|
updaterModal = createUpdaterModal(mainWindow, {
|
||||||
linuxAppIcon: path.join(assetsDir, 'appicon.png'),
|
linuxAppIcon: path.join(assetsDir, 'appicon.png'),
|
||||||
notifyOnly
|
notifyOnly,
|
||||||
});
|
});
|
||||||
updaterModal.on('closed', () => {
|
updaterModal.on('closed', () => {
|
||||||
updaterModal = null;
|
updaterModal = null;
|
||||||
@@ -123,7 +129,7 @@ function initialize(appState, mainWindow, notifyOnly = false) {
|
|||||||
type: 'info',
|
type: 'info',
|
||||||
buttons: ['Close'],
|
buttons: ['Close'],
|
||||||
title: 'Your Desktop App is up to date',
|
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
|
}, () => {}); // eslint-disable-line no-empty-function
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -169,10 +175,10 @@ function loadConfig(file) {
|
|||||||
return new AutoUpdaterConfig(file);
|
return new AutoUpdaterConfig(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
export default {
|
||||||
INTERVAL_48_HOURS_IN_MS,
|
INTERVAL_48_HOURS_IN_MS,
|
||||||
checkForUpdates,
|
checkForUpdates,
|
||||||
shouldCheckForUpdatesOnStart,
|
shouldCheckForUpdatesOnStart,
|
||||||
initialize,
|
initialize,
|
||||||
loadConfig
|
loadConfig,
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user