mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 07:42:40 +00:00
Add a selectRoomWithId:andEventId:inMatrixSession: method with completion block on MasterTabController.
This commit is contained in:
parent
8202523de4
commit
7a4a68a998
2 changed files with 30 additions and 2 deletions
|
@ -72,6 +72,16 @@
|
|||
*/
|
||||
- (void)selectRoomWithId:(NSString*)roomId andEventId:(NSString*)eventId inMatrixSession:(MXSession*)mxSession;
|
||||
|
||||
/**
|
||||
Open the room with the provided identifier in a specific matrix session.
|
||||
|
||||
@param roomId the room identifier.
|
||||
@param eventId if not nil, the room will be opened on this event.
|
||||
@param mxSession the matrix session in which the room should be available.
|
||||
@param completion the block to execute at the end of the operation.
|
||||
*/
|
||||
- (void)selectRoomWithId:(NSString*)roomId andEventId:(NSString*)eventId inMatrixSession:(MXSession*)matrixSession completion:(void (^)(void))completion;
|
||||
|
||||
/**
|
||||
Open the RoomViewController to display the preview of a room that is unknown for the user.
|
||||
|
||||
|
|
|
@ -401,12 +401,21 @@
|
|||
}
|
||||
|
||||
- (void)selectRoomWithId:(NSString*)roomId andEventId:(NSString*)eventId inMatrixSession:(MXSession*)matrixSession
|
||||
{
|
||||
[self selectRoomWithId:roomId andEventId:eventId inMatrixSession:matrixSession completion:nil];
|
||||
}
|
||||
|
||||
- (void)selectRoomWithId:(NSString*)roomId andEventId:(NSString*)eventId inMatrixSession:(MXSession*)matrixSession completion:(void (^)(void))completion
|
||||
{
|
||||
if (_selectedRoomId && [_selectedRoomId isEqualToString:roomId]
|
||||
&& _selectedEventId && [_selectedEventId isEqualToString:eventId]
|
||||
&& _selectedRoomSession && _selectedRoomSession == matrixSession)
|
||||
{
|
||||
// Nothing to do
|
||||
if (completion)
|
||||
{
|
||||
completion();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -420,15 +429,24 @@
|
|||
MXWeakify(self);
|
||||
[self dataSourceOfRoomToDisplay:^(MXKRoomDataSource *roomDataSource) {
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
|
||||
|
||||
self->_selectedRoomDataSource = roomDataSource;
|
||||
|
||||
|
||||
[self performSegueWithIdentifier:@"showRoomDetails" sender:self];
|
||||
|
||||
if (completion)
|
||||
{
|
||||
completion();
|
||||
}
|
||||
}];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self releaseSelectedItem];
|
||||
if (completion)
|
||||
{
|
||||
completion();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue