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

Tap doesn't dismiss the message when I have a callback? And sliding doesn't call the callback at all? #201

Open
kevinrenskers opened this issue Dec 22, 2014 · 4 comments

Comments

@kevinrenskers
Copy link

This code will show a message that will be dismissed when you tap on it, or slide it up:

[TSMessage showNotificationWithTitle:@"Test" type:TSMessageNotificationTypeWarning];

This code however will execute the callback but not dismiss? And when I slide it up instead of tapping the callback is not triggered.

[TSMessage showNotificationInViewController:[TSMessage defaultViewController] title:@"Test" subtitle:nil image:nil type:TSMessageNotificationTypeWarning duration:TSMessageNotificationDurationEndless callback:^{
    NSLog(@"Dismissed");
} buttonTitle:nil buttonCallback:nil atPosition:TSMessageNotificationPositionTop canBeDismissedByUser:YES];
@dilizarov
Copy link

I'm having the same issue. I can't dismiss nor slide it up. The callback instead gets called each time.

A quick fix for allowing dismissal upon clicking is to simply call [self fadeMeOut] yourself within the library. The problem is clearly that the handleTap function doesn't handle dismissing. An issue is that there isn't an instant variable reference to what the user set that value as, so one can't programmatically check. That should also be an easy fix.

Also, the above still won't solve the sliding up problem.

@kartikthapar
Copy link

"And when I slide it up instead of tapping the callback is not triggered."

I think this is by design and not a bug. When the user slides up, he clearly does not want the notification or is not interested to go into more detail concerning the specific notification; similar to Apple's notification UI. So I believe, this is intended behavior. As far as the other issue is concerned: @dilizarov provided the fix — add [self fadeMeOut] at the end of handleTap: private method in TSMessageView. I am right now even contemplating the developers commission of that statement as if it was also intended by design.

@DanSkeel
Copy link

I think everhing is OK with the logic except that when dismissingEnabled is true and self.callback != nil than there are two gesture recognizers (later GR) that can't be recognized simultaneously. So If the message can be dissmissed it adds a GR with fadeMeOut action but it is never get called because GR with handleTap: action is recognized first.

The fix would be to implement a delegate method

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    return YES;
}

Probably it would be better to save GSs to member variables and make a check instead of just returning YES.

@synergetica11
Copy link

No need to change library itself, just use
[TSMessage dismissActiveNotification] or
TSMessage dismissActiveNotificationWithCompletion:^{

as a callback: function when showing notification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants