mirror of
https://github.com/0PandaDEV/Qopy.git
synced 2025-04-21 21:24:05 +02:00
Merge branch 'main' into issue/settings
This commit is contained in:
commit
dde27b37a8
5 changed files with 50 additions and 33 deletions
|
@ -2,7 +2,7 @@ use tauri::{ async_runtime, AppHandle };
|
|||
use tauri_plugin_dialog::{ DialogExt, MessageDialogButtons, MessageDialogKind };
|
||||
use tauri_plugin_updater::UpdaterExt;
|
||||
|
||||
pub async fn check_for_updates(app: AppHandle) {
|
||||
pub async fn check_for_updates(app: AppHandle, prompted: bool) {
|
||||
println!("Checking for updates...");
|
||||
|
||||
let updater = app.updater().unwrap();
|
||||
|
@ -18,6 +18,10 @@ pub async fn check_for_updates(app: AppHandle) {
|
|||
"Would you like to install it now?",
|
||||
]);
|
||||
|
||||
let window = app.get_webview_window("main").unwrap();
|
||||
window.show().unwrap();
|
||||
window.set_focus().unwrap();
|
||||
|
||||
app.dialog()
|
||||
.message(msg)
|
||||
.title("Qopy Update Available")
|
||||
|
@ -69,9 +73,22 @@ pub async fn check_for_updates(app: AppHandle) {
|
|||
});
|
||||
});
|
||||
}
|
||||
Ok(None) => println!("No updates available."),
|
||||
Ok(None) => {
|
||||
println!("No updates available.");
|
||||
}
|
||||
Err(e) => {
|
||||
println!("Failed to check for updates: {:?}", e);
|
||||
if prompted {
|
||||
let window = app.get_webview_window("main").unwrap();
|
||||
window.show().unwrap();
|
||||
window.set_focus().unwrap();
|
||||
|
||||
app.dialog()
|
||||
.message("No updates available.")
|
||||
.title("Qopy Update Check")
|
||||
.show(|_| {});
|
||||
}
|
||||
|
||||
println!("No updates available. {}", e.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ fn main() {
|
|||
let _ = app.track_event("app_started", None);
|
||||
|
||||
tauri::async_runtime::spawn(async move {
|
||||
api::updater::check_for_updates(app_handle).await;
|
||||
api::updater::check_for_updates(app_handle, false).await;
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue