Эх сурвалжийг харах

Merge pull request #1354 from deltachat/badge_counter_archived_chat

fix app badge counter taking archived messages into account
bjoern 3 жил өмнө
parent
commit
1ed2624aab

+ 1 - 2
deltachat-ios/Chat/ChatViewController.swift

@@ -526,12 +526,11 @@ class ChatViewController: UITableViewController {
     }
     }
     
     
     func handleUserVisibility(isVisible: Bool) {
     func handleUserVisibility(isVisible: Bool) {
+        isVisibleToUser = isVisible
         if isVisible {
         if isVisible {
-            isVisibleToUser = true
             startTimer()
             startTimer()
             markSeenMessagesInVisibleArea()
             markSeenMessagesInVisibleArea()
         } else {
         } else {
-            isVisibleToUser = false
             stopTimer()
             stopTimer()
             draft.save(context: dcContext)
             draft.save(context: dcContext)
         }
         }

+ 1 - 1
deltachat-ios/ViewModel/ChatListViewModel.swift

@@ -183,10 +183,10 @@ class ChatListViewModel: NSObject {
     func archiveChatToggle(chatId: Int) {
     func archiveChatToggle(chatId: Int) {
         let chat = dcContext.getChat(chatId: chatId)
         let chat = dcContext.getChat(chatId: chatId)
         let isArchivedBefore = chat.isArchived
         let isArchivedBefore = chat.isArchived
+        dcContext.archiveChat(chatId: chatId, archive: !isArchivedBefore)
         if !isArchivedBefore {
         if !isArchivedBefore {
             NotificationManager.removeNotificationsForChat(dcContext: dcContext, chatId: chatId)
             NotificationManager.removeNotificationsForChat(dcContext: dcContext, chatId: chatId)
         }
         }
-        dcContext.archiveChat(chatId: chatId, archive: !isArchivedBefore)
         updateChatList(notifyListener: false)
         updateChatList(notifyListener: false)
     }
     }