mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-25 09:41:00 +00:00
Hide reblog and favorite counts by default
This commit is contained in:
parent
2efc7b87c4
commit
aee0b3e66d
4 changed files with 17 additions and 3 deletions
|
@ -152,6 +152,7 @@
|
|||
"preferences.position.remember-position" = "Remember position";
|
||||
"preferences.position.sync-position" = "Sync position with web and other devices";
|
||||
"preferences.position.newest" = "Load newest";
|
||||
"preferences.show-reblog-and-favorite-counts" = "Show reblog and favorite counts";
|
||||
"filters.active" = "Active";
|
||||
"filters.expired" = "Expired";
|
||||
"filter.add-new" = "Add New Filter";
|
||||
|
|
|
@ -133,6 +133,11 @@ public extension AppPreferences {
|
|||
return notificationsTabBehavior
|
||||
}
|
||||
}
|
||||
|
||||
var showReblogAndFavoriteCounts: Bool {
|
||||
get { self[.showReblogAndFavoriteCounts] ?? false }
|
||||
set { self[.showReblogAndFavoriteCounts] = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
extension AppPreferences {
|
||||
|
@ -160,6 +165,7 @@ private extension AppPreferences {
|
|||
case homeTimelineBehavior
|
||||
case notificationsTabBehavior
|
||||
case defaultEmojiSkinTone
|
||||
case showReblogAndFavoriteCounts
|
||||
}
|
||||
|
||||
subscript<T>(index: Item) -> T? {
|
||||
|
|
|
@ -92,6 +92,7 @@ struct PreferencesView: View {
|
|||
.disabled(reduceMotion)
|
||||
}
|
||||
.disabled(reduceMotion)
|
||||
Toggle("preferences.show-reblog-and-favorite-counts", isOn: $identityContext.appPreferences.showReblogAndFavoriteCounts)
|
||||
Picker("preferences.home-timeline-position-on-startup",
|
||||
selection: $identityContext.appPreferences.homeTimelineBehavior) {
|
||||
ForEach(AppPreferences.PositionBehavior.allCases) { option in
|
||||
|
|
|
@ -428,8 +428,14 @@ private extension StatusView {
|
|||
setButtonImages(scale: isContextParent ? .medium : .small)
|
||||
|
||||
replyButton.setCountTitle(count: viewModel.repliesCount, isContextParent: isContextParent)
|
||||
reblogButton.setCountTitle(count: viewModel.reblogsCount, isContextParent: isContextParent)
|
||||
favoriteButton.setCountTitle(count: viewModel.favoritesCount, isContextParent: isContextParent)
|
||||
|
||||
if viewModel.identityContext.appPreferences.showReblogAndFavoriteCounts || isContextParent {
|
||||
reblogButton.setCountTitle(count: viewModel.reblogsCount, isContextParent: isContextParent)
|
||||
favoriteButton.setCountTitle(count: viewModel.favoritesCount, isContextParent: isContextParent)
|
||||
} else {
|
||||
reblogButton.setTitle(nil, for: .normal)
|
||||
favoriteButton.setTitle(nil, for: .normal)
|
||||
}
|
||||
|
||||
let reblogColor: UIColor = viewModel.reblogged ? .systemGreen : .secondaryLabel
|
||||
|
||||
|
@ -517,7 +523,7 @@ private extension StatusView {
|
|||
|
||||
private extension UIButton {
|
||||
func setCountTitle(count: Int, isContextParent: Bool) {
|
||||
setTitle((isContextParent || count == 0) ? "" : String(count), for: .normal)
|
||||
setTitle((isContextParent || count == 0) ? nil : String(count), for: .normal)
|
||||
}
|
||||
}
|
||||
// swiftlint:enable file_length
|
||||
|
|
Loading…
Reference in a new issue