Add a progress dialog to update process

This commit is contained in:
Caelan Sayler
2024-01-24 12:05:55 +00:00
parent 9232b4b103
commit d403d9791b
2 changed files with 15 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
use crate::{
dialogs,
shared::{self, bundle, bundle::Manifest},
windows::splash,
};
use anyhow::{bail, Result};
use std::{fs, path::PathBuf};
@@ -28,7 +29,18 @@ pub fn apply_package_impl<'a>(root_path: &PathBuf, app: &Manifest, package: &Pat
let action: Result<()> = (|| {
info!("Extracting bundle to {}", &temp_path_new.to_string_lossy());
bundle.extract_lib_contents_to_path(&temp_path_new, |_| {})?;
if dialogs::get_silent() {
bundle.extract_lib_contents_to_path(&temp_path_new, |_| {})?;
} else {
let title = format!("{} Update", &manifest.title);
let message = format!("Installing update {}...", &manifest.version);
let tx = splash::show_progress_dialog(title, message);
bundle.extract_lib_contents_to_path(&temp_path_new, |p| {
let _ = tx.send(p);
})?;
let _ = tx.send(splash::MSG_CLOSE);
}
let _ = shared::force_stop_package(&root_path);

View File

@@ -38,8 +38,8 @@ pub fn show_splash_dialog(app_name: String, imgstream: Option<Vec<u8>>) -> Sende
});
} else {
let setup_name = format!("{} Setup", app_name);
let content = "Please Wait...";
show_com_ctl_progress_dialog(rx, setup_name.as_str(), content);
let content = format!("Installing {}...", app_name);
show_com_ctl_progress_dialog(rx, setup_name.as_str(), content.as_str());
}
});
tx