Skip to content

Commit

Permalink
Fix UITabBarController push/pop transitions
Browse files Browse the repository at this point in the history
Part of #570
  • Loading branch information
LeoNatan committed Jun 14, 2024
1 parent e966df2 commit 0da0d0a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
4 changes: 0 additions & 4 deletions LNPopupController/LNPopupController.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down

0 comments on commit 0da0d0a

Please sign in to comment.