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)), embedInNavigationController(Tab.myProfile.createViewController(mastodonController)),
] ]
#if !os(visionOS)
setupFastAccountSwitcher() setupFastAccountSwitcher()
#endif
tabBar.isSpringLoaded = true tabBar.isSpringLoaded = true

View File

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