Browse Source

hide search button in case the user cannot write

cyberta 2 years ago
parent
commit
54d66bd476

+ 1 - 0
deltachat-ios/Controller/ContactDetailViewController.swift

@@ -300,6 +300,7 @@ class ContactDetailViewController: UITableViewController {
             headerCell.setMuted(isMuted: viewModel.chatIsMuted)
             headerCell.showMuteButton(show: true)
         }
+        headerCell.showSearchButton(show: viewModel.chatCanSend)
     }
 
     private func updateCellValues() {

+ 1 - 0
deltachat-ios/Controller/GroupChatDetailViewController.swift

@@ -336,6 +336,7 @@ class GroupChatDetailViewController: UIViewController {
         }
         groupHeader.setVerified(isVerified: chat.isProtected)
         groupHeader.setMuted(isMuted: chat.isMuted)
+        groupHeader.showSearchButton(show: chat.canSend)
     }
 
     private func updateEphemeralTimerCellValue() {

+ 4 - 0
deltachat-ios/ViewModel/ContactDetailViewModel.swift

@@ -109,6 +109,10 @@ class ContactDetailViewModel {
         return chatId != 0 && context.getChat(chatId: chatId).isArchived
     }
 
+    var chatCanSend: Bool {
+        return chatId != 0 && context.getChat(chatId: chatId).canSend
+    }
+
     var chatIsMuted: Bool {
         return chatId != 0 && context.getChat(chatId: chatId).isMuted
     }