feat(updater): enhance update check logging and user prompts

This commit is contained in:
2026-02-20 00:23:22 +11:00
parent 21d4bc6ad9
commit c366311c16

View File

@@ -50,17 +50,23 @@ if ('serviceWorker' in navigator) {
* Prompts user if update is available and handles download/install * Prompts user if update is available and handles download/install
*/ */
async function checkForUpdates() { async function checkForUpdates() {
console.log('Checking for updates...');
try { try {
const update = await check(); const update = await check();
console.log('Update check result:', update);
if (update) { if (update) {
console.log(`Update available: ${update.version}`);
const shouldUpdate = await ask( const shouldUpdate = await ask(
`A new version (${update.version}) is available. Would you like to update now?`, `A new version (${update.version}) is available. Would you like to update now?`,
{ title: 'Update Available', kind: 'info' } { title: 'Update Available', kind: 'info' }
); );
if (shouldUpdate) { if (shouldUpdate) {
console.log('User chose to update, downloading...');
await update.downloadAndInstall(); await update.downloadAndInstall();
await relaunch(); await relaunch();
} }
} else {
console.log('App is up to date');
} }
} catch (error) { } catch (error) {
console.error('Failed to check for updates:', error); console.error('Failed to check for updates:', error);