Fix conversation screen scrolling issue

This commit is contained in:
nielsandriesse 2020-10-22 12:38:35 +11:00
parent 0348289561
commit f5ddd697f1

View file

@ -11,7 +11,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface OWSMessageCell ()
@interface OWSMessageCell () <UIGestureRecognizerDelegate>
// The nullable properties are created as needed.
// The non-nullable properties are so frequently used that it's easier
@ -81,6 +81,7 @@ NS_ASSUME_NONNULL_BEGIN
UIPanGestureRecognizer *pan =
[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)];
pan.delegate = self;
[self.contentView addGestureRecognizer:pan];
}
@ -497,6 +498,17 @@ NS_ASSUME_NONNULL_BEGIN
[self.messageBubbleView handlePanGesture:sender];
}
-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
LKVoiceMessageView *voiceMessageView = self.viewItem.lastAudioMessageView;
if (![gestureRecognizer isKindOfClass:UIPanGestureRecognizer.class] || voiceMessageView == nil) { return NO; }
UIPanGestureRecognizer *panGestureRecognizer = (UIPanGestureRecognizer *)gestureRecognizer;
CGPoint location = [panGestureRecognizer locationInView:voiceMessageView];
if (!CGRectContainsPoint(voiceMessageView.bounds, location)) { return NO; }
CGPoint velocity = [panGestureRecognizer velocityInView:voiceMessageView];
return fabs(velocity.x) > fabs(velocity.y);
}
- (BOOL)isGestureInCellHeader:(UIGestureRecognizer *)sender
{
OWSAssertDebug(self.viewItem);