From 33c641cd85fbc5bfdd7cb557c962587f9a8e58ca Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 10 Feb 2025 10:22:56 -0500 Subject: [PATCH] visionOS: Workaround for Compose screen not being opened See #564 --- .../Screens/Main/NewMainTabBarViewController.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Tusker/Screens/Main/NewMainTabBarViewController.swift b/Tusker/Screens/Main/NewMainTabBarViewController.swift index 989124921..62627144d 100644 --- a/Tusker/Screens/Main/NewMainTabBarViewController.swift +++ b/Tusker/Screens/Main/NewMainTabBarViewController.swift @@ -490,6 +490,18 @@ extension NewMainTabBarViewController: UITabBarControllerDelegate { } func tabBarController(_ tabBarController: UITabBarController, didSelectTab newTab: UITab, previousTab: UITab?) { + // Workaround for FB16476036 (visionOS: tabBarController(_:shouldSelectTab:) delegate method not called) + #if os(visionOS) + if let previousTab, + newTab.identifier == Tab.compose.rawValue { + compose(editing: nil) + DispatchQueue.main.async { + self.selectedTab = previousTab + } + return + } + #endif + self.updateViewControllerSafeAreaInsets(newTab.viewController!) // All tabs in a tab group deliberately share the same view controller, so we have to do this ourselves.