|
@@ -42,7 +42,7 @@ class ChatListViewModel: NSObject {
|
|
|
private var searchResultSections: [ChatListSectionType] = []
|
|
|
|
|
|
private var isChatListUpdatePending = false
|
|
|
- private var isEditing = false
|
|
|
+ private(set) var isEditing = false
|
|
|
|
|
|
init(dcContext: DcContext, isArchive: Bool) {
|
|
|
self.isArchive = isArchive
|
|
@@ -228,25 +228,25 @@ class ChatListViewModel: NSObject {
|
|
|
INInteraction.delete(with: ["\(dcContext.id).\(chatId)"])
|
|
|
}
|
|
|
|
|
|
- func archiveChatToggle(chatId: Int) {
|
|
|
+ func archiveChatToggle(chatId: Int, notifyListener: Bool = false) {
|
|
|
let chat = dcContext.getChat(chatId: chatId)
|
|
|
let isArchivedBefore = chat.isArchived
|
|
|
dcContext.archiveChat(chatId: chatId, archive: !isArchivedBefore)
|
|
|
if !isArchivedBefore {
|
|
|
NotificationManager.removeNotificationsForChat(dcContext: dcContext, chatId: chatId)
|
|
|
}
|
|
|
- updateChatList(notifyListener: false)
|
|
|
+ updateChatList(notifyListener: notifyListener)
|
|
|
}
|
|
|
|
|
|
- func pinChatToggle(chatId: Int) {
|
|
|
+ func pinChatToggle(chatId: Int, notifyListerner: Bool = false) {
|
|
|
let chat: DcChat = dcContext.getChat(chatId: chatId)
|
|
|
let pinned = chat.visibility == DC_CHAT_VISIBILITY_PINNED
|
|
|
- pinChat(chatId: chatId, pinned: pinned)
|
|
|
+ pinChat(chatId: chatId, pinned: pinned, notifyListener: notifyListerner)
|
|
|
}
|
|
|
|
|
|
- func pinChat(chatId: Int, pinned: Bool) {
|
|
|
+ func pinChat(chatId: Int, pinned: Bool, notifyListener: Bool = false) {
|
|
|
self.dcContext.setChatVisibility(chatId: chatId, visibility: pinned ? DC_CHAT_VISIBILITY_NORMAL : DC_CHAT_VISIBILITY_PINNED)
|
|
|
- updateChatList(notifyListener: false)
|
|
|
+ updateChatList(notifyListener: notifyListener)
|
|
|
}
|
|
|
|
|
|
func hasOnlyPinnedChatsSelected(in indexPaths: [IndexPath]?) -> Bool {
|