Skip to content

Commit

Permalink
matrix.to: Support room preview when the permalink has parameters (li…
Browse files Browse the repository at this point in the history
…ke "via=")

It works. There is no reason for not doing it
  • Loading branch information
manuroe committed Feb 2, 2021
1 parent ac7c62f commit e42a259
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Changes to be released in next version
🙌 Improvements
* Social login: Handle new identity provider brand field in order to customize buttons (#3980).
* Widgets: Support $matrix_room_id and $matrix_widget_id parameters (#3987).
* matrix.to: Support room preview when the permalink has parameters (like "via=").

🐛 Bugfix
* Push: Fix PushKit crashes due to undecryptable call invites (#3986).
Expand Down
48 changes: 20 additions & 28 deletions Riot/Modules/Application/LegacyAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -1444,40 +1444,32 @@ - (BOOL)handleUniversalLinkFragment:(NSString*)fragment
// FIXME: In case of multi-account, ask the user which one to use
MXKAccount* account = accountManager.activeAccounts.firstObject;

RoomPreviewData *roomPreviewData;
RoomPreviewData *roomPreviewData = [[RoomPreviewData alloc] initWithRoomId:roomIdOrAlias
andSession:account.mxSession];
if (queryParams)
{
// Note: the activity indicator will not disappear if the session is not ready
[homeViewController stopActivityIndicator];

roomPreviewData = [[RoomPreviewData alloc] initWithRoomId:roomIdOrAlias emailInvitationParams:queryParams andSession:account.mxSession];
roomPreviewData.viaServers = queryParams[@"via"];
[self showRoomPreview:roomPreviewData];
}
else
{
roomPreviewData = [[RoomPreviewData alloc] initWithRoomId:roomIdOrAlias andSession:account.mxSession];

// Is it a link to an event of a room?
// If yes, the event will be displayed once the room is joined
roomPreviewData.eventId = (pathParams.count >= 3) ? pathParams[2] : nil;

// Try to get more information about the room before opening its preview
[roomPreviewData peekInRoom:^(BOOL succeeded) {

// Is it a link to an event of a room?
// If yes, the event will be displayed once the room is joined
roomPreviewData.eventId = (pathParams.count >= 3) ? pathParams[2] : nil;
// Note: the activity indicator will not disappear if the session is not ready
[homeViewController stopActivityIndicator];

// Try to get more information about the room before opening its preview
[roomPreviewData peekInRoom:^(BOOL succeeded) {

// Note: the activity indicator will not disappear if the session is not ready
[homeViewController stopActivityIndicator];

// If no data is available for this room, we name it with the known room alias (if any).
if (!succeeded && universalLinkFragmentPendingRoomAlias[roomIdOrAlias])
{
roomPreviewData.roomName = universalLinkFragmentPendingRoomAlias[roomIdOrAlias];
}
universalLinkFragmentPendingRoomAlias = nil;

[self showRoomPreview:roomPreviewData];
}];
}
// If no data is available for this room, we name it with the known room alias (if any).
if (!succeeded && universalLinkFragmentPendingRoomAlias[roomIdOrAlias])
{
roomPreviewData.roomName = universalLinkFragmentPendingRoomAlias[roomIdOrAlias];
}
universalLinkFragmentPendingRoomAlias = nil;

[self showRoomPreview:roomPreviewData];
}];
}

}
Expand Down

0 comments on commit e42a259

Please sign in to comment.