From f1cfad4beb1be7452cafc6ae4b72531ff5443908 Mon Sep 17 00:00:00 2001 From: Robert Herdzik Date: Fri, 22 Apr 2016 09:03:02 +0200 Subject: [PATCH] equality_method_added_to_TSMessage --- Pod/Classes/TSMessage.m | 2 +- Pod/Classes/TSMessageView.m | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Pod/Classes/TSMessage.m b/Pod/Classes/TSMessage.m index 02deac66..3e43e1e9 100755 --- a/Pod/Classes/TSMessage.m +++ b/Pod/Classes/TSMessage.m @@ -154,7 +154,7 @@ + (void)prepareNotificationToBeShown:(TSMessageView *)messageView for (TSMessageView *n in [TSMessage sharedMessage].messages) { - if (([n.title isEqualToString:title] || (!n.title && !title)) && ([n.subtitle isEqualToString:subtitle] || (!n.subtitle && !subtitle))) + if ([n isEqual:messageView]) { return; // avoid showing the same messages twice in a row } diff --git a/Pod/Classes/TSMessageView.m b/Pod/Classes/TSMessageView.m index 03893b7c..f972c8de 100755 --- a/Pod/Classes/TSMessageView.m +++ b/Pod/Classes/TSMessageView.m @@ -572,6 +572,11 @@ - (void)didMoveToWindow [self fadeMeOut]; } } + +- (BOOL)isEqual:(TSMessageView *)object { + return [object.title isEqualToString:self.title] && [object.subtitle isEqualToString:self.subtitle]; +} + #pragma mark - Target/Action - (void)buttonTapped:(id) sender