| 649 | /// Send an OS-level desktop notification (Windows toast / macOS notification center). |
| 650 | #[tauri::command] |
| 651 | pub async fn send_system_notification( |
| 652 | app: tauri::AppHandle, |
| 653 | request: SendNotificationRequest, |
| 654 | ) -> Result<(), String> { |
| 655 | use tauri_plugin_notification::NotificationExt; |
| 656 | |
| 657 | let mut builder = app.notification().builder().title(&request.title); |
| 658 | if let Some(body) = &request.body { |
| 659 | builder = builder.body(body); |
| 660 | } |
| 661 | builder.show().map_err(|e| e.to_string()) |
| 662 | } |
| 663 | |
| 664 | #[cfg(test)] |
| 665 | mod tests { |