Fix building for iOS 14

This commit is contained in:
Shadowfacts 2022-06-28 17:28:48 -07:00
parent c6e06fe9f3
commit 0960699699
4 changed files with 36 additions and 16 deletions

View File

@ -2205,8 +2205,7 @@
CURRENT_PROJECT_VERSION = 31;
DEVELOPMENT_TEAM = V4WK9KR9U2;
INFOPLIST_FILE = Tusker/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.3;
IPHONEOS_DEPLOYMENT_TARGET = 14.3;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -2236,8 +2235,7 @@
CURRENT_PROJECT_VERSION = 31;
DEVELOPMENT_TEAM = V4WK9KR9U2;
INFOPLIST_FILE = Tusker/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.3;
IPHONEOS_DEPLOYMENT_TARGET = 14.3;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",

View File

@ -154,6 +154,7 @@ extension ComposeAttachmentRow {
}
private extension View {
@available(iOS, obsoleted: 16.0)
@ViewBuilder
func contextMenu<M: View, P: View>(@ViewBuilder menuItems: () -> M, @ViewBuilder previewIfAvailable preview: () -> P) -> some View {
if #available(iOS 16.0, *) {

View File

@ -17,7 +17,7 @@ protocol LargeImageContentView: UIView {
func grayscaleStateChanged()
}
class LargeImageImageContentView: UIImageView, LargeImageContentView, ImageAnalysisInteractionDelegate {
class LargeImageImageContentView: UIImageView, LargeImageContentView {
@available(iOS 16.0, *)
private static let analyzer = ImageAnalyzer()
@ -76,7 +76,10 @@ class LargeImageImageContentView: UIImageView, LargeImageContentView, ImageAnaly
self.image = image
}
}
}
@available(iOS 16.0, *)
extension LargeImageImageContentView: ImageAnalysisInteractionDelegate {
func presentingViewController(for interaction: ImageAnalysisInteraction) -> UIViewController? {
return owner
}

View File

@ -20,10 +20,13 @@ class EnhancedNavigationViewController: UINavigationController {
override var viewControllers: [UIViewController] {
didSet {
poppedViewControllers = []
for vc in viewControllers {
configureNavItem(vc.navigationItem)
if #available(iOS 16.0, *) {
// TODO: this for loop might not be necessary
for vc in viewControllers {
configureNavItem(vc.navigationItem)
}
updateTopNavItemState()
}
updateTopNavItemState()
}
}
@ -32,7 +35,8 @@ class EnhancedNavigationViewController: UINavigationController {
self.interactivePushTransition = InteractivePushTransition(navigationController: self)
if let topViewController {
if #available(iOS 16.0, *),
let topViewController {
configureNavItem(topViewController.navigationItem)
updateTopNavItemState()
}
@ -42,7 +46,9 @@ class EnhancedNavigationViewController: UINavigationController {
let popped = performAfterAnimating(block: {
super.popViewController(animated: animated)
}, after: {
self.updateTopNavItemState()
if #available(iOS 16.0, *) {
self.updateTopNavItemState()
}
}, animated: animated)
if let popped {
poppedViewControllers.insert(popped, at: 0)
@ -54,7 +60,9 @@ class EnhancedNavigationViewController: UINavigationController {
let popped = performAfterAnimating(block: {
super.popToRootViewController(animated: animated)
}, after: {
self.updateTopNavItemState()
if #available(iOS 16.0, *) {
self.updateTopNavItemState()
}
}, animated: animated)
if let popped {
poppedViewControllers = popped
@ -66,7 +74,9 @@ class EnhancedNavigationViewController: UINavigationController {
let popped = performAfterAnimating(block: {
super.popToViewController(viewController, animated: animated)
}, after: {
self.updateTopNavItemState()
if #available(iOS 16.0, *) {
self.updateTopNavItemState()
}
}, animated: animated)
if let popped {
poppedViewControllers.insert(contentsOf: popped, at: 0)
@ -81,11 +91,15 @@ class EnhancedNavigationViewController: UINavigationController {
self.poppedViewControllers = []
}
configureNavItem(viewController.navigationItem)
if #available(iOS 16.0, *) {
configureNavItem(viewController.navigationItem)
}
super.pushViewController(viewController, animated: animated)
updateTopNavItemState()
if #available(iOS 16.0, *) {
updateTopNavItemState()
}
}
func pushPoppedViewController() {
@ -115,7 +129,9 @@ class EnhancedNavigationViewController: UINavigationController {
pushViewController(target, animated: true)
}, after: {
self.viewControllers.insert(contentsOf: toInsert, at: self.viewControllers.count - 1)
self.updateTopNavItemState()
if #available(iOS 16.0, *) {
self.updateTopNavItemState()
}
}, animated: true)
}
@ -135,6 +151,7 @@ class EnhancedNavigationViewController: UINavigationController {
})
}
@available(iOS 16.0, *)
private func configureNavItem(_ navItem: UINavigationItem) {
guard useBrowserStyleNavigation,
UIDevice.current.userInterfaceIdiom != .phone else {
@ -183,6 +200,7 @@ class EnhancedNavigationViewController: UINavigationController {
]
}
@available(iOS 16.0, *)
private func updateTopNavItemState() {
guard useBrowserStyleNavigation,
UIDevice.current.userInterfaceIdiom != .phone,