TabBarCoordinator: Add sanity checks before adding or removing Matrix session from MasterTabBarController.

This commit is contained in:
SBiOSoftWhare
2021-05-26 21:02:41 +02:00
parent cb5eea2452
commit 7d7e98eb9d
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -47,7 +47,7 @@
@property (weak, nonatomic) id<MasterTabBarControllerDelegate> masterTabBarDelegate;
// Associated matrix sessions (empty by default).
@property (nonatomic, readonly) NSArray *mxSessions;
@property (nonatomic, readonly) NSArray<MXSession*> *mxSessions;
// Add a matrix session. This session is propagated to all view controllers handled by the tab bar controller.
- (void)addMatrixSession:(MXSession*)mxSession;
+2 -2
View File
@@ -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)
}
}