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.contentWarningCopyMode = try container.decode(ContentWarningCopyMode.self, forKey: .contentWarningCopyMode)
|
||||||
self.openLinksInApps = try container.decode(Bool.self, forKey: .openLinksInApps)
|
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.defaultNotificationsMode = try container.decode(NotificationsMode.self, forKey: .defaultNotificationsType)
|
||||||
|
|
||||||
self.silentActions = try container.decode([String: Permission].self, forKey: .silentActions)
|
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(contentWarningCopyMode, forKey: .contentWarningCopyMode)
|
||||||
try container.encode(openLinksInApps, forKey: .openLinksInApps)
|
try container.encode(openLinksInApps, forKey: .openLinksInApps)
|
||||||
|
|
||||||
|
try container.encode(showFavoriteAndReblogCounts, forKey: .showFavoriteAndReblogCounts)
|
||||||
try container.encode(defaultNotificationsMode, forKey: .defaultNotificationsType)
|
try container.encode(defaultNotificationsMode, forKey: .defaultNotificationsType)
|
||||||
|
|
||||||
try container.encode(silentActions, forKey: .silentActions)
|
try container.encode(silentActions, forKey: .silentActions)
|
||||||
|
@ -86,6 +88,7 @@ class Preferences: Codable, ObservableObject {
|
||||||
@Published var openLinksInApps = true
|
@Published var openLinksInApps = true
|
||||||
|
|
||||||
// MARK: - Digital Wellness
|
// MARK: - Digital Wellness
|
||||||
|
@Published var showFavoriteAndReblogCounts = true
|
||||||
@Published var defaultNotificationsMode = NotificationsMode.allNotifications
|
@Published var defaultNotificationsMode = NotificationsMode.allNotifications
|
||||||
|
|
||||||
// MARK: - Advanced
|
// MARK: - Advanced
|
||||||
|
@ -102,6 +105,7 @@ class Preferences: Codable, ObservableObject {
|
||||||
case contentWarningCopyMode
|
case contentWarningCopyMode
|
||||||
case openLinksInApps
|
case openLinksInApps
|
||||||
|
|
||||||
|
case showFavoriteAndReblogCounts
|
||||||
case defaultNotificationsType
|
case defaultNotificationsType
|
||||||
|
|
||||||
case silentActions
|
case silentActions
|
||||||
|
|
|
@ -9,14 +9,29 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct WellnessPrefsView: View {
|
struct WellnessPrefsView: View {
|
||||||
|
@Preference(\.showFavoriteAndReblogCounts) var showFavoriteAndReblogCounts: Bool
|
||||||
@Preference(\.defaultNotificationsMode) var defaultNotificationsMode: NotificationsMode
|
@Preference(\.defaultNotificationsMode) var defaultNotificationsMode: NotificationsMode
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
List {
|
List {
|
||||||
|
showFavAndReblogCountSection
|
||||||
notificationsModeSection
|
notificationsModeSection
|
||||||
}.listStyle(GroupedListStyle())
|
}.listStyle(GroupedListStyle())
|
||||||
.navigationBarTitle(Text("Digital Wellness"))
|
.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 {
|
var notificationsModeSection: some View {
|
||||||
Section(footer: notificationsModeFooter) {
|
Section(footer: notificationsModeFooter) {
|
||||||
Picker(selection: _defaultNotificationsMode.binding, label: Text("Default Notifications Mode")) {
|
Picker(selection: _defaultNotificationsMode.binding, label: Text("Default Notifications Mode")) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ class ConversationMainStatusTableViewCell: UITableViewCell {
|
||||||
@IBOutlet weak var collapseButton: UIButton!
|
@IBOutlet weak var collapseButton: UIButton!
|
||||||
@IBOutlet weak var contentLabel: StatusContentLabel!
|
@IBOutlet weak var contentLabel: StatusContentLabel!
|
||||||
@IBOutlet weak var avatarImageView: UIImageView!
|
@IBOutlet weak var avatarImageView: UIImageView!
|
||||||
|
@IBOutlet weak var favoriteAndReblogCountStackView: UIStackView!
|
||||||
@IBOutlet weak var totalFavoritesButton: UIButton!
|
@IBOutlet weak var totalFavoritesButton: UIButton!
|
||||||
@IBOutlet weak var totalReblogsButton: UIButton!
|
@IBOutlet weak var totalReblogsButton: UIButton!
|
||||||
@IBOutlet weak var timestampAndClientLabel: UILabel!
|
@IBOutlet weak var timestampAndClientLabel: UILabel!
|
||||||
|
@ -158,6 +159,7 @@ class ConversationMainStatusTableViewCell: UITableViewCell {
|
||||||
|
|
||||||
avatarImageView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarImageView)
|
avatarImageView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarImageView)
|
||||||
displayNameLabel.text = account.realDisplayName
|
displayNameLabel.text = account.realDisplayName
|
||||||
|
favoriteAndReblogCountStackView.isHidden = !Preferences.shared.showFavoriteAndReblogCounts
|
||||||
}
|
}
|
||||||
|
|
||||||
override func prepareForReuse() {
|
override func prepareForReuse() {
|
||||||
|
|
Loading…
Reference in New Issue