From 18e91feb00a5080aaac1d43e4f5e38581ca12ebf Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 15 Mar 2020 11:39:35 -0400 Subject: [PATCH] Fix requires attachment descriptions preference not working --- .../Compose/Attachments/ComposeAttachmentTableViewCell.swift | 2 +- .../Compose/Attachments/ComposeAttachmentsViewController.swift | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Tusker/Screens/Compose/Attachments/ComposeAttachmentTableViewCell.swift b/Tusker/Screens/Compose/Attachments/ComposeAttachmentTableViewCell.swift index 5d95eac2..2de3fe67 100644 --- a/Tusker/Screens/Compose/Attachments/ComposeAttachmentTableViewCell.swift +++ b/Tusker/Screens/Compose/Attachments/ComposeAttachmentTableViewCell.swift @@ -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) } } diff --git a/Tusker/Screens/Compose/Attachments/ComposeAttachmentsViewController.swift b/Tusker/Screens/Compose/Attachments/ComposeAttachmentsViewController.swift index 0a06b9fe..be3bfee3 100644 --- a/Tusker/Screens/Compose/Attachments/ComposeAttachmentsViewController.swift +++ b/Tusker/Screens/Compose/Attachments/ComposeAttachmentsViewController.swift @@ -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 }