mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 16:42:44 +02:00
Ignore data detector URLs on file attachment names, always opening the file. (#6330)
This commit is contained in:
@@ -1562,6 +1562,14 @@ static NSMutableDictionary *childClasses;
|
||||
associatedEvent = bubbleComponent.event;
|
||||
}
|
||||
|
||||
// Tapping a file attachment who's name triggers a data detector will try to open that URL.
|
||||
// Detect this and instead map the interaction into a tap on the cell.
|
||||
if (associatedEvent.isMediaAttachment)
|
||||
{
|
||||
[delegate cell:self didRecognizeAction:kMXKRoomBubbleCellTapOnAttachmentView userInfo:nil];
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Ask the delegate if iOS can open the link
|
||||
shouldInteractWithURL = [self shouldInteractWithURL:URL urlItemInteraction:interaction associatedEvent:associatedEvent];
|
||||
}
|
||||
@@ -1569,32 +1577,6 @@ static NSMutableDictionary *childClasses;
|
||||
return shouldInteractWithURL;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
|
||||
// Delegate method only called on iOS 9. iOS 10+ use method above.
|
||||
- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange
|
||||
{
|
||||
BOOL shouldInteractWithURL = YES;
|
||||
|
||||
if (delegate && URL)
|
||||
{
|
||||
MXEvent *associatedEvent;
|
||||
|
||||
if ([textView isMemberOfClass:[MXKMessageTextView class]])
|
||||
{
|
||||
MXKMessageTextView *mxkMessageTextView = (MXKMessageTextView *)textView;
|
||||
MXKRoomBubbleComponent *bubbleComponent = [self closestBubbleComponentAtPosition:mxkMessageTextView.lastHitTestLocation];
|
||||
associatedEvent = bubbleComponent.event;
|
||||
}
|
||||
|
||||
// Ask the delegate if iOS can open the link
|
||||
shouldInteractWithURL = [self shouldInteractWithURL:URL urlItemInteractionValue:@(0) associatedEvent:associatedEvent];
|
||||
}
|
||||
|
||||
return shouldInteractWithURL;
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#pragma mark - WKNavigationDelegate
|
||||
|
||||
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
|
||||
|
||||
Reference in New Issue
Block a user