refactor: update AppHandle usage to use Arc<AppHandle> for improved memory management (#4491)

* refactor: update AppHandle usage to use Arc<AppHandle> for improved memory management

* fix: clippy ci

* fix: ensure default_latency_test is safely accessed with non-null assertion
This commit is contained in:
Tunglies
2025-08-23 00:20:58 +08:00
committed by GitHub
parent c416bd5755
commit 0d070fb934
13 changed files with 140 additions and 96 deletions

View File

@@ -1,3 +1,5 @@
use std::sync::Arc;
use tauri::AppHandle;
use tauri_plugin_notification::NotificationExt;
@@ -14,7 +16,7 @@ pub enum NotificationEvent<'a> {
AppHidden,
}
fn notify(app: &AppHandle, title: &str, body: &str) {
fn notify(app: Arc<AppHandle>, title: &str, body: &str) {
app.notification()
.builder()
.title(title)
@@ -23,7 +25,7 @@ fn notify(app: &AppHandle, title: &str, body: &str) {
.ok();
}
pub fn notify_event(app: &AppHandle, event: NotificationEvent) {
pub fn notify_event(app: Arc<AppHandle>, event: NotificationEvent) {
use crate::utils::i18n::t;
match event {
NotificationEvent::DashboardToggled => {