Copy inReplyTo CW & visibility to response post

This commit is contained in:
Shadowfacts 2018-09-02 18:11:00 -04:00
parent 761b320ca6
commit 8fd39a6ca2
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 14 additions and 5 deletions

View File

@ -37,8 +37,16 @@ class ComposeViewController: UIViewController {
var inReplyTo: Status? var inReplyTo: Status?
var mentioning: Account? var mentioning: Account?
var contentWarning = false var contentWarning = false {
var visibility = Preferences.shared.defaultPostVisibility didSet {
contentWarningTextField.isHidden = !contentWarning
}
}
var visibility = Preferences.shared.defaultPostVisibility {
didSet {
visibilityButton.setTitle(visibility.displayName, for: .normal)
}
}
var status: Status? 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.text += inReplyTo.mentions.filter({ $0.id != MastodonController.shared.account.id }).map({ "@\($0.acct) " }).joined()
statusTextView.textViewDidChange(statusTextView) statusTextView.textViewDidChange(statusTextView)
contentWarning = inReplyTo.sensitive ?? false
contentWarningTextField.text = inReplyTo.spoilerText
visibility = inReplyTo.visibility
} else { } else {
inReplyToLabel.isHidden = true inReplyToLabel.isHidden = true
inReplyToContainerView.isHidden = true inReplyToContainerView.isHidden = true
@ -123,9 +134,8 @@ class ComposeViewController: UIViewController {
let alertController = UIAlertController(title: "Post Visibility", message: nil, preferredStyle: .actionSheet) let alertController = UIAlertController(title: "Post Visibility", message: nil, preferredStyle: .actionSheet)
for visibility in Visibility.allCases { for visibility in Visibility.allCases {
let action = UIAlertAction(title: visibility.displayName, style: .default, handler: { _ in let action = UIAlertAction(title: visibility.displayName, style: .default, handler: { _ in
self.visibility = visibility
UIView.performWithoutAnimation { UIView.performWithoutAnimation {
self.visibilityButton.setTitle(visibility.displayName, for: .normal) self.visibility = visibility
self.visibilityButton.layoutIfNeeded() self.visibilityButton.layoutIfNeeded()
} }
}) })
@ -140,7 +150,6 @@ class ComposeViewController: UIViewController {
@IBAction func contentWarningPressed(_ sender: Any) { @IBAction func contentWarningPressed(_ sender: Any) {
contentWarning = !contentWarning contentWarning = !contentWarning
contentWarningTextField.isHidden = !contentWarning
} }
@IBAction func mediaPressed(_ sender: Any) { @IBAction func mediaPressed(_ sender: Any) {