[Splash] Add manual host update UI support
This commit is contained in:
parent
fd6274bb95
commit
f09208979a
4 changed files with 13 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
|||
const { app } = require('electron');
|
||||
const { app, ipcMain } = require('electron');
|
||||
|
||||
const moduleUpdater = require("../updater/moduleUpdater");
|
||||
const updater = require("../updater/updater");
|
||||
|
@ -68,6 +68,9 @@ const launchSplash = (startMin) => {
|
|||
|
||||
if (process.platform !== 'darwin') win.on('closed', () => !launched && app.quit());
|
||||
|
||||
ipcMain.on('ss', launchMain);
|
||||
ipcMain.on('sq', app.quit);
|
||||
|
||||
if (!startMin) win.once('ready-to-show', win.show);
|
||||
};
|
||||
|
||||
|
@ -216,8 +219,8 @@ const initOld = () => { // "Old" (not v2 / new, win32 only)
|
|||
|
||||
|
||||
on('update-manually', e => {
|
||||
splashState.newVersion = e.newVersion;
|
||||
sendState('update-manually');
|
||||
splashState.details = e.details;
|
||||
sendState('manual');
|
||||
});
|
||||
|
||||
sendState(CHECKING_FOR_UPDATES);
|
||||
|
|
|
@ -2,5 +2,7 @@ const { contextBridge, ipcRenderer } = require('electron');
|
|||
|
||||
|
||||
contextBridge.exposeInMainWorld('Splash', {
|
||||
onState: callback => ipcRenderer.on('state', (_, state) => callback(state))
|
||||
onState: callback => ipcRenderer.on('state', (_, state) => callback(state)),
|
||||
quit: () => ipcRenderer.send('sq'),
|
||||
skip: () => ipcRenderer.send('ss')
|
||||
});
|
|
@ -14,12 +14,12 @@ module.exports = process.platform === 'linux' ? new (class HostLinux extends req
|
|||
}
|
||||
|
||||
async checkForUpdates() {
|
||||
get(this.url, (e, r) => {
|
||||
get(this.url, (e, r, b) => {
|
||||
if (e) return this.emit('error');
|
||||
|
||||
if (r.statusCode === 204) return this.emit('update-not-available');
|
||||
|
||||
this.emit('update-manually');
|
||||
this.emit('update-manually', b);
|
||||
});
|
||||
}
|
||||
})() : autoUpdater;
|
|
@ -75,12 +75,12 @@ exports.init = (endpoint, { releaseChannel, version }) => {
|
|||
|
||||
hostUpdater.on('update-not-available', hostPassed);
|
||||
|
||||
hostUpdater.on('update-manually', v => {
|
||||
hostUpdater.on('update-manually', d => {
|
||||
log('Modules', 'Host manual');
|
||||
checking = false;
|
||||
|
||||
events.emit('update-manually', {
|
||||
newVersion: v
|
||||
details: d
|
||||
});
|
||||
|
||||
events.emit('update-check-finished', {
|
||||
|
|
Loading…
Reference in a new issue