mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-03 14:46:56 +02:00
TabBarCoordinator: Add sanity checks before adding or removing Matrix session from MasterTabBarController.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user