@@ -16,6 +16,13 @@ final class ChatTitleView: UIView {
1616
1717 weak var delegate : ChatTitleViewProtocol ?
1818
19+ @IBOutlet weak var viewStatus : UIView ! {
20+ didSet {
21+ viewStatus. backgroundColor = . clear
22+ viewStatus. layer. cornerRadius = 4.5
23+ }
24+ }
25+
1926 @IBOutlet weak var titleLabel : UILabel !
2027 @IBOutlet weak var titleImage : UIImageView !
2128 @IBOutlet weak var showInfoImage : UIImageView !
@@ -31,6 +38,7 @@ final class ChatTitleView: UIView {
3138 }
3239
3340 set {
41+ viewStatus. isHidden = newValue
3442 titleLabel. isHidden = newValue
3543 titleImage. isHidden = newValue
3644 showInfoImage. isHidden = newValue
@@ -39,6 +47,7 @@ final class ChatTitleView: UIView {
3947
4048 var state : SocketConnectionState = SocketManager . sharedInstance. state {
4149 didSet {
50+ updateTitleState ( )
4251 updateConnectionState ( )
4352 }
4453 }
@@ -56,12 +65,28 @@ final class ChatTitleView: UIView {
5665 didSet {
5766 guard let subscription = subscription else { return }
5867 viewModel. subscription = subscription
59- titleLabel. text = viewModel. title
6068
69+ DispatchQueue . main. async {
70+ self . updateTitleState ( )
71+ self . updateConnectionState ( )
72+ }
73+ }
74+ }
75+
76+ internal func updateTitleState( ) {
77+ guard let subscription = viewModel. subscription else { return }
78+
79+ titleLabel. text = viewModel. title
80+
81+ if subscription. type == . directMessage {
82+ titleImage. isHidden = true
83+ viewStatus. backgroundColor = viewModel. iconColor
84+ viewStatus. isHidden = false
85+ } else {
86+ titleImage. isHidden = false
6187 let image = UIImage ( named: viewModel. imageName) ? . imageWithTint ( viewModel. iconColor)
6288 titleImage. image = image
63-
64- updateConnectionState ( )
89+ viewStatus. isHidden = true
6590 }
6691 }
6792
0 commit comments