From bd81c8150042dc0eac994ff8f4ad0c598e4d2225 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Tue, 24 Sep 2019 23:41:20 -0400 Subject: [PATCH] Make status spoiler text non-optional again --- Pachyderm/Model/Status.swift | 2 +- Tusker/Screens/Compose/ComposeViewController.swift | 9 ++++----- .../Status/ConversationMainStatusTableViewCell.swift | 4 ++-- Tusker/Views/Status/StatusTableViewCell.swift | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Pachyderm/Model/Status.swift b/Pachyderm/Model/Status.swift index 29562d8d..6f2b7587 100644 --- a/Pachyderm/Model/Status.swift +++ b/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] diff --git a/Tusker/Screens/Compose/ComposeViewController.swift b/Tusker/Screens/Compose/ComposeViewController.swift index 745157a4..6bdd9cfa 100644 --- a/Tusker/Screens/Compose/ComposeViewController.swift +++ b/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 } } diff --git a/Tusker/Views/Status/ConversationMainStatusTableViewCell.swift b/Tusker/Views/Status/ConversationMainStatusTableViewCell.swift index 4a700a64..b353b4ac 100644 --- a/Tusker/Views/Status/ConversationMainStatusTableViewCell.swift +++ b/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) { diff --git a/Tusker/Views/Status/StatusTableViewCell.swift b/Tusker/Views/Status/StatusTableViewCell.swift index 9443036c..59ed1b6d 100644 --- a/Tusker/Views/Status/StatusTableViewCell.swift +++ b/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) {