Make status spoiler text non-optional again

This commit is contained in:
Shadowfacts 2019-09-24 23:41:20 -04:00
parent a2a2feef58
commit bd81c81500
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
4 changed files with 9 additions and 10 deletions

View File

@ -27,7 +27,7 @@ public class Status: Decodable {
public let favourited: Bool?
public let muted: Bool?
public let sensitive: Bool
public let spoilerText: String?
public let spoilerText: String
public let visibility: Visibility
public let attachments: [Attachment]
public let mentions: [Mention]

View File

@ -131,14 +131,13 @@ class ComposeViewController: UIViewController {
contentWarningEnabled = false
contentWarningContainerView.isHidden = true
} else {
contentWarningEnabled = inReplyTo.spoilerText != nil && !inReplyTo.spoilerText!.isEmpty
contentWarningEnabled = !inReplyTo.spoilerText.isEmpty
contentWarningContainerView.isHidden = !contentWarningEnabled
if Preferences.shared.contentWarningCopyMode == .prependRe,
let spoiler = inReplyTo.spoilerText,
!spoiler.lowercased().starts(with: "re:") {
contentWarningTextField.text = "re: \(spoiler)"
!inReplyTo.spoilerText.lowercased().starts(with: "re:") {
contentWarningTextField.text = "re: \(inReplyTo.spoilerText)"
} else {
contentWarningTextField.text = inReplyTo.spoilerText != nil ? inReplyTo.spoilerText : ""
contentWarningTextField.text = inReplyTo.spoilerText
}
}

View File

@ -126,10 +126,10 @@ class ConversationMainStatusTableViewCell: UITableViewCell {
contentLabel.statusID = statusID
collapsible = status.spoilerText != nil && !status.spoilerText!.isEmpty
collapsible = !status.spoilerText.isEmpty
setCollapsed(collapsible, animated: false)
contentWarningLabel.text = status.spoilerText
contentWarningLabel.isHidden = status.spoilerText != nil && status.spoilerText!.isEmpty
contentWarningLabel.isHidden = status.spoilerText.isEmpty
}
private func updateStatusState(status: Status) {

View File

@ -135,10 +135,10 @@ class StatusTableViewCell: UITableViewCell {
contentLabel.statusID = status.id
collapsible = status.spoilerText != nil && !status.spoilerText!.isEmpty
collapsible = !status.spoilerText.isEmpty
setCollapsed(collapsible, animated: false)
contentWarningLabel.text = status.spoilerText
contentWarningLabel.isHidden = status.spoilerText != nil && status.spoilerText!.isEmpty
contentWarningLabel.isHidden = status.spoilerText.isEmpty
}
private func updateStatusState(status: Status) {