back to normal setup methods

This commit is contained in:
PandaDEV 2024-08-25 17:40:52 +10:00
parent 69686f7514
commit 75583ac6ce
No known key found for this signature in database
GPG key ID: 13EFF9BAF70EE75C
6 changed files with 56 additions and 106 deletions

View file

@ -1,16 +1,8 @@
use tauri::plugin::TauriPlugin;
use tauri::AppHandle;
use tauri::{AppHandle, async_runtime};
use tauri_plugin_dialog::{DialogExt, MessageDialogKind};
use tauri_plugin_updater::UpdaterExt;
use tokio;
pub fn init() -> TauriPlugin<tauri::Wry> {
tauri::plugin::Builder::new("updater")
.invoke_handler(tauri::generate_handler![check_for_updates])
.build()
}
#[tauri::command]
pub async fn check_for_updates(app: AppHandle) {
println!("Checking for updates...");
@ -36,7 +28,7 @@ pub async fn check_for_updates(app: AppHandle) {
if !response {
return;
}
tokio::spawn(async move {
async_runtime::spawn(async move {
if let Err(e) = update.download_and_install(|_, _| {}, || {}).await {
println!("Error installing new update: {:?}", e);
app.dialog().message(
@ -51,4 +43,4 @@ pub async fn check_for_updates(app: AppHandle) {
println!("Failed to check for updates: {:?}", e);
}
}
}
}