From 30c04b49e7de14d250cffe976f8b930b22ff0995 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Tue, 16 Jun 2020 23:00:39 -0400 Subject: [PATCH] Add visibility indicator to statuses --- Tusker/Extensions/Visibility+Helpers.swift | 13 +++ .../Status/BaseStatusTableViewCell.swift | 4 + .../ConversationMainStatusTableViewCell.xib | 19 ++- .../Status/TimelineStatusTableViewCell.xib | 108 ++++++++++-------- 4 files changed, 91 insertions(+), 53 deletions(-) diff --git a/Tusker/Extensions/Visibility+Helpers.swift b/Tusker/Extensions/Visibility+Helpers.swift index 2d2f2495..ab7fe15f 100644 --- a/Tusker/Extensions/Visibility+Helpers.swift +++ b/Tusker/Extensions/Visibility+Helpers.swift @@ -37,4 +37,17 @@ extension Status.Visibility { } } + var unfilledImageName: String { + switch self { + case .public: + return "globe" + case .unlisted: + return "lock.open" + case .private: + return "lock" + case .direct: + return "envelope" + } + } + } diff --git a/Tusker/Views/Status/BaseStatusTableViewCell.swift b/Tusker/Views/Status/BaseStatusTableViewCell.swift index bb50ee2e..34c61543 100644 --- a/Tusker/Views/Status/BaseStatusTableViewCell.swift +++ b/Tusker/Views/Status/BaseStatusTableViewCell.swift @@ -27,6 +27,7 @@ class BaseStatusTableViewCell: UITableViewCell { @IBOutlet weak var avatarImageView: UIImageView! @IBOutlet weak var displayNameLabel: EmojiLabel! @IBOutlet weak var usernameLabel: UILabel! + @IBOutlet weak var visibilityImageView: UIImageView! @IBOutlet weak var contentWarningLabel: EmojiLabel! @IBOutlet weak var collapseButton: UIButton! @IBOutlet weak var contentTextView: StatusContentTextView! @@ -127,6 +128,9 @@ class BaseStatusTableViewCell: UITableViewCell { updateUI(account: account) updateUIForPreferences(account: account) + visibilityImageView.image = UIImage(systemName: status.visibility.unfilledImageName) + visibilityImageView.accessibilityLabel = String(format: NSLocalizedString("Visibility: %@", comment: "status visibility indicator accessibility label"), status.visibility.displayName) + attachmentsView.updateUI(status: status) attachmentsView.isAccessibilityElement = status.attachments.count > 0 attachmentsView.accessibilityLabel = String(format: NSLocalizedString("%d attachments", comment: "status attachments count accessibility label"), status.attachments.count) diff --git a/Tusker/Views/Status/ConversationMainStatusTableViewCell.xib b/Tusker/Views/Status/ConversationMainStatusTableViewCell.xib index f827687a..7e49188c 100644 --- a/Tusker/Views/Status/ConversationMainStatusTableViewCell.xib +++ b/Tusker/Views/Status/ConversationMainStatusTableViewCell.xib @@ -1,8 +1,8 @@ - + - + @@ -27,7 +27,7 @@ + + + + + + + + - + + + - + @@ -37,9 +37,9 @@ - + - + - + + + + + + + + + - - - - - - - - - - @@ -195,12 +203,13 @@ - + + @@ -209,6 +218,7 @@ +