|
@@ -446,12 +446,14 @@ class ChatListController: UITableViewController {
|
|
|
|
|
|
let archiveAction = UITableViewRowAction(style: .destructive, title: archiveActionTitle) { [weak self] _, _ in
|
|
|
self?.viewModel?.archiveChatToggle(chatId: chatId)
|
|
|
+ self?.setEditing(false, animated: true)
|
|
|
}
|
|
|
archiveAction.backgroundColor = UIColor.lightGray
|
|
|
|
|
|
let pinned = chat.visibility==DC_CHAT_VISIBILITY_PINNED
|
|
|
let pinAction = UITableViewRowAction(style: .destructive, title: String.localized(pinned ? "unpin" : "pin")) { [weak self] _, _ in
|
|
|
self?.viewModel?.pinChatToggle(chatId: chat.id)
|
|
|
+ self?.setEditing(false, animated: true)
|
|
|
}
|
|
|
pinAction.backgroundColor = UIColor.systemGreen
|
|
|
|
|
@@ -465,12 +467,12 @@ class ChatListController: UITableViewController {
|
|
|
|
|
|
override func setEditing(_ editing: Bool, animated: Bool) {
|
|
|
super.setEditing(editing, animated: animated)
|
|
|
+ tableView.setEditing(editing, animated: animated)
|
|
|
viewModel?.setEditing(editing)
|
|
|
}
|
|
|
|
|
|
func setLongTapEditing(_ editing: Bool, initialIndexPath: [IndexPath]? = nil) {
|
|
|
- tableView.setEditing(editing, animated: true)
|
|
|
- viewModel?.setEditing(editing)
|
|
|
+ setEditing(editing, animated: true)
|
|
|
if editing {
|
|
|
addEditingView()
|
|
|
if let viewModel = viewModel {
|
|
@@ -555,8 +557,8 @@ class ChatListController: UITableViewController {
|
|
|
}
|
|
|
|
|
|
func handleChatListUpdate() {
|
|
|
- if tableView.isEditing {
|
|
|
- viewModel?.setPendingChatListUpdate()
|
|
|
+ if let viewModel = viewModel, viewModel.isEditing {
|
|
|
+ viewModel.setPendingChatListUpdate()
|
|
|
return
|
|
|
}
|
|
|
if Thread.isMainThread {
|