Remove AutoUpdateVersion
Summary: With Sandy we don't have a designed UI for the auto updater, and since this functionality has been disabled for almost a year, we can safely remove it for now until we have the underlying infra, and then rethink the UI if we ever re-introduce it Reviewed By: passy Differential Revision: D25804854 fbshipit-source-id: fd96624ffd44e373e8f2c454a67b3797b16779a6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1d23e043de
commit
bd6c5c0f71
@@ -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<Props, State> {
|
||||
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 (
|
||||
<Container>
|
||||
{this.state.updater === 'update-available' && (
|
||||
<span title="Downloading new version">
|
||||
<LoadingIndicator size={16} />
|
||||
</span>
|
||||
)}
|
||||
{this.state.updater === 'error' && (
|
||||
<span title={`Error fetching update: ${this.state.error || ''}`}>
|
||||
<Glyph color={colors.light30} name="caution-triangle" />
|
||||
</span>
|
||||
)}
|
||||
{this.state.updater === 'update-downloaded' && (
|
||||
<span
|
||||
tabIndex={-1}
|
||||
role="button"
|
||||
title="Update available. Restart Flipper."
|
||||
onClick={remote.autoUpdater.quitAndInstall}>
|
||||
<Glyph color={colors.light30} name="breaking-news" />
|
||||
</span>
|
||||
)}
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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<Props, StateFromProps> {
|
||||
{config.showFlipperRating ? <RatingButton /> : null}
|
||||
<Version>{this.props.version + (isProduction() ? '' : '-dev')}</Version>
|
||||
|
||||
{isAutoUpdaterEnabled() ? (
|
||||
<AutoUpdateVersion version={this.props.version} />
|
||||
) : (
|
||||
<UpdateIndicator
|
||||
launcherMsg={this.props.launcherMsg}
|
||||
version={this.props.version}
|
||||
/>
|
||||
)}
|
||||
<UpdateIndicator
|
||||
launcherMsg={this.props.launcherMsg}
|
||||
version={this.props.version}
|
||||
/>
|
||||
|
||||
<Button
|
||||
icon="settings"
|
||||
|
||||
@@ -12,8 +12,6 @@ import {styled, colors} from '../ui';
|
||||
import FpsGraph from '../chrome/FpsGraph';
|
||||
import NetworkGraph from '../chrome/NetworkGraph';
|
||||
import isProduction from '../utils/isProduction';
|
||||
import {isAutoUpdaterEnabled} from '../utils/argvUtils';
|
||||
import AutoUpdateVersion from '../chrome/AutoUpdateVersion';
|
||||
import UpdateIndicator from '../chrome/UpdateIndicator';
|
||||
import {Version} from '../chrome/TitleBar';
|
||||
import {useStore} from '../utils/useStore';
|
||||
@@ -63,11 +61,7 @@ export function TemporarilyTitlebar() {
|
||||
? `-${config.getReleaseChannel()}`
|
||||
: '')}
|
||||
</Version>
|
||||
{isAutoUpdaterEnabled() ? (
|
||||
<AutoUpdateVersion version={version} />
|
||||
) : (
|
||||
<UpdateIndicator launcherMsg={launcherMsg} version={version} />
|
||||
)}
|
||||
<UpdateIndicator launcherMsg={launcherMsg} version={version} />
|
||||
</TemporarilyTitlebarContainer>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +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
|
||||
*/
|
||||
|
||||
export const isAutoUpdaterEnabled = false;
|
||||
@@ -18,7 +18,6 @@ test('config is decoded from env', () => {
|
||||
disabledPlugins: ['pluginA', 'pluginB', 'pluginC'],
|
||||
lastWindowPosition: {x: 4, y: 8, width: 15, height: 16},
|
||||
launcherMsg: 'wubba lubba dub dub',
|
||||
updaterEnabled: false,
|
||||
screenCapturePath: '/my/screenshot/path',
|
||||
launcherEnabled: false,
|
||||
});
|
||||
@@ -27,7 +26,6 @@ test('config is decoded from env', () => {
|
||||
disabledPlugins: new Set(['pluginA', 'pluginB', 'pluginC']),
|
||||
lastWindowPosition: {x: 4, y: 8, width: 15, height: 16},
|
||||
launcherMsg: 'wubba lubba dub dub',
|
||||
updaterEnabled: false,
|
||||
screenCapturePath: '/my/screenshot/path',
|
||||
launcherEnabled: false,
|
||||
});
|
||||
@@ -40,7 +38,6 @@ test('config is decoded from env with defaults', () => {
|
||||
disabledPlugins: new Set([]),
|
||||
lastWindowPosition: undefined,
|
||||
launcherMsg: undefined,
|
||||
updaterEnabled: false,
|
||||
screenCapturePath: undefined,
|
||||
launcherEnabled: true,
|
||||
});
|
||||
|
||||
@@ -1,16 +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 isProduction from './isProduction';
|
||||
import processConfig from './processConfig';
|
||||
|
||||
export const isAutoUpdaterEnabled = () =>
|
||||
processConfig().updaterEnabled &&
|
||||
isProduction() &&
|
||||
process.platform === 'darwin';
|
||||
@@ -19,7 +19,6 @@ export type ProcessConfig = {
|
||||
} | null;
|
||||
screenCapturePath: string | null;
|
||||
launcherMsg: string | null;
|
||||
updaterEnabled: boolean;
|
||||
// Controls whether to delegate to the launcher if present.
|
||||
launcherEnabled: boolean;
|
||||
};
|
||||
@@ -34,8 +33,6 @@ export default function config(): ProcessConfig {
|
||||
disabledPlugins: new Set(json.disabledPlugins || []),
|
||||
lastWindowPosition: json.lastWindowPosition,
|
||||
launcherMsg: json.launcherMsg,
|
||||
// TODO(T64836070): The built-in updater is disabled as we don't have a strategy for signing prod builds right now.
|
||||
updaterEnabled: false,
|
||||
screenCapturePath: json.screenCapturePath,
|
||||
launcherEnabled:
|
||||
typeof json.launcherEnabled === 'boolean' ? json.launcherEnabled : true,
|
||||
|
||||
Reference in New Issue
Block a user