Finish core UI for auto update

This commit is contained in:
Alex Liebowitz 2017-12-10 03:06:30 -05:00
parent 565f411986
commit 3957bf2afc
5 changed files with 19 additions and 8 deletions

View file

@ -436,9 +436,6 @@ app.on('before-quit', event => {
shutdownDaemonAndQuit(); shutdownDaemonAndQuit();
} else { } else {
console.log('Quitting.'); console.log('Quitting.');
if (autoUpdating) {
minimize = false;
}
} }
}); });

View file

@ -19,7 +19,6 @@ export const DOWNLOAD_UPGRADE = 'DOWNLOAD_UPGRADE';
export const UPGRADE_DOWNLOAD_STARTED = 'UPGRADE_DOWNLOAD_STARTED'; export const UPGRADE_DOWNLOAD_STARTED = 'UPGRADE_DOWNLOAD_STARTED';
export const UPGRADE_DOWNLOAD_COMPLETED = 'UPGRADE_DOWNLOAD_COMPLETED'; export const UPGRADE_DOWNLOAD_COMPLETED = 'UPGRADE_DOWNLOAD_COMPLETED';
export const UPGRADE_DOWNLOAD_PROGRESSED = 'UPGRADE_DOWNLOAD_PROGRESSED'; export const UPGRADE_DOWNLOAD_PROGRESSED = 'UPGRADE_DOWNLOAD_PROGRESSED';
export const AUTO_UPDATE_DOWNLOAD_COMPLETED = "AUTO_UPDATE_DOWNLOAD_COMPLETED";
export const CHECK_UPGRADE_AVAILABLE = 'CHECK_UPGRADE_AVAILABLE'; export const CHECK_UPGRADE_AVAILABLE = 'CHECK_UPGRADE_AVAILABLE';
export const CHECK_UPGRADE_START = 'CHECK_UPGRADE_START'; export const CHECK_UPGRADE_START = 'CHECK_UPGRADE_START';
export const CHECK_UPGRADE_SUCCESS = 'CHECK_UPGRADE_SUCCESS'; export const CHECK_UPGRADE_SUCCESS = 'CHECK_UPGRADE_SUCCESS';

View file

@ -20,6 +20,8 @@ import app from './app';
const { autoUpdater } = remote.require('electron-updater'); const { autoUpdater } = remote.require('electron-updater');
const { contextMenu } = remote.require('./main.js'); const { contextMenu } = remote.require('./main.js');
autoUpdater.logger = remote.require("electron-log");
window.addEventListener('contextmenu', event => { window.addEventListener('contextmenu', event => {
contextMenu(remote.getCurrentWindow(), event.x, event.y, app.env === 'development'); contextMenu(remote.getCurrentWindow(), event.x, event.y, app.env === 'development');
event.preventDefault(); event.preventDefault();
@ -102,6 +104,18 @@ const init = () => {
app.store.dispatch(doAutoUpdate()); app.store.dispatch(doAutoUpdate());
}); });
if (["win32", "darwin"].includes(process.platform)) {
autoUpdater.on("update-available", () => {
console.log("Update available");
});
autoUpdater.on("update-not-available", () => {
console.log("Update not available");
});
autoUpdater.on("update-downloaded", () => {
console.log("Update downloaded");
app.store.dispatch(doAutoUpdate());
});
}
app.store.dispatch(doDownloadLanguages()); app.store.dispatch(doDownloadLanguages());
function onDaemonReady() { function onDaemonReady() {

View file

@ -3,8 +3,7 @@ import { Modal } from "modal/modal";
import { Line } from "rc-progress"; import { Line } from "rc-progress";
import Link from "component/link/index"; import Link from "component/link/index";
const { remote } = require("electron"); const { ipcRenderer } = require("electron");
const { autoUpdater } = remote.require("electron-updater");
class ModalAutoUpdateDownloaded extends React.PureComponent { class ModalAutoUpdateDownloaded extends React.PureComponent {
render() { render() {
@ -13,7 +12,9 @@ class ModalAutoUpdateDownloaded extends React.PureComponent {
isOpen={true} isOpen={true}
contentLabel={__("Update downloaded")} contentLabel={__("Update downloaded")}
confirmButtonLabel={__("Update and Restart")} confirmButtonLabel={__("Update and Restart")}
onConfirmed={autoUpdater.quitAndInstall()} onConfirmed={() => {
ipcRenderer.send("autoUpdate");
}}
> >
<section> <section>
<h3 className="text-center">{__("LBRY Leveled Up")}</h3> <h3 className="text-center">{__("LBRY Leveled Up")}</h3>

View file

@ -111,7 +111,7 @@ export function doAutoUpdate() {
const state = getState(); const state = getState();
dispatch({ dispatch({
type: types.OPEN_MODAL, type: types.OPEN_MODAL,
data: modals.AUTO_UPDATE_DOWNLOADED, data: { modal: modals.AUTO_UPDATE_DOWNLOADED },
}); });
}; };
} }