Add a selectRoomWithId:andEventId:inMatrixSession: method with completion block on MasterTabController.

This commit is contained in:
SBiOSoftWhare 2018-08-27 17:14:28 +02:00
parent 8202523de4
commit 7a4a68a998
2 changed files with 30 additions and 2 deletions

View file

@ -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.

View file

@ -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;
}
@ -424,11 +433,20 @@
self->_selectedRoomDataSource = roomDataSource;
[self performSegueWithIdentifier:@"showRoomDetails" sender:self];
if (completion)
{
completion();
}
}];
}
else
{
[self releaseSelectedItem];
if (completion)
{
completion();
}
}
}