mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-02 14:16:59 +02:00
hyperlink mxids and room aliases: open room member detail or contact detail screen when clicking on a mxid #442
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#import "PreviewRoomTitleView.h"
|
||||
|
||||
#import "RoomMemberDetailsViewController.h"
|
||||
#import "ContactDetailsViewController.h"
|
||||
|
||||
#import "SegmentedViewController.h"
|
||||
#import "RoomSettingsViewController.h"
|
||||
@@ -79,9 +80,12 @@
|
||||
// The customized room data source for Vector
|
||||
RoomDataSource *customizedRoomDataSource;
|
||||
|
||||
// the user taps on a member thumbnail
|
||||
// The user taps on a member thumbnail
|
||||
MXRoomMember *selectedRoomMember;
|
||||
|
||||
// The user taps on a user id contained in a message
|
||||
MXKContact *selectedContact;
|
||||
|
||||
// List of members who are typing in the room.
|
||||
NSArray *currentTypingUsers;
|
||||
|
||||
@@ -1741,6 +1745,35 @@
|
||||
|
||||
[[AppDelegate theDelegate] handleUniversalLinkFragment:fixedURL.fragment];
|
||||
}
|
||||
// Open the detail screen of the clicked user
|
||||
else if ([MXTools isMatrixUserIdentifier:url.absoluteString])
|
||||
{
|
||||
shouldDoAction = NO;
|
||||
|
||||
NSString *userId = url.absoluteString;
|
||||
|
||||
MXRoomMember* member = [self.roomDataSource.room.state memberWithUserId:userId];
|
||||
if (member)
|
||||
{
|
||||
// Use the room member detail VC for room members
|
||||
selectedRoomMember = member;
|
||||
[self performSegueWithIdentifier:@"showMemberDetails" sender:self];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the contact detail VC for other users
|
||||
MXUser *user = [self.roomDataSource.room.mxSession userWithUserId:userId];
|
||||
if (user)
|
||||
{
|
||||
selectedContact = [[MXKContact alloc] initMatrixContactWithDisplayName:((user.displayname.length > 0) ? user.displayname : user.userId) andMatrixID:user.userId];
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedContact = [[MXKContact alloc] initMatrixContactWithDisplayName:userId andMatrixID:userId];
|
||||
}
|
||||
[self performSegueWithIdentifier:@"showContactDetails" sender:self];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return shouldDoAction;
|
||||
@@ -1839,6 +1872,16 @@
|
||||
selectedRoomMember = nil;
|
||||
}
|
||||
}
|
||||
else if ([[segue identifier] isEqualToString:@"showContactDetails"])
|
||||
{
|
||||
if (selectedContact)
|
||||
{
|
||||
ContactDetailsViewController *contactDetailsViewController = segue.destinationViewController;
|
||||
contactDetailsViewController.contact = selectedContact;
|
||||
|
||||
selectedContact = nil;
|
||||
}
|
||||
}
|
||||
|
||||
// Hide back button title
|
||||
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
|
||||
|
||||
Reference in New Issue
Block a user