Merge pull request #383 from vector-im/pop2home

Bug Fix: Room view controller is destroyed whereas it is still visible.
This commit is contained in:
giomfo 2016-06-10 17:42:09 +02:00 committed by GitHub
commit 9f9c55d5f5

View file

@ -574,20 +574,6 @@ NSString *const kAppDelegateDidTapStatusBarNotification = @"kAppDelegateDidTapSt
_homeNavigationController.delegate = self;
[_homeNavigationController popToViewController:_homeViewController animated:animated];
// For unknown reason, the navigation bar is not restored correctly by [popToViewController:animated:]
// when a ViewController has hidden it (see MXKAttachmentsViewController).
// Patch: restore navigation bar by default here.
_homeNavigationController.navigationBarHidden = NO;
// For unknown reason, the default settings of the navigation bar are not restored correctly by [popToViewController:animated:]
// when a ViewController has changed them (see RoomViewController, RoomMemberDetailsViewController).
// Patch: restore default settings here.
[_homeNavigationController.navigationBar setShadowImage:nil];
[_homeNavigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
// Release the current selected room
[_homeViewController closeSelectedRoom];
}
else
{
@ -609,6 +595,15 @@ NSString *const kAppDelegateDidTapStatusBarNotification = @"kAppDelegateDidTapSt
if (viewController == _homeViewController)
{
_homeNavigationController.delegate = nil;
// For unknown reason, the navigation bar is not restored correctly by [popToViewController:animated:]
// when a ViewController has hidden it (see MXKAttachmentsViewController).
// Patch: restore navigation bar by default here.
_homeNavigationController.navigationBarHidden = NO;
// Release the current selected room (if any).
[_homeViewController closeSelectedRoom];
if (popToHomeViewControllerCompletion)
{
void (^popToHomeViewControllerCompletion2)() = popToHomeViewControllerCompletion;