From 783c6ab81025f313eb1a1d477a4f333c3c226172 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Mon, 27 Aug 2018 17:14:28 +0200 Subject: [PATCH 1/2] Add a selectRoomWithId:andEventId:inMatrixSession: method with completion block on MasterTabController. --- Riot/Modules/TabBar/MasterTabBarController.h | 10 +++++++++ Riot/Modules/TabBar/MasterTabBarController.m | 22 ++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Riot/Modules/TabBar/MasterTabBarController.h b/Riot/Modules/TabBar/MasterTabBarController.h index d627151b4..2a5f59710 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.h +++ b/Riot/Modules/TabBar/MasterTabBarController.h @@ -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. diff --git a/Riot/Modules/TabBar/MasterTabBarController.m b/Riot/Modules/TabBar/MasterTabBarController.m index 74b7733bc..1190e2ee6 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.m +++ b/Riot/Modules/TabBar/MasterTabBarController.m @@ -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(); + } } } From d3ed99be349a87b02ec20dfeaaeaa157d447d099 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Mon, 27 Aug 2018 17:15:33 +0200 Subject: [PATCH 2/2] Fix interaction disabled on RecentsViewController when presenting a room. --- Riot/Modules/Common/Recents/RecentsViewController.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index 2b9615314..f0f54f16a 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -757,8 +757,10 @@ { // Avoid multiple openings of rooms self.userInteractionEnabled = NO; - - [[AppDelegate theDelegate].masterTabBarController selectRoomWithId:roomId andEventId:nil inMatrixSession:matrixSession]; + + [[AppDelegate theDelegate].masterTabBarController selectRoomWithId:roomId andEventId:nil inMatrixSession:matrixSession completion:^{ + self.userInteractionEnabled = YES; + }]; } // Disable UI interactions in this screen while we are going to open another screen.