Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow sticky to only be programmatically dismissed. #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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: 2 additions & 5 deletions NoticeView/WBNoticeView/WBNoticeView.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,9 @@ - (void)displayNotice
[self registerObserver];
} completion:^ (BOOL finished) {
// if it's not sticky, hide it automatically
if ((self.tapToDismissEnabled && !self.isSticky) || (!self.tapToDismissEnabled && self.isSticky)) {
if (!self.isSticky) {
// Schedule a timer
self.displayTimer = [NSTimer scheduledTimerWithTimeInterval:self.delay target:self selector:@selector(dismissAfterTimerExpiration) userInfo:nil repeats:NO];
} else if (!self.isSticky) {
// Display for a while, then hide it again
[self dismissNoticeWithDuration:self.duration delay:self.delay hiddenYOrigin:self.hiddenYOrigin];
}
}];
}
Expand All @@ -149,7 +146,7 @@ - (void)dismissNoticeWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval
- (void)dismissNotice
{
[self.displayTimer invalidate];
[self dismissNoticeWithDuration:self.duration delay:self.delay hiddenYOrigin:self.hiddenYOrigin];
[self dismissNoticeWithDuration:self.duration delay:0.0 hiddenYOrigin:self.hiddenYOrigin];
}

- (void)dismissNoticeInteractively
Expand Down