Alternative solution for requiring direct taps for launching media view (#1235) (#1261)

// FREEBIE
This commit is contained in:
Brandon Cheng 2016-07-21 13:23:39 -04:00 committed by Michael Kirk
parent 29769b4b76
commit 583d3e82ad
2 changed files with 15 additions and 17 deletions

View file

@ -1041,23 +1041,6 @@ typedef enum : NSUInteger {
#pragma mark - Actions
- (void)collectionView:(JSQMessagesCollectionView *)collectionView didTapCellAtIndexPath:(NSIndexPath *)indexPath touchLocation:(CGPoint)touchLocation
{
TSMessageAdapter *messageItem = [collectionView.dataSource collectionView:collectionView messageDataForItemAtIndexPath:indexPath];
TSInteraction *interaction = [self interactionAtIndexPath:indexPath];
switch (messageItem.messageType) {
case TSErrorMessageAdapter:
[self handleErrorMessageTap:(TSErrorMessage *)interaction];
break;
case TSInfoMessageAdapter:
[self handleWarningTap:interaction];
break;
default:
DDLogDebug(@"Not handling cell tap for message: %@", messageItem);
}
}
- (void)collectionView:(JSQMessagesCollectionView *)collectionView
didTapMessageBubbleAtIndexPath:(NSIndexPath *)indexPath
{
@ -1242,6 +1225,12 @@ typedef enum : NSUInteger {
}
}
} break;
case TSErrorMessageAdapter:
[self handleErrorMessageTap:(TSErrorMessage *)interaction];
break;
case TSInfoMessageAdapter:
[self handleWarningTap:interaction];
break;
case TSCallAdapter:
break;
default:

View file

@ -56,4 +56,13 @@
self.cellLabel.text = nil;
}
// This subclass does not have a messageBubbleContainerView, so superclass
// touch calculations will be incorrect. Since this view spans the entire
// frame, we can override the touch handler to respond to user actions by
// default.
- (void)jsq_handleTapGesture:(UITapGestureRecognizer *)tap
{
[self.delegate messagesCollectionViewCellDidTapMessageBubble:self];
}
@end