Przeglądaj źródła

Merge pull request #804 from deltachat/visual_feedback

ChatList - add visual feedback when cell tapped
cyBerta 5 lat temu
rodzic
commit
a7bbaabce9

+ 2 - 1
deltachat-ios/Controller/ChatListController.swift

@@ -222,7 +222,7 @@ class ChatListController: UITableViewController {
         return viewModel.titleForHeaderIn(section: section)
     }
 
-    override func tableView(_: UITableView, didSelectRowAt indexPath: IndexPath) {
+    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
         let cellData = viewModel.cellDataFor(section: indexPath.section, row: indexPath.row)
         switch cellData.type {
         case .deaddrop(let deaddropData):
@@ -243,6 +243,7 @@ class ChatListController: UITableViewController {
                 self.askToChatWith(contactId: contactId)
             }
         }
+        tableView.deselectRow(at: indexPath, animated: false)
     }
 
     override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {

+ 1 - 6
deltachat-ios/View/ContactCell.swift

@@ -134,10 +134,8 @@ class ContactCell: UITableViewCell {
 
     override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
         super.init(style: style, reuseIdentifier: reuseIdentifier)
-        selectionStyle = .none
-        backgroundColor = DcColors.contactCellBackgroundColor
-        contentView.backgroundColor = DcColors.contactCellBackgroundColor
         setupSubviews()
+        selectionStyle = .default
     }
 
     required init?(coder: NSCoder) {
@@ -254,7 +252,6 @@ class ContactCell: UITableViewCell {
         case .deaddrop(let deaddropData):
             safe_assert(deaddropData.chatId == DC_CHAT_ID_DEADDROP)
             backgroundColor = DcColors.deaddropBackground
-            contentView.backgroundColor = DcColors.deaddropBackground
             let contact = DcContact(id: DcMsg(id: deaddropData.msgId).fromContactId)
             if let img = contact.profileImage {
                 resetBackupImage()
@@ -276,10 +273,8 @@ class ContactCell: UITableViewCell {
             }
             if chat.visibility == DC_CHAT_VISIBILITY_PINNED {
                 backgroundColor = DcColors.deaddropBackground
-                contentView.backgroundColor = DcColors.deaddropBackground
             } else {
                 backgroundColor = DcColors.contactCellBackgroundColor
-                contentView.backgroundColor = DcColors.contactCellBackgroundColor
             }
             if let img = chat.profileImage {
                 resetBackupImage()