Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

fix complete block check contracting may not match actual action #187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions TLYShyNavBar/ShyControllers/TLYShyViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ - (CGFloat)snap:(BOOL)contract
return [self snap:contract completion:nil];
}

- (CGFloat)snap:(BOOL)contract completion:(void (^)())completion
- (CGFloat)snap:(BOOL)contract completion:(void (^)(BOOL contracting))completion
{
/* "The Facebook" UX dictates that:
*
Expand All @@ -211,21 +211,24 @@ - (CGFloat)snap:(BOOL)contract completion:(void (^)())completion
*/

__block CGFloat deltaY;
__block BOOL contracting = YES;
[UIView animateWithDuration:0.2 animations:^
{
if ((contract && self.subShyController.contracted) || (!contract && !self.expanded))
{
deltaY = [self contract];
contracting = YES;
}
else
{
deltaY = [self.subShyController expand];
contracting = NO;
}
}
completion:^(BOOL finished)
{
if (completion && finished) {
completion();
completion(contracting);
}
}];

Expand Down
4 changes: 2 additions & 2 deletions TLYShyNavBar/TLYShyNavBarManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,11 @@ - (void)_handleScrollingEnded
}

__weak __typeof(self) weakSelf = self;
void (^completion)() = ^
void (^completion)(BOOL contracting) = ^(BOOL contracting)
{
__typeof(self) strongSelf = weakSelf;
if (strongSelf) {
if (strongSelf.contracting) {
if (contracting) {
if ([strongSelf.delegate respondsToSelector:@selector(shyNavBarManagerDidFinishContracting:)]) {
[strongSelf.delegate shyNavBarManagerDidFinishContracting:strongSelf];
}
Expand Down