IOS-87: Add “Search” and “Explore” input labels for Search & Explore (#935)
Co-authored-by: Marcus Kida <marcus.kida@bearologics.com>
This commit is contained in:
parent
e6b8908ca5
commit
2987149ba5
|
@ -107,7 +107,11 @@
|
|||
"home": "Home",
|
||||
"search_and_explore": "Search and Explore",
|
||||
"notifications": "Notifications",
|
||||
"profile": "Profile"
|
||||
"profile": "Profile",
|
||||
"a11y": {
|
||||
"search": "Search",
|
||||
"explore": "Explore"
|
||||
}
|
||||
},
|
||||
"keyboard": {
|
||||
"common": {
|
||||
|
|
|
@ -108,7 +108,11 @@
|
|||
"home": "Home",
|
||||
"search_and_explore": "Search and Explore",
|
||||
"notifications": "Notifications",
|
||||
"profile": "Profile"
|
||||
"profile": "Profile",
|
||||
"a11y": {
|
||||
"search": "Search",
|
||||
"explore": "Explore"
|
||||
}
|
||||
},
|
||||
"keyboard": {
|
||||
"common": {
|
||||
|
|
|
@ -67,6 +67,19 @@ class MainTabBarController: UITabBarController {
|
|||
case .me: return L10n.Common.Controls.Tabs.profile
|
||||
}
|
||||
}
|
||||
|
||||
var inputLabels: [String]? {
|
||||
switch self {
|
||||
case .home, .compose, .notifications, .me:
|
||||
return nil
|
||||
case .search:
|
||||
return [
|
||||
L10n.Common.Controls.Tabs.A11Y.search,
|
||||
L10n.Common.Controls.Tabs.A11Y.explore,
|
||||
L10n.Common.Controls.Tabs.searchAndExplore
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
var image: UIImage {
|
||||
switch self {
|
||||
|
@ -205,12 +218,20 @@ extension MainTabBarController {
|
|||
viewController.tabBarItem.selectedImage = tab.selectedImage.imageWithoutBaseline()
|
||||
viewController.tabBarItem.largeContentSizeImage = tab.largeImage.imageWithoutBaseline()
|
||||
viewController.tabBarItem.accessibilityLabel = tab.title
|
||||
viewController.tabBarItem.accessibilityUserInputLabels = tab.inputLabels
|
||||
viewController.tabBarItem.imageInsets = UIEdgeInsets(top: 6, left: 0, bottom: -6, right: 0)
|
||||
return viewController
|
||||
}
|
||||
_viewControllers = viewControllers
|
||||
setViewControllers(viewControllers, animated: false)
|
||||
selectedIndex = 0
|
||||
|
||||
// hacky workaround for FB11986255 (Setting accessibilityUserInputLabels on a UITabBarItem has no effect)
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(50)) {
|
||||
if let searchItem = self.tabBar.subviews.first(where: { $0.accessibilityLabel == Tab.search.title }) {
|
||||
searchItem.accessibilityUserInputLabels = Tab.search.inputLabels
|
||||
}
|
||||
}
|
||||
|
||||
context.apiService.error
|
||||
.receive(on: DispatchQueue.main)
|
||||
|
|
|
@ -452,6 +452,12 @@ public enum L10n {
|
|||
public static let profile = L10n.tr("Localizable", "Common.Controls.Tabs.Profile", fallback: "Profile")
|
||||
/// Search and Explore
|
||||
public static let searchAndExplore = L10n.tr("Localizable", "Common.Controls.Tabs.SearchAndExplore", fallback: "Search and Explore")
|
||||
public enum A11Y {
|
||||
/// Explore
|
||||
public static let explore = L10n.tr("Localizable", "Common.Controls.Tabs.A11Y.Explore", fallback: "Explore")
|
||||
/// Search
|
||||
public static let search = L10n.tr("Localizable", "Common.Controls.Tabs.A11Y.Search", fallback: "Search")
|
||||
}
|
||||
}
|
||||
public enum Timeline {
|
||||
/// Filtered
|
||||
|
|
|
@ -156,6 +156,8 @@ Please check your internet connection.";
|
|||
"Common.Controls.Status.EditedAtTimestampPrefix" = "Edited %@";
|
||||
"Common.Controls.Status.EditHistory.Title" = "Edit History";
|
||||
"Common.Controls.Status.EditHistory.OriginalPost" = "Original Post · %@";
|
||||
"Common.Controls.Tabs.A11Y.Explore" = "Explore";
|
||||
"Common.Controls.Tabs.A11Y.Search" = "Search";
|
||||
"Common.Controls.Tabs.Home" = "Home";
|
||||
"Common.Controls.Tabs.Notifications" = "Notifications";
|
||||
"Common.Controls.Tabs.Profile" = "Profile";
|
||||
|
|
Loading…
Reference in New Issue