瀏覽代碼

Merge pull request #1893 from deltachat/disable_mark_as_read_button_if_it_has_no_effect

disable "mark all read" button when it does nothing
Simon Laux 1 年之前
父節點
當前提交
6f417bb746
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      deltachat-ios/Controller/ChatListController.swift

+ 8 - 0
deltachat-ios/Controller/ChatListController.swift

@@ -661,6 +661,7 @@ class ChatListController: UITableViewController {
                 navigationItem.setLeftBarButton(nil, animated: true)
                 navigationItem.setRightBarButton(markArchivedReadButton, animated: true)
             }
+            updateMarkArchivedReadButton()
         } else {
             titleView.text = DcUtils.getConnectivityString(dcContext: dcContext, connectedString: String.localized("pref_chats"))
             if !handleMultiSelectionTitle() {
@@ -703,6 +704,13 @@ class ChatListController: UITableViewController {
                 self.handleEmptyStateLabel()
             }
         }
+        if isArchive {
+            updateMarkArchivedReadButton()
+        }
+    }
+    
+    func updateMarkArchivedReadButton(){
+        self.markArchivedReadButton.isEnabled = dcContext.getUnreadMessages(chatId: Int(DC_CHAT_ID_ARCHIVED_LINK)) != 0
     }
 
     private func handleEmptyStateLabel() {