Fix TabView on Catalyst

This commit is contained in:
Thomas Ricouard 2024-09-06 08:58:24 +02:00
parent aa91d16cd9
commit 1af3cf4bf9

View file

@ -108,6 +108,29 @@ struct AppView: View {
tabs: availableTabs)
{
HStack(spacing: 0) {
if #available(macCatalyst 18.0, *) {
baseTabView
.tabViewStyle(.sidebarAdaptable)
.introspect(.tabView, on: .iOS(.v17, .v18)) { (tabview: UITabBarController) in
tabview.sidebar.isHidden = true
}
} else {
baseTabView
}
if horizontalSizeClass == .regular,
appAccountsManager.currentClient.isAuth,
userPreferences.showiPadSecondaryColumn
{
Divider().edgesIgnoringSafeArea(.all)
notificationsSecondaryColumn
}
}
}
.environment(appRouterPath)
}
#endif
private var baseTabView: some View {
TabView(selection: $selectedTab) {
ForEach(availableTabs) { tab in
tab
@ -125,18 +148,7 @@ struct AppView: View {
tabview.customizableViewControllers = []
tabview.moreNavigationController.isNavigationBarHidden = true
}
if horizontalSizeClass == .regular,
appAccountsManager.currentClient.isAuth,
userPreferences.showiPadSecondaryColumn
{
Divider().edgesIgnoringSafeArea(.all)
notificationsSecondaryColumn
}
}
}
.environment(appRouterPath)
}
#endif
var notificationsSecondaryColumn: some View {
NotificationsTab(selectedTab: .constant(.notifications)