damus

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

commit 25b3df8b8945bec6db80069100088f308c36d3cc
parent 14accd222ed27182a2d2e800073590cfeb999186
Author: Terry Yiu <963907+tyiu@users.noreply.github.com>
Date:   Sun, 25 Jun 2023 20:27:07 -0400

Disable post button when media upload in progress

Changelog-Fixed: Disable post button when media upload in progress
Closes: #1324

Diffstat:
Mdamus/Views/PostView.swift | 14+++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/damus/Views/PostView.swift b/damus/Views/PostView.swift @@ -130,6 +130,14 @@ struct PostView: View { var is_post_empty: Bool { return post.string.allSatisfy { $0.isWhitespace } && uploadedMedias.isEmpty } + + var uploading_disabled: Bool { + return image_upload.progress != nil + } + + var posting_disabled: Bool { + return is_post_empty || uploading_disabled + } var ImageButton: some View { Button(action: { @@ -154,7 +162,7 @@ struct PostView: View { ImageButton CameraButton } - .disabled(image_upload.progress != nil) + .disabled(uploading_disabled) } var PostButton: some View { @@ -165,12 +173,12 @@ struct PostView: View { self.send_post() } } - .disabled(is_post_empty) + .disabled(posting_disabled) .font(.system(size: 14, weight: .bold)) .frame(width: 80, height: 30) .foregroundColor(.white) .background(LINEAR_GRADIENT) - .opacity(is_post_empty ? 0.5 : 1.0) + .opacity(posting_disabled ? 0.5 : 1.0) .clipShape(Capsule()) }