mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
TabBarCoordinator: Prepare space switching.
This commit is contained in:
parent
20670812b8
commit
4a7ebd2bec
2 changed files with 34 additions and 12 deletions
|
@ -50,6 +50,8 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
|
|||
private let navigationRouter: NavigationRouterType
|
||||
private let masterNavigationController: UINavigationController
|
||||
|
||||
private var currentSpaceId: String?
|
||||
|
||||
// MARK: Public
|
||||
|
||||
// Must be used only internally
|
||||
|
@ -72,6 +74,14 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
|
|||
// MARK: - Public methods
|
||||
|
||||
func start() {
|
||||
self.start(with: nil)
|
||||
}
|
||||
|
||||
func start(with spaceId: String?) {
|
||||
self.currentSpaceId = spaceId
|
||||
|
||||
// If start has been done once do setup view controllers again
|
||||
if self.masterTabBarController == nil {
|
||||
let masterTabBarController = self.createMasterTabBarController()
|
||||
masterTabBarController.masterTabBarDelegate = self
|
||||
self.masterTabBarController = masterTabBarController
|
||||
|
@ -89,6 +99,10 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
|
|||
self.registerUserSessionsServiceNotifications()
|
||||
}
|
||||
|
||||
// Update masterNavigationController.navigationItem.titleView
|
||||
self.updateMasterNavigationBarTitleView(with: spaceId)
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
return self.navigationRouter.toPresentable()
|
||||
}
|
||||
|
@ -250,6 +264,10 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
|
|||
self.parameters.appNavigator.sideMenu.addPanGestureToPresent(to: self.masterNavigationController.navigationBar)
|
||||
}
|
||||
|
||||
private func updateMasterNavigationBarTitleView(with spaceId: String?) {
|
||||
// TODO: Update masterNavigationController title view with new space info
|
||||
}
|
||||
|
||||
// MARK: Navigation
|
||||
|
||||
private func showSideMenu() {
|
||||
|
|
|
@ -28,6 +28,10 @@ protocol TabBarCoordinatorType: Coordinator, SplitViewMasterPresentable {
|
|||
|
||||
var delegate: TabBarCoordinatorDelegate? { get }
|
||||
|
||||
/// Start coordinator by selecting a Space.
|
||||
/// - Parameter spaceId: The id of the Space to use.
|
||||
func start(with spaceId: String?)
|
||||
|
||||
func popToHome(animated: Bool, completion: (() -> Void)?)
|
||||
|
||||
// TODO: Remove this method, this implementation detail should not be exposed
|
||||
|
|
Loading…
Reference in a new issue