Add preference for always showing status visiblity icon
This commit is contained in:
parent
00bf99334f
commit
66020b7847
|
@ -42,6 +42,7 @@ class Preferences: Codable, ObservableObject {
|
||||||
self.avatarStyle = try container.decode(AvatarStyle.self, forKey: .avatarStyle)
|
self.avatarStyle = try container.decode(AvatarStyle.self, forKey: .avatarStyle)
|
||||||
self.hideCustomEmojiInUsernames = try container.decode(Bool.self, forKey: .hideCustomEmojiInUsernames)
|
self.hideCustomEmojiInUsernames = try container.decode(Bool.self, forKey: .hideCustomEmojiInUsernames)
|
||||||
self.showIsStatusReplyIcon = try container.decode(Bool.self, forKey: .showIsStatusReplyIcon)
|
self.showIsStatusReplyIcon = try container.decode(Bool.self, forKey: .showIsStatusReplyIcon)
|
||||||
|
self.alwaysShowStatusVisibilityIcon = try container.decode(Bool.self, forKey: .alwaysShowStatusVisibilityIcon)
|
||||||
|
|
||||||
self.defaultPostVisibility = try container.decode(Status.Visibility.self, forKey: .defaultPostVisibility)
|
self.defaultPostVisibility = try container.decode(Status.Visibility.self, forKey: .defaultPostVisibility)
|
||||||
self.automaticallySaveDrafts = try container.decode(Bool.self, forKey: .automaticallySaveDrafts)
|
self.automaticallySaveDrafts = try container.decode(Bool.self, forKey: .automaticallySaveDrafts)
|
||||||
|
@ -71,6 +72,7 @@ class Preferences: Codable, ObservableObject {
|
||||||
try container.encode(avatarStyle, forKey: .avatarStyle)
|
try container.encode(avatarStyle, forKey: .avatarStyle)
|
||||||
try container.encode(hideCustomEmojiInUsernames, forKey: .hideCustomEmojiInUsernames)
|
try container.encode(hideCustomEmojiInUsernames, forKey: .hideCustomEmojiInUsernames)
|
||||||
try container.encode(showIsStatusReplyIcon, forKey: .showIsStatusReplyIcon)
|
try container.encode(showIsStatusReplyIcon, forKey: .showIsStatusReplyIcon)
|
||||||
|
try container.encode(alwaysShowStatusVisibilityIcon, forKey: .alwaysShowStatusVisibilityIcon)
|
||||||
|
|
||||||
try container.encode(defaultPostVisibility, forKey: .defaultPostVisibility)
|
try container.encode(defaultPostVisibility, forKey: .defaultPostVisibility)
|
||||||
try container.encode(automaticallySaveDrafts, forKey: .automaticallySaveDrafts)
|
try container.encode(automaticallySaveDrafts, forKey: .automaticallySaveDrafts)
|
||||||
|
@ -98,6 +100,7 @@ class Preferences: Codable, ObservableObject {
|
||||||
@Published var avatarStyle = AvatarStyle.roundRect
|
@Published var avatarStyle = AvatarStyle.roundRect
|
||||||
@Published var hideCustomEmojiInUsernames = false
|
@Published var hideCustomEmojiInUsernames = false
|
||||||
@Published var showIsStatusReplyIcon = false
|
@Published var showIsStatusReplyIcon = false
|
||||||
|
@Published var alwaysShowStatusVisibilityIcon = false
|
||||||
|
|
||||||
// MARK: Composing
|
// MARK: Composing
|
||||||
@Published var defaultPostVisibility = Status.Visibility.public
|
@Published var defaultPostVisibility = Status.Visibility.public
|
||||||
|
@ -129,6 +132,7 @@ class Preferences: Codable, ObservableObject {
|
||||||
case avatarStyle
|
case avatarStyle
|
||||||
case hideCustomEmojiInUsernames
|
case hideCustomEmojiInUsernames
|
||||||
case showIsStatusReplyIcon
|
case showIsStatusReplyIcon
|
||||||
|
case alwaysShowStatusVisibilityIcon
|
||||||
|
|
||||||
case defaultPostVisibility
|
case defaultPostVisibility
|
||||||
case automaticallySaveDrafts
|
case automaticallySaveDrafts
|
||||||
|
|
|
@ -42,6 +42,9 @@ struct AppearancePrefsView : View {
|
||||||
Toggle(isOn: $preferences.showIsStatusReplyIcon) {
|
Toggle(isOn: $preferences.showIsStatusReplyIcon) {
|
||||||
Text("Show Status Reply Icons")
|
Text("Show Status Reply Icons")
|
||||||
}
|
}
|
||||||
|
Toggle(isOn: $preferences.alwaysShowStatusVisibilityIcon) {
|
||||||
|
Text("Always Show Status Visibility Icons")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.listStyle(GroupedListStyle())
|
.listStyle(GroupedListStyle())
|
||||||
.navigationBarTitle(Text("Appearance"))
|
.navigationBarTitle(Text("Appearance"))
|
||||||
|
|
|
@ -128,9 +128,6 @@ class BaseStatusTableViewCell: UITableViewCell {
|
||||||
updateUI(account: account)
|
updateUI(account: account)
|
||||||
updateUIForPreferences(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.updateUI(status: status)
|
||||||
attachmentsView.isAccessibilityElement = status.attachments.count > 0
|
attachmentsView.isAccessibilityElement = status.attachments.count > 0
|
||||||
attachmentsView.accessibilityLabel = String(format: NSLocalizedString("%d attachments", comment: "status attachments count accessibility label"), status.attachments.count)
|
attachmentsView.accessibilityLabel = String(format: NSLocalizedString("%d attachments", comment: "status attachments count accessibility label"), status.attachments.count)
|
||||||
|
@ -154,8 +151,8 @@ class BaseStatusTableViewCell: UITableViewCell {
|
||||||
reblogDisabled = status.visibility == .direct || (status.visibility == .private && status.account.id != mastodonController.account.id)
|
reblogDisabled = status.visibility == .direct || (status.visibility == .private && status.account.id != mastodonController.account.id)
|
||||||
}
|
}
|
||||||
reblogButton.isEnabled = !reblogDisabled
|
reblogButton.isEnabled = !reblogDisabled
|
||||||
let reblogButtonImage = reblogDisabled ? UIImage(systemName: status.visibility.imageName) : UIImage(systemName: "repeat")
|
|
||||||
reblogButton.setImage(reblogButtonImage, for: .normal)
|
updateStatusIconsForPreferences(status)
|
||||||
|
|
||||||
if state.unknown {
|
if state.unknown {
|
||||||
collapsible = !status.spoilerText.isEmpty
|
collapsible = !status.spoilerText.isEmpty
|
||||||
|
@ -207,8 +204,11 @@ class BaseStatusTableViewCell: UITableViewCell {
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func preferencesChanged() {
|
@objc func preferencesChanged() {
|
||||||
guard let mastodonController = mastodonController, let account = mastodonController.persistentContainer.account(for: accountID) else { return }
|
guard let mastodonController = mastodonController,
|
||||||
|
let account = mastodonController.persistentContainer.account(for: accountID),
|
||||||
|
let status = mastodonController.persistentContainer.status(for: statusID) else { return }
|
||||||
updateUIForPreferences(account: account)
|
updateUIForPreferences(account: account)
|
||||||
|
updateStatusIconsForPreferences(status)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateUIForPreferences(account: AccountMO) {
|
func updateUIForPreferences(account: AccountMO) {
|
||||||
|
@ -217,6 +217,21 @@ class BaseStatusTableViewCell: UITableViewCell {
|
||||||
attachmentsView.contentHidden = Preferences.shared.blurAllMedia || (mastodonController.persistentContainer.status(for: statusID)?.sensitive ?? false)
|
attachmentsView.contentHidden = Preferences.shared.blurAllMedia || (mastodonController.persistentContainer.status(for: statusID)?.sensitive ?? false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateStatusIconsForPreferences(_ status: StatusMO) {
|
||||||
|
visibilityImageView.isHidden = !Preferences.shared.alwaysShowStatusVisibilityIcon
|
||||||
|
if Preferences.shared.alwaysShowStatusVisibilityIcon {
|
||||||
|
visibilityImageView.image = UIImage(systemName: status.visibility.unfilledImageName)
|
||||||
|
visibilityImageView.accessibilityLabel = String(format: NSLocalizedString("Visibility: %@", comment: "status visibility indicator accessibility label"), status.visibility.displayName)
|
||||||
|
}
|
||||||
|
let reblogButtonImage: UIImage
|
||||||
|
if Preferences.shared.alwaysShowStatusVisibilityIcon || reblogButton.isEnabled {
|
||||||
|
reblogButtonImage = UIImage(systemName: "repeat")!
|
||||||
|
} else {
|
||||||
|
reblogButtonImage = UIImage(systemName: status.visibility.imageName)!
|
||||||
|
}
|
||||||
|
reblogButton.setImage(reblogButtonImage, for: .normal)
|
||||||
|
}
|
||||||
|
|
||||||
override func prepareForReuse() {
|
override func prepareForReuse() {
|
||||||
super.prepareForReuse()
|
super.prepareForReuse()
|
||||||
|
|
||||||
|
|
|
@ -89,8 +89,6 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell {
|
||||||
timestampLabel.isHidden = pinned
|
timestampLabel.isHidden = pinned
|
||||||
pinImageView.isHidden = !pinned
|
pinImageView.isHidden = !pinned
|
||||||
}
|
}
|
||||||
|
|
||||||
updateStatusIcons(status)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc override func preferencesChanged() {
|
@objc override func preferencesChanged() {
|
||||||
|
@ -100,9 +98,6 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell {
|
||||||
let reblogger = mastodonController.persistentContainer.account(for: rebloggerID) {
|
let reblogger = mastodonController.persistentContainer.account(for: rebloggerID) {
|
||||||
updateRebloggerLabel(reblogger: reblogger)
|
updateRebloggerLabel(reblogger: reblogger)
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let status = mastodonController.persistentContainer.status(for: statusID) else { return }
|
|
||||||
updateStatusIcons(status)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateRebloggerLabel(reblogger: AccountMO) {
|
private func updateRebloggerLabel(reblogger: AccountMO) {
|
||||||
|
@ -115,7 +110,9 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateStatusIcons(_ status: StatusMO) {
|
override func updateStatusIconsForPreferences(_ status: StatusMO) {
|
||||||
|
super.updateStatusIconsForPreferences(status)
|
||||||
|
|
||||||
replyImageView.isHidden = !Preferences.shared.showIsStatusReplyIcon || !showReplyIndicator || status.inReplyToID == nil
|
replyImageView.isHidden = !Preferences.shared.showIsStatusReplyIcon || !showReplyIndicator || status.inReplyToID == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,36 +151,39 @@
|
||||||
</stackView>
|
</stackView>
|
||||||
</subviews>
|
</subviews>
|
||||||
</stackView>
|
</stackView>
|
||||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="globe" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="LRh-Cc-1br">
|
<stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="oie-wK-IpU">
|
||||||
<rect key="frame" x="31" y="55" width="19" height="20"/>
|
<rect key="frame" x="0.5" y="54" width="49.5" height="22"/>
|
||||||
<color key="tintColor" systemColor="secondaryLabelColor" red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
<subviews>
|
||||||
<constraints>
|
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bubble.left.and.bubble.right" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="KdQ-Zn-IhD">
|
||||||
<constraint firstAttribute="height" constant="22" id="3Mk-NN-6fY"/>
|
<rect key="frame" x="0.0" y="1" width="25.5" height="21.5"/>
|
||||||
</constraints>
|
<color key="tintColor" systemColor="secondaryLabelColor" red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
<preferredSymbolConfiguration key="preferredSymbolConfiguration" weight="thin"/>
|
<accessibility key="accessibilityConfiguration" label="Is a reply"/>
|
||||||
</imageView>
|
<constraints>
|
||||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bubble.left.and.bubble.right" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="KdQ-Zn-IhD">
|
<constraint firstAttribute="height" constant="22" id="x0C-Qo-YVA"/>
|
||||||
<rect key="frame" x="0.0" y="55" width="25.5" height="21.5"/>
|
</constraints>
|
||||||
<color key="tintColor" systemColor="secondaryLabelColor" red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
<preferredSymbolConfiguration key="preferredSymbolConfiguration" weight="thin"/>
|
||||||
<accessibility key="accessibilityConfiguration" label="Is a reply"/>
|
</imageView>
|
||||||
<constraints>
|
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="globe" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="LRh-Cc-1br">
|
||||||
<constraint firstAttribute="height" constant="22" id="x0C-Qo-YVA"/>
|
<rect key="frame" x="30.5" y="1" width="19" height="20"/>
|
||||||
</constraints>
|
<color key="tintColor" systemColor="secondaryLabelColor" red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
<preferredSymbolConfiguration key="preferredSymbolConfiguration" weight="thin"/>
|
<constraints>
|
||||||
</imageView>
|
<constraint firstAttribute="height" constant="22" id="3Mk-NN-6fY"/>
|
||||||
|
</constraints>
|
||||||
|
<preferredSymbolConfiguration key="preferredSymbolConfiguration" weight="thin"/>
|
||||||
|
</imageView>
|
||||||
|
</subviews>
|
||||||
|
</stackView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="gIY-Wp-RSk" firstAttribute="leading" secondItem="QMP-j2-HLn" secondAttribute="trailing" constant="8" id="0Tm-v7-Ts4"/>
|
<constraint firstItem="gIY-Wp-RSk" firstAttribute="leading" secondItem="QMP-j2-HLn" secondAttribute="trailing" constant="8" id="0Tm-v7-Ts4"/>
|
||||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="QMP-j2-HLn" secondAttribute="bottom" constant="8" id="2Ao-Gj-fY3"/>
|
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="QMP-j2-HLn" secondAttribute="bottom" constant="8" id="2Ao-Gj-fY3"/>
|
||||||
|
<constraint firstItem="oie-wK-IpU" firstAttribute="top" secondItem="QMP-j2-HLn" secondAttribute="bottom" constant="4" id="7Mp-WS-FhY"/>
|
||||||
<constraint firstItem="QMP-j2-HLn" firstAttribute="top" secondItem="ve3-Y1-NQH" secondAttribute="top" id="PC4-Bi-QXm"/>
|
<constraint firstItem="QMP-j2-HLn" firstAttribute="top" secondItem="ve3-Y1-NQH" secondAttribute="top" id="PC4-Bi-QXm"/>
|
||||||
<constraint firstItem="LRh-Cc-1br" firstAttribute="top" secondItem="QMP-j2-HLn" secondAttribute="bottom" constant="4" id="QE5-0f-q1a"/>
|
<constraint firstItem="oie-wK-IpU" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="ve3-Y1-NQH" secondAttribute="leading" id="QKi-ny-jOJ"/>
|
||||||
<constraint firstItem="KdQ-Zn-IhD" firstAttribute="top" secondItem="QMP-j2-HLn" secondAttribute="bottom" constant="4" id="R2V-fr-WCN"/>
|
|
||||||
<constraint firstItem="gIY-Wp-RSk" firstAttribute="top" secondItem="QMP-j2-HLn" secondAttribute="top" id="fEd-wN-kuQ"/>
|
<constraint firstItem="gIY-Wp-RSk" firstAttribute="top" secondItem="QMP-j2-HLn" secondAttribute="top" id="fEd-wN-kuQ"/>
|
||||||
|
<constraint firstItem="gIY-Wp-RSk" firstAttribute="leading" secondItem="oie-wK-IpU" secondAttribute="trailing" constant="8" id="fqd-p6-oGe"/>
|
||||||
<constraint firstAttribute="trailingMargin" secondItem="gIY-Wp-RSk" secondAttribute="trailing" id="hKk-kO-wFT"/>
|
<constraint firstAttribute="trailingMargin" secondItem="gIY-Wp-RSk" secondAttribute="trailing" id="hKk-kO-wFT"/>
|
||||||
<constraint firstAttribute="bottom" secondItem="gIY-Wp-RSk" secondAttribute="bottom" id="kRU-Ct-CIg"/>
|
<constraint firstAttribute="bottom" secondItem="gIY-Wp-RSk" secondAttribute="bottom" id="kRU-Ct-CIg"/>
|
||||||
<constraint firstItem="KdQ-Zn-IhD" firstAttribute="bottom" relation="lessThanOrEqual" secondItem="ve3-Y1-NQH" secondAttribute="bottom" id="rp8-N9-Iid"/>
|
|
||||||
<constraint firstItem="KdQ-Zn-IhD" firstAttribute="leading" secondItem="QMP-j2-HLn" secondAttribute="leading" id="uJd-Cz-AG3"/>
|
|
||||||
<constraint firstItem="gIY-Wp-RSk" firstAttribute="leading" secondItem="LRh-Cc-1br" secondAttribute="trailing" constant="8" id="zFc-5l-916"/>
|
|
||||||
<constraint firstItem="QMP-j2-HLn" firstAttribute="leading" secondItem="ve3-Y1-NQH" secondAttribute="leading" id="zeW-tQ-uJl"/>
|
<constraint firstItem="QMP-j2-HLn" firstAttribute="leading" secondItem="ve3-Y1-NQH" secondAttribute="leading" id="zeW-tQ-uJl"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
|
|
Loading…
Reference in New Issue