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