|
@@ -9,8 +9,9 @@ class AppCoordinator {
|
|
private let window: UIWindow
|
|
private let window: UIWindow
|
|
private let dcAccounts: DcAccounts
|
|
private let dcAccounts: DcAccounts
|
|
private let qrTab = 0
|
|
private let qrTab = 0
|
|
- public let chatsTab = 1
|
|
|
|
- private let settingsTab = 2
|
|
|
|
|
|
+ public let allMediaTab = 1 // there are two enums, here and at AppStateRestorer (this is error prone and could probably be merged)
|
|
|
|
+ public let chatsTab = 2
|
|
|
|
+ private let settingsTab = 3
|
|
|
|
|
|
private let appStateRestorer = AppStateRestorer.shared
|
|
private let appStateRestorer = AppStateRestorer.shared
|
|
|
|
|
|
@@ -23,11 +24,12 @@ class AppCoordinator {
|
|
// MARK: - tabbar view handling
|
|
// MARK: - tabbar view handling
|
|
lazy var tabBarController: UITabBarController = {
|
|
lazy var tabBarController: UITabBarController = {
|
|
let qrNavController = createQrNavigationController()
|
|
let qrNavController = createQrNavigationController()
|
|
|
|
+ let allMediaNavController = createAllMediaNavigationController()
|
|
let chatsNavController = createChatsNavigationController()
|
|
let chatsNavController = createChatsNavigationController()
|
|
let settingsNavController = createSettingsNavigationController()
|
|
let settingsNavController = createSettingsNavigationController()
|
|
let tabBarController = UITabBarController()
|
|
let tabBarController = UITabBarController()
|
|
tabBarController.delegate = appStateRestorer
|
|
tabBarController.delegate = appStateRestorer
|
|
- tabBarController.viewControllers = [qrNavController, chatsNavController, settingsNavController]
|
|
|
|
|
|
+ tabBarController.viewControllers = [qrNavController, allMediaNavController, chatsNavController, settingsNavController]
|
|
tabBarController.tabBar.tintColor = DcColors.primary
|
|
tabBarController.tabBar.tintColor = DcColors.primary
|
|
return tabBarController
|
|
return tabBarController
|
|
}()
|
|
}()
|
|
@@ -40,6 +42,19 @@ class AppCoordinator {
|
|
return nav
|
|
return nav
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private func createAllMediaNavigationController() -> UINavigationController {
|
|
|
|
+ let root = QrPageController(dcAccounts: dcAccounts)
|
|
|
|
+ let nav = UINavigationController(rootViewController: root)
|
|
|
|
+ let settingsImage: UIImage?
|
|
|
|
+ if #available(iOS 16.0, *) {
|
|
|
|
+ settingsImage = UIImage(systemName: "photo.stack")
|
|
|
|
+ } else {
|
|
|
|
+ settingsImage = UIImage(named: "report_card") // TODO: if image is settled, add it to assets
|
|
|
|
+ }
|
|
|
|
+ nav.tabBarItem = UITabBarItem(title: String.localized("menu_all_media"), image: settingsImage, tag: chatsTab)
|
|
|
|
+ return nav
|
|
|
|
+ }
|
|
|
|
+
|
|
private func createChatsNavigationController() -> UINavigationController {
|
|
private func createChatsNavigationController() -> UINavigationController {
|
|
let root = ChatListController(dcContext: dcAccounts.getSelected(), dcAccounts: dcAccounts, isArchive: false)
|
|
let root = ChatListController(dcContext: dcAccounts.getSelected(), dcAccounts: dcAccounts, isArchive: false)
|
|
let nav = UINavigationController(rootViewController: root)
|
|
let nav = UINavigationController(rootViewController: root)
|
|
@@ -247,6 +262,7 @@ class AppCoordinator {
|
|
}
|
|
}
|
|
|
|
|
|
self.tabBarController.setViewControllers([createQrNavigationController(),
|
|
self.tabBarController.setViewControllers([createQrNavigationController(),
|
|
|
|
+ createAllMediaNavigationController(),
|
|
createChatsNavigationController(),
|
|
createChatsNavigationController(),
|
|
createSettingsNavigationController()], animated: false)
|
|
createSettingsNavigationController()], animated: false)
|
|
presentTabBarController()
|
|
presentTabBarController()
|