From a992c3ae2b0ba6d9df813fb35b56e701bcffaa97 Mon Sep 17 00:00:00 2001 From: shannon Date: Fri, 13 Dec 2024 15:38:05 -0500 Subject: [PATCH] Better clean up after failure or automated cancelation of post Contributes to #846 Toot lost in poor network conditions --- .../Service/PublisherService/PublisherService.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MastodonSDK/Sources/MastodonCore/Service/PublisherService/PublisherService.swift b/MastodonSDK/Sources/MastodonCore/Service/PublisherService/PublisherService.swift index eaff4afce..aad5507f1 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/PublisherService/PublisherService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/PublisherService/PublisherService.swift @@ -84,8 +84,10 @@ extension PublisherService { } catch is CancellationError { self.statusPublishers.removeAll(where: { $0 === publisher }) - + self.currentPublishProgress = 0 + self.statusPublishResult.send(.failure(CancellationError())) } catch { + self.statusPublishers.removeAll(where: { $0 === publisher }) self.statusPublishResult.send(.failure(error)) self.currentPublishProgress = 0 }