Copy inReplyTo CW & visibility to response post

This commit is contained in:
Shadowfacts 2018-09-02 18:11:00 -04:00
parent 2b3586955c
commit 43ea836a1f
Signed by: 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 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) {