1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-22 02:12:38 +01:00

minor bug fix for updater

This commit is contained in:
Puyodead1 2023-12-22 01:09:43 -05:00
parent 49c71ed0bc
commit 06c5f1ccbd
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC
2 changed files with 12 additions and 24 deletions

View File

@ -40,6 +40,17 @@ pub fn check_for_updates<R: Runtime>(ignore_prereleases: bool, window: tauri::Wi
}
}
let package_path = handle
.path()
.app_local_data_dir()
.unwrap()
.join("update.sbcup");
// if we already have an update package, remove it
if package_path.exists() {
clear_update_cache(window.clone());
}
tauri::async_runtime::spawn(async move {
println!("[Updater] Searching for update file on github.");
// Custom configure the updater.
@ -190,29 +201,6 @@ pub fn check_for_updates<R: Runtime>(ignore_prereleases: bool, window: tauri::Wi
// }
UPDATE_INFO.lock().unwrap().replace(update.clone());
let package_path = handle
.path()
.app_local_data_dir()
.unwrap()
.join("update.sbcup");
// if we already have an update package, emit the update downloaded event
if package_path.exists() {
match window.emit(
"UPDATE_DOWNLOADED",
Some(UpdateAvailable {
version: update.version.clone(),
body: update.body.clone(),
}),
) {
Ok(_) => {}
Err(e) => {
println!("[Updater] Failed to emit update downloaded event: {:?}", e);
}
}
return;
}
// otherwise emit the update available event
match window.emit("UPDATE_AVAILABLE", Some({})) {
Ok(_) => {}

View File

@ -126,7 +126,7 @@ export default class UpdaterStore {
}
async quitAndInstall() {
if (!this.updateAvailable) {
if (!this.updateDownloaded) {
this.logger.warn("No update is pending installation");
return;
}