damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 517f3714e891c286ea7c8f15e0522b33f431d65a
parent b7337995677b5a17f481d59dcee5d06853a19444
Author: Sean Kibler <skibler@protonmail.com>
Date:   Fri, 29 Mar 2024 18:46:19 -0400

postview: add haptic feedback on media upload result

Closes: https://github.com/damus-io/damus/pull/2115
Signed-off-by: Sean Kibler <skibler@protonmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mdamus/Models/ImageUploadModel.swift | 15+++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/damus/Models/ImageUploadModel.swift b/damus/Models/ImageUploadModel.swift @@ -56,9 +56,20 @@ class ImageUploadModel: NSObject, URLSessionTaskDelegate, ObservableObject { func start(media: MediaUpload, uploader: MediaUploader, keypair: Keypair? = nil) async -> ImageUploadResult { let res = await create_upload_request(mediaToUpload: media, mediaUploader: uploader, progress: self, keypair: keypair) - DispatchQueue.main.async { - self.progress = nil + + switch res { + case .success(_): + DispatchQueue.main.async { + self.progress = nil + UINotificationFeedbackGenerator().notificationOccurred(.success) + } + case .failed(_): + DispatchQueue.main.async { + self.progress = nil + UINotificationFeedbackGenerator().notificationOccurred(.error) + } } + return res }