|
@@ -20,7 +20,7 @@ class GroupChatDetailViewController: UIViewController {
|
|
private let context: DcContext
|
|
private let context: DcContext
|
|
weak var coordinator: GroupChatDetailCoordinator?
|
|
weak var coordinator: GroupChatDetailCoordinator?
|
|
|
|
|
|
- private let sections: [ProfileSections] = [.attachments, .memberManagement, .members, .chatActions]
|
|
|
|
|
|
+ private let sections: [ProfileSections] = [.memberManagement, .attachments, .members, .chatActions]
|
|
|
|
|
|
private var currentUser: DcContact? {
|
|
private var currentUser: DcContact? {
|
|
let myId = groupMemberIds.filter { DcContact(id: $0).email == DcConfig.addr }.first
|
|
let myId = groupMemberIds.filter { DcContact(id: $0).email == DcConfig.addr }.first
|
|
@@ -71,7 +71,7 @@ class GroupChatDetailViewController: UIViewController {
|
|
private lazy var archiveChatCell: ActionCell = {
|
|
private lazy var archiveChatCell: ActionCell = {
|
|
let cell = ActionCell()
|
|
let cell = ActionCell()
|
|
cell.actionTitle = chat.isArchived ? String.localized("menu_unarchive_chat") : String.localized("menu_archive_chat")
|
|
cell.actionTitle = chat.isArchived ? String.localized("menu_unarchive_chat") : String.localized("menu_archive_chat")
|
|
- cell.actionColor = SystemColor.blue.uiColor
|
|
|
|
|
|
+ cell.actionColor = UIColor.systemBlue
|
|
cell.selectionStyle = .none
|
|
cell.selectionStyle = .none
|
|
return cell
|
|
return cell
|
|
}()
|
|
}()
|
|
@@ -92,6 +92,22 @@ class GroupChatDetailViewController: UIViewController {
|
|
return cell
|
|
return cell
|
|
}()
|
|
}()
|
|
|
|
|
|
|
|
+ private lazy var galleryCell: ActionCell = {
|
|
|
|
+ let cell = ActionCell()
|
|
|
|
+ cell.actionTitle = String.localized("gallery")
|
|
|
|
+ cell.actionColor = UIColor.systemBlue
|
|
|
|
+ cell.selectionStyle = .none
|
|
|
|
+ return cell
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var documentsCell: ActionCell = {
|
|
|
|
+ let cell = ActionCell()
|
|
|
|
+ cell.actionTitle = String.localized("documents")
|
|
|
|
+ cell.actionColor = UIColor.systemBlue
|
|
|
|
+ cell.selectionStyle = .none
|
|
|
|
+ return cell
|
|
|
|
+ }()
|
|
|
|
+
|
|
init(chatId: Int, context: DcContext) {
|
|
init(chatId: Int, context: DcContext) {
|
|
self.context = context
|
|
self.context = context
|
|
chat = DcChat(id: chatId)
|
|
chat = DcChat(id: chatId)
|
|
@@ -197,16 +213,10 @@ extension GroupChatDetailViewController: UITableViewDelegate, UITableViewDataSou
|
|
let sectionType = sections[indexPath.section]
|
|
let sectionType = sections[indexPath.section]
|
|
switch sectionType {
|
|
switch sectionType {
|
|
case .attachments:
|
|
case .attachments:
|
|
- guard let actionCell = tableView.dequeueReusableCell(withIdentifier: "actionCell", for: indexPath) as? ActionCell else {
|
|
|
|
- safe_fatalError("could not dequeue action cell")
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
if row == attachmentsRowGallery {
|
|
if row == attachmentsRowGallery {
|
|
- actionCell.actionTitle = String.localized("gallery")
|
|
|
|
- actionCell.actionColor = UIColor.systemBlue
|
|
|
|
|
|
+ return galleryCell
|
|
} else if row == attachmentsRowDocuments {
|
|
} else if row == attachmentsRowDocuments {
|
|
- actionCell.actionTitle = String.localized("documents")
|
|
|
|
- actionCell.actionColor = UIColor.systemBlue
|
|
|
|
|
|
+ return documentsCell
|
|
}
|
|
}
|
|
case .memberManagement:
|
|
case .memberManagement:
|
|
guard let actionCell = tableView.dequeueReusableCell(withIdentifier: "actionCell", for: indexPath) as? ActionCell else {
|
|
guard let actionCell = tableView.dequeueReusableCell(withIdentifier: "actionCell", for: indexPath) as? ActionCell else {
|
|
@@ -279,10 +289,16 @@ extension GroupChatDetailViewController: UITableViewDelegate, UITableViewDataSou
|
|
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
|
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
|
if sections[section] == .members {
|
|
if sections[section] == .members {
|
|
return String.localized("tab_members")
|
|
return String.localized("tab_members")
|
|
|
|
+ } else if sections[section] == .attachments {
|
|
|
|
+ return String.localized("media")
|
|
}
|
|
}
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
|
|
|
+ return Constants.defaultHeaderHeight
|
|
|
|
+ }
|
|
|
|
+
|
|
func tableView(_: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
|
|
func tableView(_: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
|
|
guard let currentUser = self.currentUser else {
|
|
guard let currentUser = self.currentUser else {
|
|
return false
|
|
return false
|