diff --git a/desktop/app/src/chrome/AutoUpdateVersion.tsx b/desktop/app/src/chrome/AutoUpdateVersion.tsx deleted file mode 100644 index 6cb945227..000000000 --- a/desktop/app/src/chrome/AutoUpdateVersion.tsx +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -import {FlexRow, colors, LoadingIndicator, Glyph, styled} from '../ui'; -import {remote} from 'electron'; -import isProduction from '../utils/isProduction'; -import React, {Component} from 'react'; -import config from '../fb-stubs/config'; - -const Container = styled(FlexRow)({ - alignItems: 'center', -}); - -type State = { - updater: - | 'error' - | 'checking-for-update' - | 'update-available' - | 'update-not-available' - | 'update-downloaded'; - error?: string; -}; - -type Props = { - version: string; -}; - -export default class AutoUpdateVersion extends Component { - state: State = { - updater: 'update-not-available', - }; - - componentDidMount() { - if (isProduction()) { - // this will fail, if the app is not code signed - try { - remote.autoUpdater.setFeedURL({ - url: `${config.updateServer}?version=${this.props.version}`, - }); - } catch (e) { - console.error(e); - } - - remote.autoUpdater.on('update-downloaded', () => { - this.setState({updater: 'update-downloaded'}); - - const notification = new Notification('Update available', { - body: 'Restart Flipper to update to the latest version.', - requireInteraction: true, - }); - notification.onclick = remote.autoUpdater.quitAndInstall; - }); - - remote.autoUpdater.on('error', (error) => { - this.setState({updater: 'error', error: error.toString()}); - }); - - remote.autoUpdater.on('checking-for-update', () => { - this.setState({updater: 'checking-for-update'}); - }); - - remote.autoUpdater.on('update-available', () => { - this.setState({updater: 'update-available'}); - }); - - remote.autoUpdater.on('update-not-available', () => { - this.setState({updater: 'update-not-available'}); - }); - - remote.autoUpdater.checkForUpdates(); - } - } - - render() { - return ( - - {this.state.updater === 'update-available' && ( - - - - )} - {this.state.updater === 'error' && ( - - - - )} - {this.state.updater === 'update-downloaded' && ( - - - - )} - - ); - } -} diff --git a/desktop/app/src/chrome/TitleBar.tsx b/desktop/app/src/chrome/TitleBar.tsx index 631fbe4af..c409545fc 100644 --- a/desktop/app/src/chrome/TitleBar.tsx +++ b/desktop/app/src/chrome/TitleBar.tsx @@ -33,10 +33,8 @@ import RatingButton from './RatingButton'; import DevicesButton from './DevicesButton'; import {LocationsButton} from './LocationsButton'; import ScreenCaptureButtons from './ScreenCaptureButtons'; -import AutoUpdateVersion from './AutoUpdateVersion'; import UpdateIndicator from './UpdateIndicator'; import config from '../fb-stubs/config'; -import {isAutoUpdaterEnabled} from '../utils/argvUtils'; import isProduction from '../utils/isProduction'; import {clipboard} from 'electron'; import React from 'react'; @@ -176,14 +174,10 @@ class TitleBar extends React.Component { {config.showFlipperRating ? : null} {this.props.version + (isProduction() ? '' : '-dev')} - {isAutoUpdaterEnabled() ? ( - - ) : ( - - )} +