From 9d90622ff24ed7f9ed4ef2e22f25ad6a7a306e7d Mon Sep 17 00:00:00 2001 From: Marcin Czachurski Date: Sun, 22 Oct 2023 13:19:01 +0200 Subject: [PATCH 1/2] #73 Publish status without text message --- README.md | 6 +----- .../Sources/WidgetsKit/Views/BaseComposeView.swift | 10 +++++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9a4bfc0..59750fd 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,5 @@ From time to time you have to come back and translate lines which has been added Things that should be implemented in version 2.0: - [ ] Use auto generated resources (Color/Images) instead static extensions (how to do this in separete Swift Packages?) - - [x] Move to xcstring (new Xcode transaction system) - - [x] Move to new Observable macro (iOS 17) - - [x] Migrate to SwiftData (iOS 17) - - [ ] Use ViewModels - - [x] Add tips (new TipKit framework in iOS 17) + - [ ] Use ViewModels? - [ ] Enable swiftlint (https://github.com/realm/SwiftLint/issues/5053) diff --git a/WidgetsKit/Sources/WidgetsKit/Views/BaseComposeView.swift b/WidgetsKit/Sources/WidgetsKit/Views/BaseComposeView.swift index 65f24ea..429696f 100644 --- a/WidgetsKit/Sources/WidgetsKit/Views/BaseComposeView.swift +++ b/WidgetsKit/Sources/WidgetsKit/Views/BaseComposeView.swift @@ -581,11 +581,6 @@ public struct BaseComposeView: View { } private func isPublishButtonDisabled() -> Bool { - // Publish always disabled when there is not status text. - if self.textModel.text.string.isEmpty { - return true - } - // When application is during uploading photos we cannot send new status. if self.photosAreUploading == true { return true @@ -595,6 +590,11 @@ public struct BaseComposeView: View { if self.statusViewModel == nil && self.photosAttachment.hasUploadedPhotos() == false { return true } + + // When status is a comment, then text is required. + if self.statusViewModel != nil && self.textModel.text.string.isEmpty { + return true + } return false } From 1eca78fd8c2cc67c1e5a9a4e7dce4f47f75e2987 Mon Sep 17 00:00:00 2001 From: Marcin Czachurski Date: Sun, 22 Oct 2023 13:26:55 +0200 Subject: [PATCH 2/2] Fix deleting status --- Vernissage/Widgets/InteractionRow.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vernissage/Widgets/InteractionRow.swift b/Vernissage/Widgets/InteractionRow.swift index e893384..56c6f15 100644 --- a/Vernissage/Widgets/InteractionRow.swift +++ b/Vernissage/Widgets/InteractionRow.swift @@ -196,7 +196,7 @@ struct InteractionRow: View { } private func deleteStatus() { - Task { + Task { @MainActor in do { // Remove from server. try await self.client.statuses?.delete(statusId: self.statusModel.id)