Add Windows native notifications for chat sessions

- Add tauri-plugin-notification for native Windows notifications
- Send notification when new chat session is started
- Configure notification permissions in capabilities

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
esdrasrenan 2025-12-07 03:13:41 -03:00
parent f45ee91804
commit b194d77d57
5 changed files with 97 additions and 2 deletions

View file

@ -12,6 +12,7 @@ use std::sync::Arc;
use std::time::Duration;
use tauri::async_runtime::JoinHandle;
use tauri::{Emitter, Manager, WebviewWindowBuilder, WebviewUrl};
use tauri_plugin_notification::NotificationExt;
use tokio::sync::Notify;
// ============================================================================
@ -340,6 +341,27 @@ impl ChatRuntime {
},
);
// Enviar notificacao nativa do Windows
let notification_title = format!(
"Chat iniciado - Chamado #{}",
session.ticket_ref
);
let notification_body = format!(
"{} iniciou um chat de suporte",
session.agent_name
);
if let Err(e) = app
.notification()
.builder()
.title(&notification_title)
.body(&notification_body)
.show()
{
crate::log_warn!(
"Falha ao enviar notificacao: {e}"
);
}
// Abrir janela de chat automaticamente
if let Err(e) = open_chat_window_internal(
&app,

View file

@ -298,6 +298,7 @@ pub fn run() {
.plugin(StorePluginBuilder::default().build())
.plugin(tauri_plugin_updater::Builder::new().build())
.plugin(tauri_plugin_process::init())
.plugin(tauri_plugin_notification::init())
.on_window_event(|window, event| {
if let WindowEvent::CloseRequested { api, .. } = event {
api.prevent_close();