Feature(custom): add new option to open download page when new version available

ISSUES CLOSED: #128
This commit is contained in:
Kuingsmile 2024-01-02 00:28:12 -08:00
parent 9338fc6dde
commit bbbfbda3e2

View File

@ -5,7 +5,8 @@ import {
protocol, protocol,
Notification, Notification,
dialog, dialog,
screen screen,
shell
} from 'electron' } from 'electron'
import { import {
createProtocol createProtocol
@ -84,7 +85,7 @@ autoUpdater.on('update-available', async (info: UpdateInfo) => {
dialog.showMessageBox({ dialog.showMessageBox({
type: 'info', type: 'info',
title: T('FIND_NEW_VERSION'), title: T('FIND_NEW_VERSION'),
buttons: ['Yes', 'No'], buttons: ['Yes', 'Go to download page'],
message: T('TIPS_FIND_NEW_VERSION', { message: T('TIPS_FIND_NEW_VERSION', {
v: info.version v: info.version
}) + '\n\n' + updateLog, }) + '\n\n' + updateLog,
@ -93,6 +94,8 @@ autoUpdater.on('update-available', async (info: UpdateInfo) => {
}).then((result) => { }).then((result) => {
if (result.response === 0) { if (result.response === 0) {
autoUpdater.downloadUpdate() autoUpdater.downloadUpdate()
} else {
shell.openExternal('https://github.com/Kuingsmile/PicList/releases/latest')
} }
db.set('settings.showUpdateTip', !result.checkboxChecked) db.set('settings.showUpdateTip', !result.checkboxChecked)
}).catch((err) => { }).catch((err) => {