diff --git a/Riot/Modules/TabBar/MasterTabBarController.h b/Riot/Modules/TabBar/MasterTabBarController.h index 34562488f..6ef661948 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.h +++ b/Riot/Modules/TabBar/MasterTabBarController.h @@ -47,7 +47,7 @@ @property (weak, nonatomic) id masterTabBarDelegate; // Associated matrix sessions (empty by default). -@property (nonatomic, readonly) NSArray *mxSessions; +@property (nonatomic, readonly) NSArray *mxSessions; // Add a matrix session. This session is propagated to all view controllers handled by the tab bar controller. - (void)addMatrixSession:(MXSession*)mxSession; diff --git a/Riot/Modules/TabBar/TabBarCoordinator.swift b/Riot/Modules/TabBar/TabBarCoordinator.swift index 70d4af71c..9966e3f07 100644 --- a/Riot/Modules/TabBar/TabBarCoordinator.swift +++ b/Riot/Modules/TabBar/TabBarCoordinator.swift @@ -289,7 +289,7 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { } // TODO: Remove Matrix session handling from the view controller - if let matrixSession = userSession.matrixSession { + if let matrixSession = userSession.matrixSession, self.masterTabBarController.mxSessions.contains(matrixSession) { self.masterTabBarController.removeMatrixSession(matrixSession) } } @@ -301,7 +301,7 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType { // TODO: Remove Matrix session handling from the view controller // MXSession is opened before set to MXKAccount, wait for account change to be sure is set at a moment - if let matrixSession = userSession.matrixSession { + if let matrixSession = userSession.matrixSession, self.masterTabBarController.mxSessions.contains(matrixSession) == false { self.masterTabBarController.addMatrixSession(matrixSession) } }