Add AsyncHandler for wrapping task spawning

This commit is contained in:
Tunglies
2025-04-11 17:27:56 +08:00
parent 644fdc071f
commit b6a6f5f434
12 changed files with 82 additions and 52 deletions

View File

@@ -5,9 +5,11 @@ mod enhance;
mod error;
mod feat;
mod module;
mod process;
mod utils;
use crate::{
core::hotkey,
process::AsyncHandler,
utils::{resolve, resolve::resolve_scheme, server},
};
use config::Config;
@@ -121,11 +123,13 @@ pub fn run() {
use tauri_plugin_deep_link::DeepLinkExt;
logging_error!(Type::System, true, app.deep_link().register_all());
}
app.deep_link().on_open_url(|event| {
tauri::async_runtime::spawn(async move {
if let Some(url) = event.urls().first() {
logging_error!(Type::Setup, true, resolve_scheme(url.to_string()).await);
AsyncHandler::spawn(move || {
let url = event.urls().first().map(|u| u.to_string());
async move {
if let Some(url) = url {
logging_error!(Type::Setup, true, resolve_scheme(url).await);
}
}
});
});