18 lines
785 B
C#
18 lines
785 B
C#
namespace VideoDownloader.Mobile;
|
|
|
|
/// <summary>U5 완료 알림: 이전/다음 큐 스냅샷에서 새로 완료("완료")된 항목 ID 감지.
|
|
/// 이전 스냅샷이 비면(앱 시작 직후 첫 폴링) 무시 — 과거 완료 알림 스팸 방지.</summary>
|
|
public sealed class QueueCompletionDetector
|
|
{
|
|
public IReadOnlyList<string> Detect(
|
|
IReadOnlyList<(string Id, string Status)> previous,
|
|
IReadOnlyList<(string Id, string Status)> next)
|
|
{
|
|
if (previous.Count == 0) return Array.Empty<string>();
|
|
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();
|
|
}
|
|
}
|