From 8fd39a6ca2c14f6d56d6ade32a59d77f80819484 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 2 Sep 2018 18:11:00 -0400 Subject: [PATCH] Copy inReplyTo CW & visibility to response post --- .../ComposeViewController.swift | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Tusker/View Controllers/ComposeViewController.swift b/Tusker/View Controllers/ComposeViewController.swift index fe5da6d1bb..5e760bc71f 100644 --- a/Tusker/View Controllers/ComposeViewController.swift +++ b/Tusker/View Controllers/ComposeViewController.swift @@ -37,8 +37,16 @@ class ComposeViewController: UIViewController { var inReplyTo: Status? var mentioning: Account? - var contentWarning = false - var visibility = Preferences.shared.defaultPostVisibility + var contentWarning = false { + didSet { + contentWarningTextField.isHidden = !contentWarning + } + } + var visibility = Preferences.shared.defaultPostVisibility { + didSet { + visibilityButton.setTitle(visibility.displayName, for: .normal) + } + } var status: Status? @@ -78,6 +86,9 @@ class ComposeViewController: UIViewController { } statusTextView.text += inReplyTo.mentions.filter({ $0.id != MastodonController.shared.account.id }).map({ "@\($0.acct) " }).joined() statusTextView.textViewDidChange(statusTextView) + contentWarning = inReplyTo.sensitive ?? false + contentWarningTextField.text = inReplyTo.spoilerText + visibility = inReplyTo.visibility } else { inReplyToLabel.isHidden = true inReplyToContainerView.isHidden = true @@ -123,9 +134,8 @@ class ComposeViewController: UIViewController { let alertController = UIAlertController(title: "Post Visibility", message: nil, preferredStyle: .actionSheet) for visibility in Visibility.allCases { let action = UIAlertAction(title: visibility.displayName, style: .default, handler: { _ in - self.visibility = visibility UIView.performWithoutAnimation { - self.visibilityButton.setTitle(visibility.displayName, for: .normal) + self.visibility = visibility self.visibilityButton.layoutIfNeeded() } }) @@ -140,7 +150,6 @@ class ComposeViewController: UIViewController { @IBAction func contentWarningPressed(_ sender: Any) { contentWarning = !contentWarning - contentWarningTextField.isHidden = !contentWarning } @IBAction func mediaPressed(_ sender: Any) {