Add option to focus the search bar when double tapping the search tab bar
- Enables double tap for tab bar(s) - Hides double tap for me tab (as per previous comment) - Adds search tab double tab option to focus the search bar
This commit is contained in:
parent
6e149cd505
commit
d1588dda98
|
@ -292,12 +292,11 @@ extension MainTabBarController {
|
||||||
tabBarLongPressGestureRecognizer.delegate = self
|
tabBarLongPressGestureRecognizer.delegate = self
|
||||||
tabBar.addGestureRecognizer(tabBarLongPressGestureRecognizer)
|
tabBar.addGestureRecognizer(tabBarLongPressGestureRecognizer)
|
||||||
|
|
||||||
// todo: reconsider the "double tap to change account" feature -> https://github.com/mastodon/mastodon-ios/issues/628
|
let tabBarDoubleTapGestureRecognizer = UITapGestureRecognizer()
|
||||||
// let tabBarDoubleTapGestureRecognizer = UITapGestureRecognizer()
|
tabBarDoubleTapGestureRecognizer.numberOfTapsRequired = 2
|
||||||
// tabBarDoubleTapGestureRecognizer.numberOfTapsRequired = 2
|
tabBarDoubleTapGestureRecognizer.addTarget(self, action: #selector(MainTabBarController.tabBarDoubleTapGestureRecognizerHandler(_:)))
|
||||||
// tabBarDoubleTapGestureRecognizer.addTarget(self, action: #selector(MainTabBarController.tabBarDoubleTapGestureRecognizerHandler(_:)))
|
tabBarDoubleTapGestureRecognizer.delaysTouchesEnded = false
|
||||||
// tabBarDoubleTapGestureRecognizer.delaysTouchesEnded = false
|
tabBar.addGestureRecognizer(tabBarDoubleTapGestureRecognizer)
|
||||||
// tabBar.addGestureRecognizer(tabBarDoubleTapGestureRecognizer)
|
|
||||||
|
|
||||||
self.isReadyForWizardAvatarButton = authContext != nil
|
self.isReadyForWizardAvatarButton = authContext != nil
|
||||||
|
|
||||||
|
@ -359,17 +358,22 @@ extension MainTabBarController {
|
||||||
guard let tab = touchedTab(by: sender) else { return }
|
guard let tab = touchedTab(by: sender) else { return }
|
||||||
|
|
||||||
switch tab {
|
switch tab {
|
||||||
case .me:
|
// todo: reconsider the "double tap to change account" feature -> https://github.com/mastodon/mastodon-ios/issues/628
|
||||||
guard let authContext = authContext else { return }
|
// case .me:
|
||||||
|
// guard let authContext = authContext else { return }
|
||||||
|
// assert(Thread.isMainThread)
|
||||||
|
//
|
||||||
|
// guard let nextAccount = context.nextAccount(in: authContext) else { return }
|
||||||
|
//
|
||||||
|
// Task { @MainActor in
|
||||||
|
// let isActive = try await context.authenticationService.activeMastodonUser(domain: nextAccount.domain, userID: nextAccount.userID)
|
||||||
|
// guard isActive else { return }
|
||||||
|
// self.coordinator.setup()
|
||||||
|
// }
|
||||||
|
case .search:
|
||||||
assert(Thread.isMainThread)
|
assert(Thread.isMainThread)
|
||||||
|
// double tapping search tab opens the search bar without additional taps
|
||||||
guard let nextAccount = context.nextAccount(in: authContext) else { return }
|
searchViewController?.searchBarTapPublisher.send("")
|
||||||
|
|
||||||
Task { @MainActor in
|
|
||||||
let isActive = try await context.authenticationService.activeMastodonUser(domain: nextAccount.domain, userID: nextAccount.userID)
|
|
||||||
guard isActive else { return }
|
|
||||||
self.coordinator.setup()
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue