lbry-desktop/ui/modal/modalDownloading/view.jsx
Franco Montenegro f065218ff4
Prevent .deb packages from being opened with archive manager. (#7502)
* Prevent .deb packages from being opened with archive manager.

* Allow to properly cancel download upgrade and prevent multiple downloads.

* Fix missing app-update.yml file for .deb builds.

* Small fix for allowPrerelease prop in autoUpdater.

* Use release/tags endpoint to get the release details.

* Handle error case for auto updater.

* Make install now button display the upgrade modal.

* Use GitHub as provider for manual update url.

* Small fixes in updater.

* Fix small lint errors.

* Properly handle auto download on/off.
2022-07-07 16:48:42 -04:00

71 lines
2.4 KiB
JavaScript

// @flow
import React from 'react';
import { Modal } from 'modal/modal';
import { Line } from 'rc-progress';
import Button from 'component/button';
type Props = {
downloadProgress: ?number,
downloadComplete: boolean,
downloadItem: string,
startUpgrade: () => void,
cancelUpgrade: () => void,
upgradeInitialized: boolean,
failedInstallation: boolean,
};
class ModalDownloading extends React.PureComponent<Props> {
render() {
const {
downloadProgress,
downloadComplete,
downloadItem,
startUpgrade,
cancelUpgrade,
upgradeInitialized,
failedInstallation,
} = this.props;
return (
<Modal title={__('Downloading update')} isOpen contentLabel={__('Downloading update')} type="custom">
{downloadProgress ? `${downloadProgress}% ${__('complete')}` : null}
<Line percent={downloadProgress || 0} strokeWidth="4" />
{downloadComplete ? (
<React.Fragment>
<p>{__('Click "Begin Upgrade" to start the upgrade process.')}</p>
<p>
{__(
'The app will close (if not, quit with CTRL-Q), and you will be prompted to install the latest version of LBRY.'
)}
</p>
<p>
{__('To launch installation manually, close LBRY (CTRL-Q) and run the command below in the terminal.')}
</p>
<blockquote>sudo dpkg -i {downloadItem}</blockquote>
<p>{__('After the install is complete, please reopen the app.')}</p>
<p>
{__('Note: You can also install the AppImage version for streamlined updates.')}{' '}
<Button button="link" label={__('Download here.')} href="https://lbry.com/get/lbry.AppImage" />
</p>
</React.Fragment>
) : null}
{failedInstallation && <p>{__('There was an error during installation. Please, try again.')}</p>}
<div className="card__actions">
{downloadComplete ? (
<Button
disabled={upgradeInitialized}
button="primary"
label={__(upgradeInitialized ? 'Installing, please wait...' : 'Begin Upgrade')}
onClick={startUpgrade}
/>
) : null}
<Button disabled={upgradeInitialized} button="link" label={__('Cancel')} onClick={cancelUpgrade} />
</div>
</Modal>
);
}
}
export default ModalDownloading;