Browse Source

Make status spoiler text non-optional again

pixelfed
Shadowfacts 2 years ago
parent
commit
bd81c81500
Signed by: shadowfacts GPG Key ID: 94A5AB95422746E5
  1. 2
      Pachyderm/Model/Status.swift
  2. 9
      Tusker/Screens/Compose/ComposeViewController.swift
  3. 4
      Tusker/Views/Status/ConversationMainStatusTableViewCell.swift
  4. 4
      Tusker/Views/Status/StatusTableViewCell.swift

2
Pachyderm/Model/Status.swift

@ -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]

9
Tusker/Screens/Compose/ComposeViewController.swift

@ -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
}
}

4
Tusker/Views/Status/ConversationMainStatusTableViewCell.swift

@ -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) {

4
Tusker/Views/Status/StatusTableViewCell.swift

@ -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) {

Loading…
Cancel
Save