Add preference to disable showing favorite/reblog counts
This commit is contained in:
parent
eb58a46ab7
commit
84a07fc718
|
@ -47,6 +47,7 @@ class Preferences: Codable, ObservableObject {
|
|||
self.contentWarningCopyMode = try container.decode(ContentWarningCopyMode.self, forKey: .contentWarningCopyMode)
|
||||
self.openLinksInApps = try container.decode(Bool.self, forKey: .openLinksInApps)
|
||||
|
||||
self.showFavoriteAndReblogCounts = try container.decode(Bool.self, forKey: .showFavoriteAndReblogCounts)
|
||||
self.defaultNotificationsMode = try container.decode(NotificationsMode.self, forKey: .defaultNotificationsType)
|
||||
|
||||
self.silentActions = try container.decode([String: Permission].self, forKey: .silentActions)
|
||||
|
@ -65,6 +66,7 @@ class Preferences: Codable, ObservableObject {
|
|||
try container.encode(contentWarningCopyMode, forKey: .contentWarningCopyMode)
|
||||
try container.encode(openLinksInApps, forKey: .openLinksInApps)
|
||||
|
||||
try container.encode(showFavoriteAndReblogCounts, forKey: .showFavoriteAndReblogCounts)
|
||||
try container.encode(defaultNotificationsMode, forKey: .defaultNotificationsType)
|
||||
|
||||
try container.encode(silentActions, forKey: .silentActions)
|
||||
|
@ -86,6 +88,7 @@ class Preferences: Codable, ObservableObject {
|
|||
@Published var openLinksInApps = true
|
||||
|
||||
// MARK: - Digital Wellness
|
||||
@Published var showFavoriteAndReblogCounts = true
|
||||
@Published var defaultNotificationsMode = NotificationsMode.allNotifications
|
||||
|
||||
// MARK: - Advanced
|
||||
|
@ -102,6 +105,7 @@ class Preferences: Codable, ObservableObject {
|
|||
case contentWarningCopyMode
|
||||
case openLinksInApps
|
||||
|
||||
case showFavoriteAndReblogCounts
|
||||
case defaultNotificationsType
|
||||
|
||||
case silentActions
|
||||
|
|
|
@ -9,14 +9,29 @@
|
|||
import SwiftUI
|
||||
|
||||
struct WellnessPrefsView: View {
|
||||
@Preference(\.showFavoriteAndReblogCounts) var showFavoriteAndReblogCounts: Bool
|
||||
@Preference(\.defaultNotificationsMode) var defaultNotificationsMode: NotificationsMode
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
showFavAndReblogCountSection
|
||||
notificationsModeSection
|
||||
}.listStyle(GroupedListStyle())
|
||||
.navigationBarTitle(Text("Digital Wellness"))
|
||||
}
|
||||
|
||||
var showFavAndReblogCountSection: some View {
|
||||
Section(footer: showFavAndReblogCountFooter) {
|
||||
Toggle(isOn: _showFavoriteAndReblogCounts.binding) {
|
||||
Text("Show Favorite and Reblog Counts")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var showFavAndReblogCountFooter: some View {
|
||||
Text("Control whether total favorite and reblog counts are shown for the main post in conversations.")
|
||||
}
|
||||
|
||||
var notificationsModeSection: some View {
|
||||
Section(footer: notificationsModeFooter) {
|
||||
Picker(selection: _defaultNotificationsMode.binding, label: Text("Default Notifications Mode")) {
|
||||
|
|
|
@ -31,6 +31,7 @@ class ConversationMainStatusTableViewCell: UITableViewCell {
|
|||
@IBOutlet weak var collapseButton: UIButton!
|
||||
@IBOutlet weak var contentLabel: StatusContentLabel!
|
||||
@IBOutlet weak var avatarImageView: UIImageView!
|
||||
@IBOutlet weak var favoriteAndReblogCountStackView: UIStackView!
|
||||
@IBOutlet weak var totalFavoritesButton: UIButton!
|
||||
@IBOutlet weak var totalReblogsButton: UIButton!
|
||||
@IBOutlet weak var timestampAndClientLabel: UILabel!
|
||||
|
@ -158,6 +159,7 @@ class ConversationMainStatusTableViewCell: UITableViewCell {
|
|||
|
||||
avatarImageView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarImageView)
|
||||
displayNameLabel.text = account.realDisplayName
|
||||
favoriteAndReblogCountStackView.isHidden = !Preferences.shared.showFavoriteAndReblogCounts
|
||||
}
|
||||
|
||||
override func prepareForReuse() {
|
||||
|
|
Loading…
Reference in New Issue