forked from shadowfacts/Tusker
Make status spoiler text non-optional again
This commit is contained in:
parent
a2a2feef58
commit
bd81c81500
|
@ -27,7 +27,7 @@ public class Status: Decodable {
|
||||||
public let favourited: Bool?
|
public let favourited: Bool?
|
||||||
public let muted: Bool?
|
public let muted: Bool?
|
||||||
public let sensitive: Bool
|
public let sensitive: Bool
|
||||||
public let spoilerText: String?
|
public let spoilerText: String
|
||||||
public let visibility: Visibility
|
public let visibility: Visibility
|
||||||
public let attachments: [Attachment]
|
public let attachments: [Attachment]
|
||||||
public let mentions: [Mention]
|
public let mentions: [Mention]
|
||||||
|
|
|
@ -131,14 +131,13 @@ class ComposeViewController: UIViewController {
|
||||||
contentWarningEnabled = false
|
contentWarningEnabled = false
|
||||||
contentWarningContainerView.isHidden = true
|
contentWarningContainerView.isHidden = true
|
||||||
} else {
|
} else {
|
||||||
contentWarningEnabled = inReplyTo.spoilerText != nil && !inReplyTo.spoilerText!.isEmpty
|
contentWarningEnabled = !inReplyTo.spoilerText.isEmpty
|
||||||
contentWarningContainerView.isHidden = !contentWarningEnabled
|
contentWarningContainerView.isHidden = !contentWarningEnabled
|
||||||
if Preferences.shared.contentWarningCopyMode == .prependRe,
|
if Preferences.shared.contentWarningCopyMode == .prependRe,
|
||||||
let spoiler = inReplyTo.spoilerText,
|
!inReplyTo.spoilerText.lowercased().starts(with: "re:") {
|
||||||
!spoiler.lowercased().starts(with: "re:") {
|
contentWarningTextField.text = "re: \(inReplyTo.spoilerText)"
|
||||||
contentWarningTextField.text = "re: \(spoiler)"
|
|
||||||
} else {
|
} else {
|
||||||
contentWarningTextField.text = inReplyTo.spoilerText != nil ? inReplyTo.spoilerText : ""
|
contentWarningTextField.text = inReplyTo.spoilerText
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,10 +126,10 @@ class ConversationMainStatusTableViewCell: UITableViewCell {
|
||||||
|
|
||||||
contentLabel.statusID = statusID
|
contentLabel.statusID = statusID
|
||||||
|
|
||||||
collapsible = status.spoilerText != nil && !status.spoilerText!.isEmpty
|
collapsible = !status.spoilerText.isEmpty
|
||||||
setCollapsed(collapsible, animated: false)
|
setCollapsed(collapsible, animated: false)
|
||||||
contentWarningLabel.text = status.spoilerText
|
contentWarningLabel.text = status.spoilerText
|
||||||
contentWarningLabel.isHidden = status.spoilerText != nil && status.spoilerText!.isEmpty
|
contentWarningLabel.isHidden = status.spoilerText.isEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateStatusState(status: Status) {
|
private func updateStatusState(status: Status) {
|
||||||
|
|
|
@ -135,10 +135,10 @@ class StatusTableViewCell: UITableViewCell {
|
||||||
|
|
||||||
contentLabel.statusID = status.id
|
contentLabel.statusID = status.id
|
||||||
|
|
||||||
collapsible = status.spoilerText != nil && !status.spoilerText!.isEmpty
|
collapsible = !status.spoilerText.isEmpty
|
||||||
setCollapsed(collapsible, animated: false)
|
setCollapsed(collapsible, animated: false)
|
||||||
contentWarningLabel.text = status.spoilerText
|
contentWarningLabel.text = status.spoilerText
|
||||||
contentWarningLabel.isHidden = status.spoilerText != nil && status.spoilerText!.isEmpty
|
contentWarningLabel.isHidden = status.spoilerText.isEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateStatusState(status: Status) {
|
private func updateStatusState(status: Status) {
|
||||||
|
|
Loading…
Reference in New Issue