mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-30 00:02:47 +00:00
Merge pull request #2557 from vector-im/riot_2547
Join Room: Support via parameters to better handle federation
This commit is contained in:
commit
138d03d5b2
5 changed files with 39 additions and 7 deletions
|
@ -4,6 +4,8 @@ Changes in 0.8.7 (2019-xx-xx)
|
||||||
Improvements:
|
Improvements:
|
||||||
* RoomVC: When replying, use a "Reply" button instead of "Send".
|
* RoomVC: When replying, use a "Reply" button instead of "Send".
|
||||||
* RoomVC: New message actions (#2394).
|
* RoomVC: New message actions (#2394).
|
||||||
|
* Room upgrade: Use the `server_name` parameter when joining the new room (#2550).
|
||||||
|
* Join Room: Support via parameters to better handle federation (#2547).
|
||||||
* Reactions: Display existing reactions below the message (#2396).
|
* Reactions: Display existing reactions below the message (#2396).
|
||||||
* Menu actions: Display message time (#2463).
|
* Menu actions: Display message time (#2463).
|
||||||
* Reactions Menu: Fix position (#2447).
|
* Reactions Menu: Fix position (#2447).
|
||||||
|
|
|
@ -2324,6 +2324,7 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
|
||||||
[homeViewController stopActivityIndicator];
|
[homeViewController stopActivityIndicator];
|
||||||
|
|
||||||
roomPreviewData = [[RoomPreviewData alloc] initWithRoomId:roomIdOrAlias emailInvitationParams:queryParams andSession:account.mxSession];
|
roomPreviewData = [[RoomPreviewData alloc] initWithRoomId:roomIdOrAlias emailInvitationParams:queryParams andSession:account.mxSession];
|
||||||
|
roomPreviewData.viaServers = queryParams[@"via"];
|
||||||
[self showRoomPreview:roomPreviewData];
|
[self showRoomPreview:roomPreviewData];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2523,10 +2524,24 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
|
||||||
value = [value stringByReplacingOccurrencesOfString:@"+" withString:@" "];
|
value = [value stringByReplacingOccurrencesOfString:@"+" withString:@" "];
|
||||||
value = [value stringByRemovingPercentEncoding];
|
value = [value stringByRemovingPercentEncoding];
|
||||||
|
|
||||||
|
if ([key isEqualToString:@"via"])
|
||||||
|
{
|
||||||
|
// Special case the via parameter
|
||||||
|
// As we can have several of them, store each value into an array
|
||||||
|
if (!queryParams[key])
|
||||||
|
{
|
||||||
|
queryParams[key] = [NSMutableArray array];
|
||||||
|
}
|
||||||
|
|
||||||
|
[queryParams[key] addObject:value];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
queryParams[key] = value;
|
queryParams[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*outPathParams = pathParams;
|
*outPathParams = pathParams;
|
||||||
*outQueryParams = queryParams;
|
*outQueryParams = queryParams;
|
||||||
|
|
|
@ -50,6 +50,12 @@
|
||||||
*/
|
*/
|
||||||
@property (nonatomic) NSString *eventId;
|
@property (nonatomic) NSString *eventId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
In case of preview, the server names to try and join through in addition to those
|
||||||
|
that are automatically chosen.
|
||||||
|
*/
|
||||||
|
@property (nonatomic) NSArray<NSString*> *viaServers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Preview information.
|
Preview information.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1816,7 +1816,8 @@
|
||||||
|
|
||||||
[self.activityIndicator startAnimating];
|
[self.activityIndicator startAnimating];
|
||||||
|
|
||||||
self->currentRequest = [self.mainSession joinRoom:roomAliasOrId success:^(MXRoom *room) {
|
// TODO
|
||||||
|
self->currentRequest = [self.mainSession joinRoom:roomAliasOrId viaServers:nil success:^(MXRoom *room) {
|
||||||
|
|
||||||
self->currentRequest = nil;
|
self->currentRequest = nil;
|
||||||
[self.activityIndicator stopAnimating];
|
[self.activityIndicator stopAnimating];
|
||||||
|
|
|
@ -1047,7 +1047,8 @@
|
||||||
// Check
|
// Check
|
||||||
if (roomAlias.length)
|
if (roomAlias.length)
|
||||||
{
|
{
|
||||||
[self.mainSession joinRoom:roomAlias success:^(MXRoom *room) {
|
// TODO: /join command does not support via parameters yet
|
||||||
|
[self.mainSession joinRoom:roomAlias viaServers:nil success:^(MXRoom *room) {
|
||||||
|
|
||||||
// Show the room
|
// Show the room
|
||||||
[[AppDelegate theDelegate] showRoom:room.roomId andEventId:nil withMatrixSession:self.mainSession];
|
[[AppDelegate theDelegate] showRoom:room.roomId andEventId:nil withMatrixSession:self.mainSession];
|
||||||
|
@ -3685,7 +3686,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note in case of simple link to a room the signUrl param is nil
|
// Note in case of simple link to a room the signUrl param is nil
|
||||||
[self joinRoomWithRoomIdOrAlias:roomIdOrAlias andSignUrl:roomPreviewData.emailInvitation.signUrl completion:^(BOOL succeed) {
|
[self joinRoomWithRoomIdOrAlias:roomIdOrAlias viaServers:roomPreviewData.viaServers andSignUrl:roomPreviewData.emailInvitation.signUrl completion:^(BOOL succeed) {
|
||||||
|
|
||||||
if (succeed)
|
if (succeed)
|
||||||
{
|
{
|
||||||
|
@ -4047,8 +4048,15 @@
|
||||||
}
|
}
|
||||||
else if (customizedRoomDataSource.roomState.isObsolete)
|
else if (customizedRoomDataSource.roomState.isObsolete)
|
||||||
{
|
{
|
||||||
|
// Try to join via the server that sent the event
|
||||||
|
MXEvent *stoneTombEvent = [customizedRoomDataSource.roomState stateEventsWithType:kMXEventTypeStringRoomTombStone].lastObject;
|
||||||
|
NSString *viaSenderServer = [MXTools serverNameInMatrixIdentifier:stoneTombEvent.sender];
|
||||||
|
|
||||||
NSString *replacementRoomId = customizedRoomDataSource.roomState.tombStoneContent.replacementRoomId;
|
NSString *replacementRoomId = customizedRoomDataSource.roomState.tombStoneContent.replacementRoomId;
|
||||||
NSString *roomLinkFragment = [NSString stringWithFormat:@"/room/%@", [MXTools encodeURIComponent:replacementRoomId]];
|
NSString *roomLinkFragment = [NSString stringWithFormat:@"/room/%@?via=%@",
|
||||||
|
[MXTools encodeURIComponent:replacementRoomId],
|
||||||
|
viaSenderServer
|
||||||
|
];
|
||||||
|
|
||||||
[roomActivitiesView displayRoomReplacementWithRoomLinkTappedHandler:^{
|
[roomActivitiesView displayRoomReplacementWithRoomLinkTappedHandler:^{
|
||||||
[[AppDelegate theDelegate] handleUniversalLinkFragment:roomLinkFragment];
|
[[AppDelegate theDelegate] handleUniversalLinkFragment:roomLinkFragment];
|
||||||
|
|
Loading…
Reference in a new issue