Merge pull request #2391 from vector-im/fix_room_details_navigation

Fix room details navigation
This commit is contained in:
SBiOSoftWhare 2019-04-29 16:08:52 +02:00 committed by GitHub
commit f94060b7ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 9 deletions

View file

@ -145,7 +145,9 @@ extern NSString *const kAppDelegateNetworkStatusDidChangeNotification;
#pragma mark - Matrix Room handling
// Show a room and jump to the given event if event id is not nil otherwise go to last messages.
- (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession completion:(void (^)(void))completion;
- (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession restoreInitialDisplay:(BOOL)restoreInitialDisplay completion:(void (^)(void))completion;
- (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession restoreInitialDisplay:(BOOL)restoreInitialDisplay;
- (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession;

View file

@ -3587,10 +3587,9 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
#pragma mark - Matrix Rooms handling
- (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession completion:(void (^)(void))completion
- (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession restoreInitialDisplay:(BOOL)restoreInitialDisplay completion:(void (^)(void))completion
{
[self restoreInitialDisplay:^{
void (^selectRoom)(void) = ^() {
// Select room to display its details (dispatch this action in order to let TabBarController end its refresh)
[self.masterTabBarController selectRoomWithId:roomId andEventId:eventId inMatrixSession:mxSession completion:^{
@ -3602,12 +3601,28 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
completion();
}
}];
};
if (restoreInitialDisplay)
{
[self restoreInitialDisplay:^{
selectRoom();
}];
}
else
{
selectRoom();
}
}
- (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession restoreInitialDisplay:(BOOL)restoreInitialDisplay
{
[self showRoom:roomId andEventId:eventId withMatrixSession:mxSession restoreInitialDisplay:restoreInitialDisplay completion:nil];
}
- (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession
{
[self showRoom:roomId andEventId:eventId withMatrixSession:mxSession completion:nil];
[self showRoom:roomId andEventId:eventId withMatrixSession:mxSession restoreInitialDisplay:YES completion:nil];
}
- (void)showRoomPreview:(RoomPreviewData*)roomPreviewData

View file

@ -760,7 +760,7 @@
// Avoid multiple openings of rooms
self.userInteractionEnabled = NO;
[[AppDelegate theDelegate] showRoom:roomId andEventId:nil withMatrixSession:matrixSession completion:^{
[[AppDelegate theDelegate] showRoom:roomId andEventId:nil withMatrixSession:matrixSession restoreInitialDisplay:NO completion:^{
self.userInteractionEnabled = YES;
}];
}

View file

@ -233,7 +233,7 @@
- (void)openRoomWithId:(NSString*)roomId inMatrixSession:(MXSession*)mxSession
{
[[AppDelegate theDelegate] showRoom:roomId andEventId:nil withMatrixSession:mxSession];
[[AppDelegate theDelegate] showRoom:roomId andEventId:nil withMatrixSession:mxSession restoreInitialDisplay:NO];
}
- (void)refreshCurrentSelectedCell:(BOOL)forceVisible

View file

@ -260,7 +260,7 @@
if ([recentsDataSource.publicRoomsDirectoryDataSource.mxSession roomWithRoomId:publicRoom.roomId])
{
// Open the public room
[[AppDelegate theDelegate] showRoom:publicRoom.roomId andEventId:nil withMatrixSession:recentsDataSource.publicRoomsDirectoryDataSource.mxSession];
[[AppDelegate theDelegate] showRoom:publicRoom.roomId andEventId:nil withMatrixSession:recentsDataSource.publicRoomsDirectoryDataSource.mxSession restoreInitialDisplay:NO];
}
else
{