mirror of
https://github.com/metabolist/metatext.git
synced 2024-05-19 08:48:12 +00:00
Add option to hide labels from tab bar
This commit is contained in:
parent
9bfc6c1449
commit
35feaa9f8c
|
@ -208,6 +208,7 @@
|
|||
"preferences.blocked-domains" = "Blocked Domains";
|
||||
"preferences.blocked-users" = "Blocked Users";
|
||||
"preferences.media" = "Media";
|
||||
"preferences.show-labels-in-tab-bar" = "Show labels in tab bar (requires restart)";
|
||||
"preferences.media.avatars" = "Avatars";
|
||||
"preferences.media.avatars.animate" = "Animate avatars";
|
||||
"preferences.media.avatars.animate.everywhere" = "Everywhere";
|
||||
|
|
|
@ -201,6 +201,11 @@ public extension AppPreferences {
|
|||
get { self[.useUniversalLinks] ?? true }
|
||||
set { self[.useUniversalLinks] = newValue }
|
||||
}
|
||||
|
||||
var showLabelsInTabBar: Bool {
|
||||
get { self[.showLabelsInTabBar] ?? true }
|
||||
set { self[.showLabelsInTabBar] = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
private extension AppPreferences {
|
||||
|
@ -223,6 +228,7 @@ private extension AppPreferences {
|
|||
case notificationSounds
|
||||
case openLinksInDefaultBrowser
|
||||
case useUniversalLinks
|
||||
case showLabelsInTabBar
|
||||
}
|
||||
|
||||
subscript<T>(index: Item) -> T? {
|
||||
|
|
|
@ -20,8 +20,9 @@ final class ExploreViewController: UICollectionViewController {
|
|||
|
||||
super.init(collectionViewLayout: Self.layout())
|
||||
|
||||
let showTabBarLabel = viewModel.identityContext.appPreferences.showLabelsInTabBar
|
||||
tabBarItem = UITabBarItem(
|
||||
title: NSLocalizedString("main-navigation.explore", comment: ""),
|
||||
title: showTabBarLabel ? NSLocalizedString("main-navigation.explore", comment: "") : nil,
|
||||
image: UIImage(systemName: "magnifyingglass"),
|
||||
selectedImage: nil)
|
||||
}
|
||||
|
|
|
@ -127,6 +127,10 @@ private extension MainNavigationViewController {
|
|||
conversationsViewController.tabBarItem = NavigationViewModel.Tab.messages.tabBarItem
|
||||
conversationsViewController.navigationItem.title = NavigationViewModel.Tab.messages.title
|
||||
|
||||
if !viewModel.identityContext.appPreferences.showLabelsInTabBar {
|
||||
conversationsViewController.tabBarItem.title = nil
|
||||
}
|
||||
|
||||
controllers.append(conversationsViewController)
|
||||
|
||||
setupNewStatusButton()
|
||||
|
|
|
@ -39,6 +39,11 @@ final class NotificationsViewController: UIPageViewController {
|
|||
}
|
||||
|
||||
tabBarItem = NavigationViewModel.Tab.notifications.tabBarItem
|
||||
|
||||
if !viewModel.identityContext.appPreferences.showLabelsInTabBar {
|
||||
tabBarItem.title = nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@available(*, unavailable)
|
||||
|
|
|
@ -36,8 +36,9 @@ final class TimelinesViewController: UIPageViewController {
|
|||
setViewControllers([firstViewController], direction: .forward, animated: false)
|
||||
}
|
||||
|
||||
let showTabBarLabel = viewModel.identityContext.appPreferences.showLabelsInTabBar
|
||||
tabBarItem = UITabBarItem(
|
||||
title: NSLocalizedString("main-navigation.timelines", comment: ""),
|
||||
title: showTabBarLabel ? NSLocalizedString("main-navigation.timelines", comment: "") : nil,
|
||||
image: UIImage(systemName: "newspaper"),
|
||||
selectedImage: nil)
|
||||
|
||||
|
|
|
@ -113,6 +113,8 @@ struct PreferencesView: View {
|
|||
Toggle("preferences.links.use-universal-links",
|
||||
isOn: $identityContext.appPreferences.useUniversalLinks)
|
||||
}
|
||||
Toggle("preferences.show-labels-in-tab-bar",
|
||||
isOn: $identityContext.appPreferences.showLabelsInTabBar)
|
||||
}
|
||||
Group {
|
||||
Picker("preferences.media.autoplay.gifs",
|
||||
|
|
Loading…
Reference in a new issue