-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathChatHostViewController.swift
65 lines (56 loc) · 2.99 KB
/
ChatHostViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// ChatHostViewController.swift
// ChatApp
//
// Created by Florian Marcu on 8/18/18.
// Copyright © 2018 Instamobile. All rights reserved.
//
import UIKit
class ChatHostViewController: UIViewController, UITabBarControllerDelegate {
let homeVC: UIViewController
let uiConfig: ATCUIGenericConfigurationProtocol
init(uiConfig: ATCUIGenericConfigurationProtocol,
threadsDataSource: ATCGenericCollectionViewControllerDataSource,
viewer: ATCUser) {
self.uiConfig = uiConfig
self.homeVC = ATCChatHomeViewController.homeVC(uiConfig: uiConfig, threadsDataSource: threadsDataSource, viewer: viewer)
super.init(nibName: nil, bundle: nil)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
lazy var hostController: ATCHostViewController = { [unowned self] in
let menuItems: [ATCNavigationItem] = [
ATCNavigationItem(title: "Home",
viewController: homeVC,
image: UIImage.localImage("bubbles-icon", template: true),
type: .viewController,
leftTopView: nil,
rightTopView: nil),
]
let menuConfiguration = ATCMenuConfiguration(user: nil,
cellClass: ATCCircledIconMenuCollectionViewCell.self,
headerHeight: 0,
items: menuItems,
uiConfig: ATCMenuUIConfiguration(itemFont: uiConfig.regularMediumFont,
tintColor: uiConfig.mainTextColor,
itemHeight: 45.0,
backgroundColor: uiConfig.mainThemeBackgroundColor))
let config = ATCHostConfiguration(menuConfiguration: menuConfiguration,
style: .tabBar,
topNavigationRightView: nil,
topNavigationLeftImage: UIImage.localImage("three-equal-lines-icon", template: true),
topNavigationTintColor: uiConfig.mainThemeForegroundColor,
statusBarStyle: uiConfig.statusBarStyle,
uiConfig: uiConfig)
return ATCHostViewController(configuration: config)
}()
override func viewDidLoad() {
super.viewDidLoad()
self.addChildViewControllerWithView(hostController)
hostController.view.backgroundColor = uiConfig.mainThemeBackgroundColor
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return uiConfig.statusBarStyle
}
}