Fix compiling on visionOS

This commit is contained in:
Shadowfacts 2024-08-21 18:27:30 -04:00
parent 3a21983b98
commit 494708a362
2 changed files with 11 additions and 1 deletions

View File

@ -45,7 +45,9 @@ class MainTabBarViewController: BaseMainTabBarViewController {
embedInNavigationController(Tab.myProfile.createViewController(mastodonController)),
]
#if !os(visionOS)
setupFastAccountSwitcher()
#endif
tabBar.isSpringLoaded = true

View File

@ -91,7 +91,7 @@ final class NewMainTabBarViewController: BaseMainTabBarViewController {
]
reloadSavedInstances()
if UIDevice.current.userInterfaceIdiom == .phone {
if UIDevice.current.userInterfaceIdiom == .phone || UIDevice.current.userInterfaceIdiom == .vision {
self.tabs = [
homeTab,
notificationsTab,
@ -121,7 +121,9 @@ final class NewMainTabBarViewController: BaseMainTabBarViewController {
NotificationCenter.default.addObserver(self, selector: #selector(reloadSavedInstances), name: .savedInstancesChanged, object: nil)
}
#if !os(visionOS)
setupFastAccountSwitcher()
#endif
}
private func updatePadTabs() {
@ -312,7 +314,9 @@ final class NewMainTabBarViewController: BaseMainTabBarViewController {
}
@objc private func sidebarTapped() {
#if !os(visionOS)
fastAccountSwitcher?.hide()
#endif
}
private func showAddList() {
@ -500,6 +504,9 @@ extension NewMainTabBarViewController: UITabBarController.Sidebar.Delegate {
config.imageProperties.maximumSize = CGSize(width: MainSidebarMyProfileCollectionViewCell.avatarImageSize, height: MainSidebarMyProfileCollectionViewCell.avatarImageSize)
config.imageProperties.cornerRadius = Preferences.shared.avatarStyle.cornerRadiusFraction * MainSidebarMyProfileCollectionViewCell.avatarImageSize
#if os(visionOS)
item.contentConfiguration = config
#else
if UIDevice.current.userInterfaceIdiom != .mac {
item.accessories = [
.customView(configuration: .init(customView: fastAccountSwitcherIndicator, placement: .trailing()))
@ -510,6 +517,7 @@ extension NewMainTabBarViewController: UITabBarController.Sidebar.Delegate {
} else {
item.contentConfiguration = config
}
#endif
}
return item
}