namespace VideoDownloader.Mobile; /// U5 완료 알림: 이전/다음 큐 스냅샷에서 새로 완료("완료")된 항목 ID 감지. /// 이전 스냅샷이 비면(앱 시작 직후 첫 폴링) 무시 — 과거 완료 알림 스팸 방지. public sealed class QueueCompletionDetector { public IReadOnlyList Detect( IReadOnlyList<(string Id, string Status)> previous, IReadOnlyList<(string Id, string Status)> next) { if (previous.Count == 0) return Array.Empty(); var prev = previous.ToDictionary(x => x.Id, x => x.Status); return next .Where(n => n.Status == "완료" && prev.TryGetValue(n.Id, out var s) && s != "완료") .Select(n => n.Id) .ToList(); } }