|
@@ -106,24 +106,7 @@ class ChatViewController: MessagesViewController {
|
|
|
|
|
|
let chat = DcChat(id: chatId)
|
|
let chat = DcChat(id: chatId)
|
|
if showCustomNavBar {
|
|
if showCustomNavBar {
|
|
- let titleView = ChatTitleView()
|
|
|
|
-
|
|
|
|
- var subtitle = "ErrSubtitle"
|
|
|
|
- let chatContactIds = chat.contactIds
|
|
|
|
- if chat.isGroup {
|
|
|
|
- subtitle = String.localizedStringWithFormat(NSLocalizedString("n_members", comment: ""), chatContactIds.count)
|
|
|
|
- } else if chatContactIds.count >= 1 {
|
|
|
|
- if chat.isDeviceTalk {
|
|
|
|
- subtitle = String.localized("device_talk_subtitle")
|
|
|
|
- } else if chat.isSelfTalk {
|
|
|
|
- subtitle = String.localized("chat_self_talk_subtitle")
|
|
|
|
- } else {
|
|
|
|
- subtitle = DcContact(id: chatContactIds[0]).email
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- titleView.updateTitleView(title: chat.name, subtitle: subtitle)
|
|
|
|
- navigationItem.titleView = titleView
|
|
|
|
|
|
+ updateTitle(chat: chat)
|
|
|
|
|
|
let badge: InitialsBadge
|
|
let badge: InitialsBadge
|
|
if let image = chat.profileImage {
|
|
if let image = chat.profileImage {
|
|
@@ -155,6 +138,9 @@ class ChatViewController: MessagesViewController {
|
|
self.refreshMessages()
|
|
self.refreshMessages()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (self.showCustomNavBar) {
|
|
|
|
+ self.updateTitle(chat: chat)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -209,6 +195,26 @@ class ChatViewController: MessagesViewController {
|
|
audioController.stopAnyOngoingPlaying()
|
|
audioController.stopAnyOngoingPlaying()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private func updateTitle(chat: DcChat) {
|
|
|
|
+ let titleView = ChatTitleView()
|
|
|
|
+
|
|
|
|
+ var subtitle = "ErrSubtitle"
|
|
|
|
+ let chatContactIds = chat.contactIds
|
|
|
|
+ if chat.isGroup {
|
|
|
|
+ subtitle = String.localizedStringWithFormat(NSLocalizedString("n_members", comment: ""), chatContactIds.count)
|
|
|
|
+ } else if chatContactIds.count >= 1 {
|
|
|
|
+ if chat.isDeviceTalk {
|
|
|
|
+ subtitle = String.localized("device_talk_subtitle")
|
|
|
|
+ } else if chat.isSelfTalk {
|
|
|
|
+ subtitle = String.localized("chat_self_talk_subtitle")
|
|
|
|
+ } else {
|
|
|
|
+ subtitle = DcContact(id: chatContactIds[0]).email
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ titleView.updateTitleView(title: chat.name, subtitle: subtitle)
|
|
|
|
+ navigationItem.titleView = titleView
|
|
|
|
+ }
|
|
|
|
+
|
|
@objc
|
|
@objc
|
|
private func loadMoreMessages() {
|
|
private func loadMoreMessages() {
|
|
DispatchQueue.global(qos: .userInitiated).asyncAfter(deadline: .now() + 1) {
|
|
DispatchQueue.global(qos: .userInitiated).asyncAfter(deadline: .now() + 1) {
|