🐛 register 只跑一次

This commit is contained in:
BTMuli
2023-09-23 20:31:08 +08:00
parent 66539b4bdb
commit b727688e9c
2 changed files with 12 additions and 2 deletions

View File

@@ -3,9 +3,16 @@
use tauri::Manager;
// 放一个常数用来判断是否注册deep link
static mut DEEP_LINK_REGISTERED: bool = false;
#[tauri::command]
// todo 后续优化
async fn register_deep_link(app_handle: tauri::AppHandle) {
unsafe {
if DEEP_LINK_REGISTERED {
return;
}
}
tauri_plugin_deep_link::register(
"teyvatguide",
move |request| {
@@ -14,6 +21,9 @@ async fn register_deep_link(app_handle: tauri::AppHandle) {
},
)
.unwrap();
unsafe {
DEEP_LINK_REGISTERED = true;
}
}
fn main() {