diff --git a/Tusker/Screens/Compose/ComposeViewController.swift b/Tusker/Screens/Compose/ComposeViewController.swift index 96b645ec6b..df9d603893 100644 --- a/Tusker/Screens/Compose/ComposeViewController.swift +++ b/Tusker/Screens/Compose/ComposeViewController.swift @@ -103,7 +103,7 @@ class ComposeViewController: UIViewController { let toolbar = UIToolbar() contentWarningBarButtonItem = UIBarButtonItem(title: "CW", style: .plain, target: self, action: #selector(contentWarningButtonPressed)) - visibilityBarButtonItem = UIBarButtonItem(image: Preferences.shared.defaultPostVisibility.image, style: .plain, target: self, action: #selector(visibilityButtonPressed)) + visibilityBarButtonItem = UIBarButtonItem(image: nil, style: .plain, target: self, action: #selector(visibilityButtonPressed)) toolbar.items = [ contentWarningBarButtonItem, visibilityBarButtonItem, @@ -127,6 +127,9 @@ class ComposeViewController: UIViewController { if let inReplyToID = inReplyToID, let inReplyTo = MastodonCache.status(for: inReplyToID) { visibility = inReplyTo.visibility + contentWarningEnabled = !inReplyTo.spoilerText.isEmpty + contentWarningContainerView.isHidden = !contentWarningEnabled + contentWarningTextField.text = inReplyTo.spoilerText let replyView = ComposeStatusReplyView.create() replyView.updateUI(for: inReplyTo) @@ -159,11 +162,11 @@ class ComposeViewController: UIViewController { updateCharactersRemaining() updatePlaceholder() - contentWarningEnabled = false NotificationCenter.default.addObserver(self, selector: #selector(contentWarningTextFieldDidChange), name: UITextField.textDidChangeNotification, object: contentWarningTextField) if inReplyToID == nil { visibility = Preferences.shared.defaultPostVisibility + contentWarningEnabled = false } } @@ -288,12 +291,6 @@ class ComposeViewController: UIViewController { func contentWarningStateChanged() { contentWarningContainerView.isHidden = !contentWarningEnabled - contentWarningBarButtonItem.style = contentWarningEnabled ? .done : .plain - if contentWarningEnabled { - contentWarningTextField.becomeFirstResponder() - } else { - statusTextView.becomeFirstResponder() - } } func visibilityChanged() { @@ -360,6 +357,11 @@ class ComposeViewController: UIViewController { @objc func contentWarningButtonPressed() { contentWarningEnabled = !contentWarningEnabled + if contentWarningEnabled { + contentWarningTextField.becomeFirstResponder() + } else { + statusTextView.becomeFirstResponder() + } } @objc func contentWarningTextFieldDidChange() {