Add update dialog at app start and change download link to direct link
This commit is contained in:
parent
a947edc49e
commit
38b9747055
@ -30,7 +30,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
updateStatus = document.getElementById('update-status');
|
||||
updateButton = document.getElementById('download-button');
|
||||
updateButton.addEventListener('click', () => {
|
||||
shell.openExternal(`https://github.com/ArisuOngaku/tabs/releases/tag/v${updateInfo.version}`)
|
||||
shell.openExternal(`https://github.com/ArisuOngaku/tabs/releases/download/v${updateInfo.version}/${updateInfo.path}`)
|
||||
.catch(console.error);
|
||||
});
|
||||
|
||||
|
@ -33,6 +33,8 @@ export default class Config {
|
||||
this.services.push(new Service('welcome', 'Welcome', 'rocket', false, 'https://github.com/ArisuOngaku/tabs', false));
|
||||
}
|
||||
|
||||
this.updateCheckSkip = data.updateCheckSkip;
|
||||
|
||||
this.save();
|
||||
}
|
||||
|
||||
|
29
src/main.js
29
src/main.js
@ -1,11 +1,10 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import {app, BrowserWindow, ipcMain, Menu, shell, Tray} from "electron";
|
||||
import {app, BrowserWindow, dialog, ipcMain, Menu, shell, Tray} from "electron";
|
||||
|
||||
import Meta from "./Meta";
|
||||
import Config from "./Config";
|
||||
import Service from "./Service";
|
||||
import {autoUpdater} from "electron-updater";
|
||||
import Updater from "./Updater";
|
||||
|
||||
const resourcesDir = path.resolve(__dirname, '../resources');
|
||||
@ -40,7 +39,31 @@ function toggleMainWindow() {
|
||||
|
||||
async function createWindow() {
|
||||
// Check for updates
|
||||
await autoUpdater.checkForUpdatesAndNotify();
|
||||
updater.checkForUpdates((available, updateInfo) => {
|
||||
if (available && updateInfo.version !== config.updateCheckSkip) {
|
||||
dialog.showMessageBox(window, {
|
||||
message: `Version ${updateInfo.version} of tabs is available. Do you wish to download this update?`,
|
||||
buttons: [
|
||||
'Cancel',
|
||||
'Download',
|
||||
],
|
||||
checkboxChecked: false,
|
||||
checkboxLabel: `Don't remind me for this version`,
|
||||
cancelId: 0,
|
||||
defaultId: 1,
|
||||
type: 'question'
|
||||
}).then(e => {
|
||||
if (e.checkboxChecked) {
|
||||
console.log('Skipping update check for version', updateInfo.version);
|
||||
config.updateCheckSkip = updateInfo.version;
|
||||
config.save();
|
||||
}
|
||||
if (e.response === 1) {
|
||||
return shell.openExternal(`https://github.com/ArisuOngaku/tabs/releases/download/v${updateInfo.version}/${updateInfo.path}`);
|
||||
}
|
||||
}).catch(console.error);
|
||||
}
|
||||
});
|
||||
|
||||
// System tray
|
||||
console.log('Loading system Tray');
|
||||
|
Loading…
Reference in New Issue
Block a user