Skip to content

Commit c237ccd

Browse files
committed
[trello.com/c/aZtAfZ44] fix select row when we enter the chat via popup
1 parent 77164d9 commit c237ccd

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

Adamant/Modules/ChatsList/ChatListViewController.swift

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,7 @@ extension ChatListViewController {
973973
) { [weak self] in
974974
guard let self else { return }
975975

976+
self.updateSelectedRow(chatroom: chatroom)
976977
self.presentChatroom(chatroom, with: transaction.chatMessageId)
977978
}
978979
}
@@ -1602,13 +1603,7 @@ extension ChatListViewController: UISearchBarDelegate, UISearchResultsUpdating,
16021603
return
16031604
}
16041605

1605-
if let indexPath = tableView.indexPathForSelectedRow {
1606-
tableView.deselectRow(at: indexPath, animated: true)
1607-
}
1608-
1609-
if let indexPath = self?.chatsController?.indexPath(forObject: chatroom) {
1610-
tableView.selectRow(at: indexPath, animated: true, scrollPosition: .none)
1611-
}
1606+
self?.updateSelectedRow(chatroom: chatroom)
16121607

16131608
presenter.presentChatroom(chatroom, with: message.transactionId)
16141609
}
@@ -1620,13 +1615,7 @@ extension ChatListViewController: UISearchBarDelegate, UISearchResultsUpdating,
16201615
return
16211616
}
16221617

1623-
if let indexPath = tableView.indexPathForSelectedRow {
1624-
tableView.deselectRow(at: indexPath, animated: true)
1625-
}
1626-
1627-
if let indexPath = self?.chatsController?.indexPath(forObject: chatroom) {
1628-
tableView.selectRow(at: indexPath, animated: true, scrollPosition: .none)
1629-
}
1618+
self?.updateSelectedRow(chatroom: chatroom)
16301619

16311620
presenter.presentChatroom(chatroom)
16321621
}
@@ -1636,6 +1625,15 @@ extension ChatListViewController: UISearchBarDelegate, UISearchResultsUpdating,
16361625
account.chatroom?.isForcedVisible = true
16371626
newChatController(didSelectAccount: account, preMessage: nil, name: nil)
16381627
}
1628+
1629+
func updateSelectedRow(chatroom: Chatroom) {
1630+
if let indexPath = tableView.indexPathForSelectedRow {
1631+
tableView.deselectRow(at: indexPath, animated: true)
1632+
}
1633+
if let indexPath = self.chatsController?.indexPath(forObject: chatroom) {
1634+
tableView.selectRow(at: indexPath, animated: true, scrollPosition: .none)
1635+
}
1636+
}
16391637
}
16401638

16411639
// MARK: Mac OS HotKeys

0 commit comments

Comments
 (0)