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.remember-position" = "Remember position";
|
||||||
"preferences.position.sync-position" = "Sync position with web and other devices";
|
"preferences.position.sync-position" = "Sync position with web and other devices";
|
||||||
"preferences.position.newest" = "Load newest";
|
"preferences.position.newest" = "Load newest";
|
||||||
|
"preferences.show-reblog-and-favorite-counts" = "Show reblog and favorite counts";
|
||||||
"filters.active" = "Active";
|
"filters.active" = "Active";
|
||||||
"filters.expired" = "Expired";
|
"filters.expired" = "Expired";
|
||||||
"filter.add-new" = "Add New Filter";
|
"filter.add-new" = "Add New Filter";
|
||||||
|
|
|
@ -133,6 +133,11 @@ public extension AppPreferences {
|
||||||
return notificationsTabBehavior
|
return notificationsTabBehavior
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var showReblogAndFavoriteCounts: Bool {
|
||||||
|
get { self[.showReblogAndFavoriteCounts] ?? false }
|
||||||
|
set { self[.showReblogAndFavoriteCounts] = newValue }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AppPreferences {
|
extension AppPreferences {
|
||||||
|
@ -160,6 +165,7 @@ private extension AppPreferences {
|
||||||
case homeTimelineBehavior
|
case homeTimelineBehavior
|
||||||
case notificationsTabBehavior
|
case notificationsTabBehavior
|
||||||
case defaultEmojiSkinTone
|
case defaultEmojiSkinTone
|
||||||
|
case showReblogAndFavoriteCounts
|
||||||
}
|
}
|
||||||
|
|
||||||
subscript<T>(index: Item) -> T? {
|
subscript<T>(index: Item) -> T? {
|
||||||
|
|
|
@ -92,6 +92,7 @@ struct PreferencesView: View {
|
||||||
.disabled(reduceMotion)
|
.disabled(reduceMotion)
|
||||||
}
|
}
|
||||||
.disabled(reduceMotion)
|
.disabled(reduceMotion)
|
||||||
|
Toggle("preferences.show-reblog-and-favorite-counts", isOn: $identityContext.appPreferences.showReblogAndFavoriteCounts)
|
||||||
Picker("preferences.home-timeline-position-on-startup",
|
Picker("preferences.home-timeline-position-on-startup",
|
||||||
selection: $identityContext.appPreferences.homeTimelineBehavior) {
|
selection: $identityContext.appPreferences.homeTimelineBehavior) {
|
||||||
ForEach(AppPreferences.PositionBehavior.allCases) { option in
|
ForEach(AppPreferences.PositionBehavior.allCases) { option in
|
||||||
|
|
|
@ -428,8 +428,14 @@ private extension StatusView {
|
||||||
setButtonImages(scale: isContextParent ? .medium : .small)
|
setButtonImages(scale: isContextParent ? .medium : .small)
|
||||||
|
|
||||||
replyButton.setCountTitle(count: viewModel.repliesCount, isContextParent: isContextParent)
|
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
|
let reblogColor: UIColor = viewModel.reblogged ? .systemGreen : .secondaryLabel
|
||||||
|
|
||||||
|
@ -517,7 +523,7 @@ private extension StatusView {
|
||||||
|
|
||||||
private extension UIButton {
|
private extension UIButton {
|
||||||
func setCountTitle(count: Int, isContextParent: Bool) {
|
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
|
// swiftlint:enable file_length
|
||||||
|
|
Loading…
Reference in a new issue