Merge pull request #94 from VernissageApp/bugfix/publish-without-text

Publish without text
This commit is contained in:
Marcin Czachurski 2023-10-22 13:30:17 +02:00 committed by GitHub
commit 67d393c272
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 11 deletions

View File

@ -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: 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?) - [ ] 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) - [ ] Use ViewModels?
- [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)
- [ ] Enable swiftlint (https://github.com/realm/SwiftLint/issues/5053) - [ ] Enable swiftlint (https://github.com/realm/SwiftLint/issues/5053)

View File

@ -196,7 +196,7 @@ struct InteractionRow: View {
} }
private func deleteStatus() { private func deleteStatus() {
Task { Task { @MainActor in
do { do {
// Remove from server. // Remove from server.
try await self.client.statuses?.delete(statusId: self.statusModel.id) try await self.client.statuses?.delete(statusId: self.statusModel.id)

View File

@ -581,11 +581,6 @@ public struct BaseComposeView: View {
} }
private func isPublishButtonDisabled() -> Bool { 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. // When application is during uploading photos we cannot send new status.
if self.photosAreUploading == true { if self.photosAreUploading == true {
return true return true
@ -595,6 +590,11 @@ public struct BaseComposeView: View {
if self.statusViewModel == nil && self.photosAttachment.hasUploadedPhotos() == false { if self.statusViewModel == nil && self.photosAttachment.hasUploadedPhotos() == false {
return true return true
} }
// When status is a comment, then text is required.
if self.statusViewModel != nil && self.textModel.text.string.isEmpty {
return true
}
return false return false
} }