From b1c7ff856edf81f3d802e1e679343cd7ed8ea6f9 Mon Sep 17 00:00:00 2001 From: spinline Date: Thu, 5 Feb 2026 21:55:13 +0300 Subject: [PATCH] feat(backend): add toast notification when torrent completes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Detects Downloading -> Seeding status transition - Sends 'Torrent tamamlandı: ' notification via SSE --- backend/src/diff.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/src/diff.rs b/backend/src/diff.rs index 07521dc..8c87268 100644 --- a/backend/src/diff.rs +++ b/backend/src/diff.rs @@ -1,4 +1,4 @@ -use shared::{AppEvent, Torrent, TorrentUpdate}; +use shared::{AppEvent, NotificationLevel, SystemNotification, Torrent, TorrentStatus, TorrentUpdate}; #[derive(Debug)] pub enum DiffResult { @@ -74,6 +74,14 @@ pub fn diff_torrents(old: &[Torrent], new: &[Torrent]) -> DiffResult { if old_t.status != new_t.status { update.status = Some(new_t.status.clone()); has_changes = true; + + // Check for torrent completion: Downloading -> Seeding + if old_t.status == TorrentStatus::Downloading && new_t.status == TorrentStatus::Seeding { + events.push(AppEvent::Notification(SystemNotification { + level: NotificationLevel::Success, + message: format!("Torrent tamamlandı: {}", new_t.name), + })); + } } if old_t.error_message != new_t.error_message { update.error_message = Some(new_t.error_message.clone());