From 73ce92216a3979cffba8ff36cfea95f93d2b4bd8 Mon Sep 17 00:00:00 2001 From: Marcus Kida Date: Thu, 16 Mar 2023 00:18:22 +0100 Subject: [PATCH] IOS-110: Fix Cannot switch accounts when large content viewer is enabled (#976) --- .../Scene/Root/MainTab/MainTabBarController.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift index 0aeed3e37..da508d452 100644 --- a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift +++ b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift @@ -26,6 +26,8 @@ class MainTabBarController: UITabBarController { var authContext: AuthContext? + private let largeContentViewerInteraction = UILargeContentViewerInteraction() + let composeButttonShadowBackgroundContainer = ShadowBackgroundContainer() let composeButton: UIButton = { let button = UIButton() @@ -180,6 +182,8 @@ class MainTabBarController: UITabBarController { self.coordinator = coordinator self.authContext = authContext super.init(nibName: nil, bundle: nil) + tabBar.addInteraction(largeContentViewerInteraction) + } required init?(coder: NSCoder) { @@ -349,6 +353,7 @@ extension MainTabBarController { let tabBarLongPressGestureRecognizer = UILongPressGestureRecognizer() tabBarLongPressGestureRecognizer.addTarget(self, action: #selector(MainTabBarController.tabBarLongPressGestureRecognizerHandler(_:))) + tabBarLongPressGestureRecognizer.delegate = self tabBar.addGestureRecognizer(tabBarLongPressGestureRecognizer) // todo: reconsider the "double tap to change account" feature -> https://github.com/mastodon/mastodon-ios/issues/628 @@ -844,3 +849,9 @@ extension MainTabBarController { } } + +extension MainTabBarController: UIGestureRecognizerDelegate { + func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { + true + } +}