From 0da0d0aeb5c5d2eeca5bd779f7489de52729e752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=CC=81o=20Natan?= Date: Fri, 14 Jun 2024 05:12:36 +0300 Subject: [PATCH] Fix UITabBarController push/pop transitions Part of #570 --- .../project.pbxproj | 4 ---- .../UIViewController+LNPopupSupportPrivate.m | 21 +++++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/LNPopupController/LNPopupController.xcodeproj/project.pbxproj b/LNPopupController/LNPopupController.xcodeproj/project.pbxproj index 94dab6a6..aa3c86de 100644 --- a/LNPopupController/LNPopupController.xcodeproj/project.pbxproj +++ b/LNPopupController/LNPopupController.xcodeproj/project.pbxproj @@ -451,8 +451,6 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; MACH_O_TYPE = mh_dylib; MTL_ENABLE_DEBUG_INFO = YES; @@ -505,8 +503,6 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; MACH_O_TYPE = mh_dylib; MTL_ENABLE_DEBUG_INFO = NO; diff --git a/LNPopupController/LNPopupController/Private/UIViewController+LNPopupSupportPrivate.m b/LNPopupController/LNPopupController/Private/UIViewController+LNPopupSupportPrivate.m index e99a43da..8bd6c357 100644 --- a/LNPopupController/LNPopupController/Private/UIViewController+LNPopupSupportPrivate.m +++ b/LNPopupController/LNPopupController/Private/UIViewController+LNPopupSupportPrivate.m @@ -1131,9 +1131,18 @@ - (void)__repositionPopupBarToClosed_hack self._ln_popupController_nocreate.popupBar.frame = frame; } +static BOOL _alreadyInHideShowBar = NO; + //_hideBarWithTransition:isExplicit:duration: - (void)hBWT:(NSInteger)t iE:(BOOL)e d:(NSTimeInterval)duration { + if(_alreadyInHideShowBar == YES) + { + //Ignore nested calls to _hideBarWithTransition:isExplicit:duration: + [self hBWT:t iE:e d:duration]; + return; + } + BOOL isFloating = self._ln_popupController_nocreate.popupBar.resolvedStyle == LNPopupBarStyleFloating; if(!isFloating) { @@ -1154,7 +1163,10 @@ - (void)hBWT:(NSInteger)t iE:(BOOL)e d:(NSTimeInterval)duration self._ln_bottomBarExtension.frame = frame; self._ln_bottomBarExtension_nocreate.hidden = NO; self._ln_bottomBarExtension_nocreate.alpha = 1.0; + + _alreadyInHideShowBar = YES; [self hBWT:t iE:e d:duration]; + _alreadyInHideShowBar = NO; NSString* effectGroupingIdentifier = self._ln_popupController_nocreate.popupBar.effectGroupingIdentifier; self._ln_popupController_nocreate.popupBar.effectGroupingIdentifier = nil; @@ -1238,6 +1250,13 @@ - (void)hBWT:(NSInteger)t iE:(BOOL)e d:(NSTimeInterval)duration //_showBarWithTransition:isExplicit:duration: - (void)sBWT:(NSInteger)t iE:(BOOL)e d:(NSTimeInterval)duration { + if(_alreadyInHideShowBar == YES) + { + //Ignore nested calls to _showBarWithTransition:isExplicit:duration: + [self sBWT:t iE:e d:duration]; + return; + } + BOOL isFloating = self._ln_popupController_nocreate.popupBar.resolvedStyle == LNPopupBarStyleFloating; BOOL isRTL = [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.tabBar.superview.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft; @@ -1256,7 +1275,9 @@ - (void)sBWT:(NSInteger)t iE:(BOOL)e d:(NSTimeInterval)duration BOOL wasHidden = self.tabBar.isHidden; + _alreadyInHideShowBar = YES; [self sBWT:t iE:e d:duration]; + _alreadyInHideShowBar = NO; if(e == NO) {