fix(gui): Relaunch application after updater installation has finished (#137)

This commit is contained in:
binarybaron 2024-11-07 21:11:46 +01:00 committed by GitHub
parent 12528a9d4e
commit 8283d09b5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View file

@ -87,11 +87,11 @@ export default function UpdaterDialog() {
...prev, ...prev,
downloadedBytes: prev.downloadedBytes + event.data.chunkLength, downloadedBytes: prev.downloadedBytes + event.data.chunkLength,
})); }));
} else if (event.event === 'Finished') {
// Relaunch the application for the new version to be used
relaunch();
} }
}); });
// Once the promise resolves, relaunch the application for the new version to be used
relaunch();
} catch (err) { } catch (err) {
enqueueSnackbar(`Failed to install update: ${err}`, { enqueueSnackbar(`Failed to install update: ${err}`, {
variant: "error" variant: "error"

View file

@ -131,9 +131,10 @@ pub fn run() {
#[cfg(desktop)] #[cfg(desktop)]
{ {
builder = builder.plugin(tauri_plugin_single_instance::init(|app, _, _| { builder = builder.plugin(tauri_plugin_single_instance::init(|app, _, _| {
let _ = app.get_webview_window("main") let _ = app
.expect("no main window") .get_webview_window("main")
.set_focus(); .expect("no main window")
.set_focus();
})); }));
} }