From 781b6b88ac362ade56bf9ea3394f6fb5e6455aa3 Mon Sep 17 00:00:00 2001 From: zx <109937991+asdfzxcvbn@users.noreply.github.com> Date: Sat, 13 Apr 2024 22:33:16 -0400 Subject: [PATCH 1/2] fix: compiling on linux the issue results from using `@available`. manually defining `int __isOSVersionAtLeast` fixes compiling on linux. --- Classes/ExplorerInterface/FLEXExplorerViewController.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Classes/ExplorerInterface/FLEXExplorerViewController.m b/Classes/ExplorerInterface/FLEXExplorerViewController.m index 9b4964dd4..e56280dd6 100644 --- a/Classes/ExplorerInterface/FLEXExplorerViewController.m +++ b/Classes/ExplorerInterface/FLEXExplorerViewController.m @@ -28,6 +28,14 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) { FLEXExplorerModeMove }; +int __isOSVersionAtLeast(int major, int minor, int patch) { + NSOperatingSystemVersion version; + version.majorVersion = major; + version.minorVersion = minor; + version.patchVersion = patch; + return [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:version]; +}; + @interface FLEXExplorerViewController () /// Tracks the currently active tool/mode From bc86e7c7375c703ffadc24cefae266121c5c2f95 Mon Sep 17 00:00:00 2001 From: zx Date: Sun, 14 Apr 2024 22:49:57 -0400 Subject: [PATCH 2/2] fix: macos & linux compilation --- .../Controllers/FLEXNavigationController.m | 7 +++++-- .../FLEXExplorerViewController.m | 21 +++++++------------ 2 files changed, 13 insertions(+), 15 deletions(-) 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 e56280dd6..b2b24d763 100644 --- a/Classes/ExplorerInterface/FLEXExplorerViewController.m +++ b/Classes/ExplorerInterface/FLEXExplorerViewController.m @@ -28,13 +28,8 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) { FLEXExplorerModeMove }; -int __isOSVersionAtLeast(int major, int minor, int patch) { - NSOperatingSystemVersion version; - version.majorVersion = major; - version.minorVersion = minor; - version.patchVersion = patch; - return [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:version]; -}; +// https://stackoverflow.com/a/5337804 +#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) @interface FLEXExplorerViewController () @@ -134,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]; } @@ -437,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]; } @@ -692,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]; } } @@ -832,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); } @@ -840,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]; @@ -924,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; }