Skip to content

Commit

Permalink
Merge pull request #6936 from vector-im/alfogrillo/improve_link_tappa…
Browse files Browse the repository at this point in the history
…bility

Improve external links interaction UX (PSG-819)
  • Loading branch information
Alfonso Grillo authored Oct 20, 2022
2 parents 9f965d7 + bda09a1 commit 57ea73a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
25 changes: 16 additions & 9 deletions Riot/Modules/Room/RoomViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -4593,6 +4593,9 @@ - (BOOL)dataSource:(MXKDataSource *)dataSource shouldDoAction:(NSString *)action
// Do nothing for dummy links
shouldDoAction = NO;
break;
case RoomMessageURLTypeHttp:
shouldDoAction = YES;
break;
default:
{
MXEvent *tappedEvent = userInfo[kMXKRoomBubbleCellEventKey];
Expand All @@ -4618,16 +4621,20 @@ - (BOOL)dataSource:(MXKDataSource *)dataSource shouldDoAction:(NSString *)action
break;
case UITextItemInteractionPresentActions:
{
// Retrieve the tapped event
MXEvent *tappedEvent = userInfo[kMXKRoomBubbleCellEventKey];

if (tappedEvent)
{
// Long press on link, present room contextual menu.
[self showContextualMenuForEvent:tappedEvent fromSingleTapGesture:NO cell:cell animated:YES];
if (roomMessageURLType == RoomMessageURLTypeHttp) {
shouldDoAction = YES;
} else {
// Retrieve the tapped event
MXEvent *tappedEvent = userInfo[kMXKRoomBubbleCellEventKey];

if (tappedEvent)
{
// Long press on link, present room contextual menu.
[self showContextualMenuForEvent:tappedEvent fromSingleTapGesture:NO cell:cell animated:YES];
}

shouldDoAction = NO;
}

shouldDoAction = NO;
}
break;
case UITextItemInteractionPreview:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ - (void)setupMessageTextView
[tapGesture setDelegate:self];
[self.messageTextView addGestureRecognizer:tapGesture];
self.messageTextView.userInteractionEnabled = YES;
self.messageTextView.clipsToBounds = NO;

// Recognise and make tappable phone numbers, address, etc.
self.messageTextView.dataDetectorTypes = UIDataDetectorTypeAll;
Expand Down
1 change: 1 addition & 0 deletions changelog.d/pr-6936.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improves external links interaction UX.

0 comments on commit 57ea73a

Please sign in to comment.