@@ -1002,6 +1002,7 @@ extension ChatListViewController {
1002
1002
1003
1003
@MainActor
1004
1004
func presentChatroom( _ chatroom: Chatroom , with message: String ? = nil ) {
1005
+ defer { updateSelectedRow ( chatroom: chatroom) }
1005
1006
// MARK: 1. Create and config ViewController
1006
1007
let vc = chatViewController ( for: chatroom, with: message)
1007
1008
@@ -1625,14 +1626,6 @@ extension ChatListViewController: UISearchBarDelegate, UISearchResultsUpdating,
1625
1626
return
1626
1627
}
1627
1628
1628
- if let indexPath = tableView. indexPathForSelectedRow {
1629
- tableView. deselectRow ( at: indexPath, animated: true )
1630
- }
1631
-
1632
- if let indexPath = self ? . chatsController? . indexPath ( forObject: chatroom) {
1633
- tableView. selectRow ( at: indexPath, animated: true , scrollPosition: . none)
1634
- }
1635
-
1636
1629
presenter. presentChatroom ( chatroom, with: message. transactionId)
1637
1630
}
1638
1631
}
@@ -1643,14 +1636,6 @@ extension ChatListViewController: UISearchBarDelegate, UISearchResultsUpdating,
1643
1636
return
1644
1637
}
1645
1638
1646
- if let indexPath = tableView. indexPathForSelectedRow {
1647
- tableView. deselectRow ( at: indexPath, animated: true )
1648
- }
1649
-
1650
- if let indexPath = self ? . chatsController? . indexPath ( forObject: chatroom) {
1651
- tableView. selectRow ( at: indexPath, animated: true , scrollPosition: . none)
1652
- }
1653
-
1654
1639
presenter. presentChatroom ( chatroom)
1655
1640
}
1656
1641
}
@@ -1659,6 +1644,15 @@ extension ChatListViewController: UISearchBarDelegate, UISearchResultsUpdating,
1659
1644
account. chatroom? . isForcedVisible = true
1660
1645
newChatController ( didSelectAccount: account, preMessage: nil , name: nil )
1661
1646
}
1647
+
1648
+ func updateSelectedRow( chatroom: Chatroom ) {
1649
+ if let indexPath = tableView. indexPathForSelectedRow {
1650
+ tableView. deselectRow ( at: indexPath, animated: true )
1651
+ }
1652
+ if let indexPath = self . chatsController? . indexPath ( forObject: chatroom) {
1653
+ tableView. selectRow ( at: indexPath, animated: true , scrollPosition: . none)
1654
+ }
1655
+ }
1662
1656
}
1663
1657
1664
1658
// MARK: Mac OS HotKeys
0 commit comments