automatic updates notes
This commit is contained in:
parent
67608dfc9c
commit
a2823f33c8
4 changed files with 24 additions and 12 deletions
|
@ -289,6 +289,8 @@ app.on('before-quit', () => {
|
|||
ipcMain.on('download-upgrade', async (event, params) => {
|
||||
const { url, options } = params;
|
||||
const dir = fs.mkdtempSync(app.getPath('temp') + path.sep);
|
||||
// tell app of new tempdir
|
||||
rendererWindow.webContents.send('update-download-path', dir);
|
||||
options.onProgress = function(p) {
|
||||
rendererWindow.webContents.send('download-progress-update', p);
|
||||
};
|
||||
|
@ -318,7 +320,8 @@ ipcMain.on('check-for-updates', () => {
|
|||
autoUpdater.checkForUpdates();
|
||||
});
|
||||
|
||||
autoUpdater.on('update-downloaded', () => {
|
||||
autoUpdater.on('update-downloaded', (e, releaseNotes, releaseName) => {
|
||||
rendererWindow.webContents.send('log-this', {e, releaseNotes, releaseName});
|
||||
autoUpdateDownloaded = true;
|
||||
});
|
||||
|
||||
|
|
15
ui/index.jsx
15
ui/index.jsx
|
@ -118,6 +118,7 @@ ipcRenderer.on('open-uri-requested', (event, url, newSession) => {
|
|||
});
|
||||
|
||||
ipcRenderer.on('download-progress-update', (e, p) => {
|
||||
console.log('e', e, 'p', p);
|
||||
app.store.dispatch(doUpdateDownloadProgress(Math.round(p.percent * 100)));
|
||||
});
|
||||
|
||||
|
@ -146,12 +147,21 @@ ipcRenderer.on('zoom-window', (event, action) => {
|
|||
|
||||
const { dock } = remote.app;
|
||||
|
||||
ipcRenderer.on('log-this', (e, log) => {
|
||||
console.log('electron log:', log);
|
||||
});
|
||||
|
||||
ipcRenderer.on('window-is-focused', () => {
|
||||
if (!dock) return;
|
||||
app.store.dispatch({ type: ACTIONS.WINDOW_FOCUSED });
|
||||
dock.setBadge('');
|
||||
});
|
||||
|
||||
ipcRenderer.on('update-download-path', (dir) => {
|
||||
console.log('dir');
|
||||
// doLogWarningConsoleMessage();
|
||||
});
|
||||
|
||||
ipcRenderer.on('devtools-is-opened', () => {
|
||||
doLogWarningConsoleMessage();
|
||||
});
|
||||
|
@ -191,8 +201,9 @@ function AppWrapper() {
|
|||
useEffect(() => {
|
||||
if (persistDone) {
|
||||
const state = store.getState();
|
||||
const enabled = makeSelectClientSetting(SETTINGS.ENABLE_PRERELEASE_UPDATES)(state);
|
||||
if (enabled) {
|
||||
const prereleaseEnabled = makeSelectClientSetting(SETTINGS.ENABLE_PRERELEASE_UPDATES)(state);
|
||||
// const autoUpdateEnabled = makeSelectClientSetting(SETTINGS.ENABLE_PRERELEASE_UPDATES)(state);
|
||||
if (prereleaseEnabled) {
|
||||
autoUpdater.allowPrerelease = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,13 +3,13 @@ import { doStartUpgrade, doCancelUpgrade, doHideModal } from 'redux/actions/app'
|
|||
import { selectDownloadProgress, selectDownloadComplete, selectUpgradeDownloadPath } from 'redux/selectors/app';
|
||||
import ModalDownloading from './view';
|
||||
|
||||
const select = state => ({
|
||||
const select = (state) => ({
|
||||
downloadProgress: selectDownloadProgress(state),
|
||||
downloadComplete: selectDownloadComplete(state),
|
||||
downloadItem: selectUpgradeDownloadPath(state),
|
||||
downloadItem: selectUpgradeDownloadPath(state), // update or clear this when download (Re)starts
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
const perform = (dispatch) => ({
|
||||
startUpgrade: () => dispatch(doStartUpgrade()),
|
||||
cancelUpgrade: () => {
|
||||
dispatch(doHideModal());
|
||||
|
@ -17,7 +17,4 @@ const perform = dispatch => ({
|
|||
},
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
)(ModalDownloading);
|
||||
export default connect(select, perform)(ModalDownloading);
|
||||
|
|
|
@ -83,7 +83,8 @@ export function doSkipUpgrade() {
|
|||
export function doStartUpgrade() {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const upgradeDownloadPath = selectUpgradeDownloadPath(state);
|
||||
const upgradeDownloadPath = selectUpgradeDownloadPath(state); // downloadPath
|
||||
// make sure downloadPath is updated as soon as download starts
|
||||
|
||||
ipcRenderer.send('upgrade', upgradeDownloadPath);
|
||||
};
|
||||
|
@ -92,7 +93,7 @@ export function doStartUpgrade() {
|
|||
export function doDownloadUpgrade() {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const url = selectUpdateUrl(state);
|
||||
const url = selectUpdateUrl(state); // updateUrl
|
||||
ipcRenderer.send('download-upgrade', { url, options: {} });
|
||||
dispatch({
|
||||
type: ACTIONS.UPGRADE_DOWNLOAD_STARTED,
|
||||
|
|
Loading…
Reference in a new issue