diff --git a/Classes/Core/Controllers/FLEXNavigationController.m b/Classes/Core/Controllers/FLEXNavigationController.m index ec695e8ba..9bb78a04a 100644 --- a/Classes/Core/Controllers/FLEXNavigationController.m +++ b/Classes/Core/Controllers/FLEXNavigationController.m @@ -11,6 +11,9 @@ #import "FLEXObjectExplorerFactory.h" #import "FLEXTabList.h" +// https://stackoverflow.com/a/5337804 +#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) + @interface UINavigationController (Private) - (void)_gestureRecognizedInteractiveHide:(UIGestureRecognizer *)sender; @end @@ -48,7 +51,7 @@ - (void)viewDidLoad { [self.navigationBar addGestureRecognizer:navbarTapGesture]; // Add gesture to dismiss if not presented with a sheet style - if (@available(iOS 13, *)) { + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"13.0")) { switch (self.modalPresentationStyle) { case UIModalPresentationAutomatic: case UIModalPresentationPageSheet: @@ -67,7 +70,7 @@ - (void)viewDidLoad { - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - if (@available(iOS 15.0, *)) { + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"15.0")) { UISheetPresentationController *presenter = self.sheetPresentationController; presenter.detents = @[ UISheetPresentationControllerDetent.mediumDetent, diff --git a/Classes/ExplorerInterface/FLEXExplorerViewController.m b/Classes/ExplorerInterface/FLEXExplorerViewController.m index 9b4964dd4..b2b24d763 100644 --- a/Classes/ExplorerInterface/FLEXExplorerViewController.m +++ b/Classes/ExplorerInterface/FLEXExplorerViewController.m @@ -28,6 +28,9 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) { FLEXExplorerModeMove }; +// https://stackoverflow.com/a/5337804 +#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) + @interface FLEXExplorerViewController () /// Tracks the currently active tool/mode @@ -126,7 +129,7 @@ - (void)viewDidLoad { [self.view addGestureRecognizer:self.movePanGR]; // Feedback - if (@available(iOS 10.0, *)) { + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) { _selectionFBG = [UISelectionFeedbackGenerator new]; } @@ -429,7 +432,7 @@ - (void)hierarchyButtonTapped:(FLEXExplorerToolbarItem *)sender { } - (UIWindow *)statusWindow { - if (!@available(iOS 16, *)) { + if (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"16.0")) { NSString *statusBarString = [NSString stringWithFormat:@"%@arWindow", @"_statusB"]; return [UIApplication.sharedApplication valueForKey:statusBarString]; } @@ -684,7 +687,7 @@ - (void)handleChangeViewAtPointGesture:(UIPanGestureRecognizer *)sender { } - (void)actuateSelectionChangedFeedback { - if (@available(iOS 10.0, *)) { + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) { [self.selectionFBG selectionChanged]; } } @@ -824,7 +827,7 @@ - (void)updateSelectedViewPositionWithDragGesture:(UIPanGestureRecognizer *)move - (CGRect)viewSafeArea { CGRect safeArea = self.view.bounds; - if (@available(iOS 11.0, *)) { + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) { safeArea = UIEdgeInsetsInsetRect(self.view.bounds, self.view.safeAreaInsets); } @@ -832,7 +835,7 @@ - (CGRect)viewSafeArea { } - (void)viewSafeAreaInsetsDidChange { - if (@available(iOS 11.0, *)) { + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"11.0")) { [super viewSafeAreaInsetsDidChange]; CGRect safeArea = [self viewSafeArea]; @@ -916,7 +919,7 @@ - (void)presentViewController:(UIViewController *)toPresent [self.view.window makeKeyWindow]; // Move the status bar on top of FLEX so we can get scroll to top behavior for taps. - if (!@available(iOS 13, *)) { + if (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"13.0")) { [self statusWindow].windowLevel = self.view.window.windowLevel + 1.0; }