refactor: migrate backend queue to SwitchDriver actor

This commit is contained in:
Slinetrac
2025-10-26 15:04:03 +08:00
Unverified
parent de35fef450
commit ceec922887
4 changed files with 231 additions and 33 deletions

View File

@@ -100,11 +100,17 @@ impl Handle {
});
}
pub fn notify_profile_switch_finished(profile_id: String, success: bool, notify: bool) {
pub fn notify_profile_switch_finished(
profile_id: String,
success: bool,
notify: bool,
task_id: u64,
) {
Self::send_event(FrontendEvent::ProfileSwitchFinished {
profile_id,
success,
notify,
task_id,
});
}

View File

@@ -34,6 +34,7 @@ pub enum FrontendEvent {
profile_id: String,
success: bool,
notify: bool,
task_id: u64,
},
TimerUpdated {
profile_index: String,
@@ -193,9 +194,15 @@ impl NotificationSystem {
profile_id,
success,
notify,
task_id,
} => (
"profile-switch-finished",
Ok(json!({ "profileId": profile_id, "success": success, "notify": notify })),
Ok(json!({
"profileId": profile_id,
"success": success,
"notify": notify,
"taskId": task_id
})),
),
FrontendEvent::TimerUpdated { profile_index } => {
("verge://timer-updated", Ok(json!(profile_index)))