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