centralize tauri event names

This commit is contained in:
2026-03-06 16:34:24 +08:00
parent 0e6b497cf6
commit 59253d286c
14 changed files with 155 additions and 20 deletions

View File

@@ -1,6 +1,7 @@
use crate::{
get_app_handle, lock_r, lock_w,
remotes::{dolls::DollsRemote, friends::FriendRemote, user::UserRemote},
services::app_events::AppEvents,
state::FDOLL,
};
use std::{collections::HashSet, sync::LazyLock};
@@ -210,7 +211,9 @@ pub async fn init_app_data_scoped(scope: AppDataRefreshScope) {
let app_data_clone = guard.user_data.clone();
drop(guard); // Drop lock before emitting to prevent potential deadlocks
if let Err(e) = get_app_handle().emit("app-data-refreshed", &app_data_clone) {
if let Err(e) =
get_app_handle().emit(AppEvents::AppDataRefreshed.as_str(), &app_data_clone)
{
warn!("Failed to emit app-data-refreshed event: {}", e);
use tauri_plugin_dialog::MessageDialogBuilder;
use tauri_plugin_dialog::{DialogExt, MessageDialogKind};