feat(pwa): add PWA support and browser notifications for critical events
This commit is contained in:
@@ -213,7 +213,30 @@ pub fn provide_torrent_store() {
|
||||
global_stats.set(stats);
|
||||
}
|
||||
AppEvent::Notification(n) => {
|
||||
show_toast_with_signal(notifications, n.level, n.message);
|
||||
// Show toast notification
|
||||
show_toast_with_signal(notifications, n.level.clone(), n.message.clone());
|
||||
|
||||
// Show browser notification for critical events
|
||||
// (torrent completed, connection lost/restored, errors)
|
||||
let is_critical = n.message.contains("tamamlandı")
|
||||
|| n.message.contains("Reconnected")
|
||||
|| n.message.contains("yeniden kuruldu")
|
||||
|| n.message.contains("Lost connection")
|
||||
|| n.level == shared::NotificationLevel::Error;
|
||||
|
||||
if is_critical {
|
||||
let title = match n.level {
|
||||
shared::NotificationLevel::Success => "✅ VibeTorrent",
|
||||
shared::NotificationLevel::Error => "❌ VibeTorrent",
|
||||
shared::NotificationLevel::Warning => "⚠️ VibeTorrent",
|
||||
shared::NotificationLevel::Info => "ℹ️ VibeTorrent",
|
||||
};
|
||||
|
||||
crate::utils::notification::show_notification_if_enabled(
|
||||
title,
|
||||
&n.message
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user