From aab5f243ca4954797f1cc6c994c3e9a6bf158653 Mon Sep 17 00:00:00 2001 From: cdricms <36056008+cdricms@users.noreply.github.com> Date: Fri, 24 Jul 2026 16:02:06 +0200 Subject: [PATCH] fix(apple): treat a completed receiver event as terminal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit progressForReceiver only labelled a receiver Completed when no progress/started events preceded the completion, so the normal progress→completed sequence fell through and rendered as Sending despite a .completed kind. Events are newest-first, so a completed latest event is always terminal — label it Completed. Fixes the failing ProgressDerivationTests.testReceiverCompletionAfterProgressIsTerminal. --- apple/VniDrop/Core/TransferProgress.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apple/VniDrop/Core/TransferProgress.swift b/apple/VniDrop/Core/TransferProgress.swift index 9c8fe3d..c8eebbb 100644 --- a/apple/VniDrop/Core/TransferProgress.swift +++ b/apple/VniDrop/Core/TransferProgress.swift @@ -82,7 +82,9 @@ func progressForReceiver( labelKey: L10n.Progress.interrupted, progress: nil, detail: nil ) } - if latestKind == .completed && !transferEvents.contains(where: { $0.eventKind == .progress || $0.eventKind == .started }) { + // Events are newest-first, so a completed latest event is terminal even when + // progress/started events precede it — it must show as Completed, not Sending. + if latestKind == .completed { return TransferProgress( transferId: transferId, phase: .transfer, kind: .completed, labelKey: L10n.Progress.completed, progress: 1, detail: nil