Disable post button when there's no content (#57)

Co-authored-by: Pascal Batty <pascal@zen.ly>
This commit is contained in:
Pascal Batty 2023-01-10 14:44:11 +01:00 committed by GitHub
parent 0ae0b7e33f
commit cd78cab073
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -84,6 +84,7 @@ public struct StatusEditorView: View {
Text("Post")
}
}
.disabled(!viewModel.canPost)
}
ToolbarItem(placement: .navigationBarLeading) {
Button {

View file

@ -44,6 +44,9 @@ public class StatusEditorViewModel: ObservableObject {
@Published var mediasImages: [ImageContainer] = []
@Published var replyToStatus: Status?
@Published var embededStatus: Status?
var canPost: Bool {
statusText.length > 0 || !selectedMedias.isEmpty
}
@Published var visibility: Models.Visibility = .pub