Fix requires attachment descriptions preference not working

This commit is contained in:
Shadowfacts 2020-03-15 11:39:35 -04:00
parent c5d2e9af68
commit 18e91feb00
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 3 additions and 2 deletions

View File

@ -82,8 +82,8 @@ class ComposeAttachmentTableViewCell: UITableViewCell {
extension ComposeAttachmentTableViewCell: UITextViewDelegate {
func textViewDidChange(_ textView: UITextView) {
delegate?.attachmentDescriptionChanged(self)
attachment.attachmentDescription = textView.text
updateDescriptionPlaceholderLabel()
delegate?.attachmentDescriptionChanged(self)
}
}

View File

@ -25,13 +25,14 @@ class ComposeAttachmentsViewController: UITableViewController {
var attachments: [CompositionAttachment] = [] {
didSet {
delegate?.composeSelectedAttachmentsDidChange()
delegate?.composeRequiresAttachmentDescriptionsDidChange()
updateAddAttachmentsButtonEnabled()
}
}
var requiresAttachmentDescriptions: Bool {
if Preferences.shared.requireAttachmentDescriptions {
return !attachments.allSatisfy { $0.description.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty }
return attachments.contains { $0.attachmentDescription.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty }
} else {
return false
}