From d6faf3a37bbd8986f23b8e2b6af0d8e85f1fa698 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 1 Apr 2024 10:28:40 -0400 Subject: [PATCH] Fix fast account switching view not respecting safe area --- .../FastAccountSwitcherViewController.xib | 6 +++--- Tusker/Screens/Main/MainTabBarViewController.swift | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Tusker/Screens/Fast Account Switcher/FastAccountSwitcherViewController.xib b/Tusker/Screens/Fast Account Switcher/FastAccountSwitcherViewController.xib index ad346055..80f8f521 100644 --- a/Tusker/Screens/Fast Account Switcher/FastAccountSwitcherViewController.xib +++ b/Tusker/Screens/Fast Account Switcher/FastAccountSwitcherViewController.xib @@ -1,9 +1,9 @@ - + - + @@ -32,7 +32,6 @@ - @@ -47,6 +46,7 @@ + diff --git a/Tusker/Screens/Main/MainTabBarViewController.swift b/Tusker/Screens/Main/MainTabBarViewController.swift index f7c1c6fc..b01b2f71 100644 --- a/Tusker/Screens/Main/MainTabBarViewController.swift +++ b/Tusker/Screens/Main/MainTabBarViewController.swift @@ -241,6 +241,7 @@ extension MainTabBarViewController { #if !os(visionOS) extension MainTabBarViewController: FastAccountSwitcherViewControllerDelegate { func fastAccountSwitcherAddToViewHierarchy(_ fastAccountSwitcher: FastAccountSwitcherViewController) { + fastAccountSwitcher.view.translatesAutoresizingMaskIntoConstraints = false view.addSubview(fastAccountSwitcher.view) NSLayoutConstraint.activate([ fastAccountSwitcher.accountsStack.bottomAnchor.constraint(equalTo: fastAccountSwitcher.view.bottomAnchor), @@ -249,6 +250,10 @@ extension MainTabBarViewController: FastAccountSwitcherViewControllerDelegate { fastAccountSwitcher.view.trailingAnchor.constraint(equalTo: view.trailingAnchor), fastAccountSwitcher.view.topAnchor.constraint(equalTo: view.topAnchor), fastAccountSwitcher.view.bottomAnchor.constraint(equalTo: tabBar.topAnchor), + + // The safe area insets don't automatically propagate for some reason, so do it ourselves. + fastAccountSwitcher.view.safeAreaLayoutGuide.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor), + fastAccountSwitcher.view.safeAreaLayoutGuide.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor), ]) }