Skip to content

Commit

Permalink
The delegate didSwitchFromOldMessage:toNewMessage: now also gets call…
Browse files Browse the repository at this point in the history
…ed if detailMode != MTDetailModeHistory
  • Loading branch information
myell0w committed Dec 4, 2011
1 parent 54275d4 commit 5a56bf5
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions MTStatusBarOverlay.m
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ - (void)updateUIForMessageType:(MTMessageType)messageType duration:(NSTimeInterv
}

- (void)callDelegateWithNewMessage:(NSString *)newMessage {
if (self.historyEnabled && [self.delegate respondsToSelector:@selector(statusBarOverlayDidHide)]) {
if ([self.delegate respondsToSelector:@selector(statusBarOverlayDidHide)]) {
NSString *oldMessage = nil;

if (self.messageHistory.count > 0) {
Expand Down Expand Up @@ -1363,20 +1363,21 @@ - (void)setHistoryEnabled:(BOOL)historyEnabled {
}

- (void)addMessageToHistory:(NSString *)message {
if (self.historyEnabled && message != nil
if (message != nil
&& [message stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]].length > 0) {
NSIndexPath *newHistoryMessageIndexPath = [NSIndexPath indexPathForRow:self.messageHistory.count inSection:0];

// add message to history-array
[self.messageHistory addObject:message];

[self setDetailViewHidden:self.detailViewHidden animated:YES];

// update history table-view
[self.historyTableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newHistoryMessageIndexPath]
withRowAnimation:UITableViewRowAnimationFade];
[self.historyTableView scrollToRowAtIndexPath:newHistoryMessageIndexPath
atScrollPosition:UITableViewScrollPositionTop animated:YES];
if (self.historyEnabled) {
NSIndexPath *newHistoryMessageIndexPath = [NSIndexPath indexPathForRow:self.messageHistory.count inSection:0];
[self setDetailViewHidden:self.detailViewHidden animated:YES];

// update history table-view
[self.historyTableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newHistoryMessageIndexPath]
withRowAnimation:UITableViewRowAnimationFade];
[self.historyTableView scrollToRowAtIndexPath:newHistoryMessageIndexPath
atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
}
}

Expand Down

0 comments on commit 5a56bf5

Please sign in to comment.