diff --git a/Tusker/Preferences/Preferences.swift b/Tusker/Preferences/Preferences.swift index 3543ee449d..d6c515ab11 100644 --- a/Tusker/Preferences/Preferences.swift +++ b/Tusker/Preferences/Preferences.swift @@ -41,6 +41,7 @@ class Preferences: Codable, ObservableObject { self.showRepliesInProfiles = try container.decode(Bool.self, forKey: .showRepliesInProfiles) self.avatarStyle = try container.decode(AvatarStyle.self, forKey: .avatarStyle) self.hideCustomEmojiInUsernames = try container.decode(Bool.self, forKey: .hideCustomEmojiInUsernames) + self.showIsStatusReplyIcon = try container.decode(Bool.self, forKey: .showIsStatusReplyIcon) self.defaultPostVisibility = try container.decode(Status.Visibility.self, forKey: .defaultPostVisibility) self.automaticallySaveDrafts = try container.decode(Bool.self, forKey: .automaticallySaveDrafts) @@ -69,6 +70,7 @@ class Preferences: Codable, ObservableObject { try container.encode(showRepliesInProfiles, forKey: .showRepliesInProfiles) try container.encode(avatarStyle, forKey: .avatarStyle) try container.encode(hideCustomEmojiInUsernames, forKey: .hideCustomEmojiInUsernames) + try container.encode(showIsStatusReplyIcon, forKey: .showIsStatusReplyIcon) try container.encode(defaultPostVisibility, forKey: .defaultPostVisibility) try container.encode(automaticallySaveDrafts, forKey: .automaticallySaveDrafts) @@ -95,6 +97,7 @@ class Preferences: Codable, ObservableObject { @Published var showRepliesInProfiles = false @Published var avatarStyle = AvatarStyle.roundRect @Published var hideCustomEmojiInUsernames = false + @Published var showIsStatusReplyIcon = false // MARK: Composing @Published var defaultPostVisibility = Status.Visibility.public @@ -125,6 +128,7 @@ class Preferences: Codable, ObservableObject { case showRepliesInProfiles case avatarStyle case hideCustomEmojiInUsernames + case showIsStatusReplyIcon case defaultPostVisibility case automaticallySaveDrafts diff --git a/Tusker/Screens/Preferences/AppearancePrefsView.swift b/Tusker/Screens/Preferences/AppearancePrefsView.swift index 96e6853179..272e460ed6 100644 --- a/Tusker/Screens/Preferences/AppearancePrefsView.swift +++ b/Tusker/Screens/Preferences/AppearancePrefsView.swift @@ -39,6 +39,9 @@ struct AppearancePrefsView : View { Toggle(isOn: $preferences.hideCustomEmojiInUsernames) { Text("Hide Custom Emoji in Usernames") } + Toggle(isOn: $preferences.showIsStatusReplyIcon) { + Text("Show Status Reply Icons") + } } .listStyle(GroupedListStyle()) .navigationBarTitle(Text("Appearance")) diff --git a/Tusker/Views/Status/TimelineStatusTableViewCell.swift b/Tusker/Views/Status/TimelineStatusTableViewCell.swift index b494c6e62c..1ab4a204b0 100644 --- a/Tusker/Views/Status/TimelineStatusTableViewCell.swift +++ b/Tusker/Views/Status/TimelineStatusTableViewCell.swift @@ -89,16 +89,20 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell { timestampLabel.isHidden = pinned pinImageView.isHidden = !pinned } - - replyImageView.isHidden = !showReplyIndicator || status.inReplyToID == nil + + updateStatusIcons(status) } @objc override func preferencesChanged() { super.preferencesChanged() + if let rebloggerID = rebloggerID, let reblogger = mastodonController.persistentContainer.account(for: rebloggerID) { updateRebloggerLabel(reblogger: reblogger) } + + guard let status = mastodonController.persistentContainer.status(for: statusID) else { return } + updateStatusIcons(status) } private func updateRebloggerLabel(reblogger: AccountMO) { @@ -111,6 +115,10 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell { } } + private func updateStatusIcons(_ status: StatusMO) { + replyImageView.isHidden = !Preferences.shared.showIsStatusReplyIcon || !showReplyIndicator || status.inReplyToID == nil + } + func updateTimestamp() { // if the mastodonController is nil (i.e. the delegate is nil), then the screen this cell was a part of has been deallocated // so we bail out immediately, since there's nothing to update