damus

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

commit 4f7ed36a7cccfe7a5d04d3a4182e0b0605d9ff65
parent 393809c7d7714c917da1f18185e0a7265b0d3ff4
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 17 Mar 2023 08:23:33 -0600

Fix image upload url delay after progress bar disappears

Changelog-Fixed: Fix image upload url delay after progress bar disappears

Diffstat:
Mdamus/Models/ImageUploadModel.swift | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/damus/Models/ImageUploadModel.swift b/damus/Models/ImageUploadModel.swift @@ -13,16 +13,14 @@ class ImageUploadModel: NSObject, URLSessionTaskDelegate, ObservableObject { @Published var progress: Double? = nil func start(img: UIImage, uploader: ImageUploader) async -> ImageUploadResult { - return await create_image_upload_request(imageToUpload: img, imageUploader: uploader, progress: self) + let res = await create_image_upload_request(imageToUpload: img, imageUploader: uploader, progress: self) + progress = nil + return res } func urlSession(_ session: URLSession, task: URLSessionTask, didSendBodyData bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) { DispatchQueue.main.async { self.progress = Double(totalBytesSent) / Double(totalBytesExpectedToSend) - - if self.progress! >= 1.0 { - self.progress = nil - } } } }