Skip to content

Commit

Permalink
cleanup: remove hacks around row selected too late (hacks were: assum…
Browse files Browse the repository at this point in the history
…ing 1 if selections is not started, checking different sets of selections wrt pinning)
  • Loading branch information
r10s committed Jul 4, 2024
1 parent 4b51e83 commit 6134570
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions deltachat-ios/Controller/ChatListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -574,13 +574,13 @@ class ChatListViewController: UITableViewController {
}
}

func setLongTapEditing(_ editing: Bool, initialIndexPath: [IndexPath]? = nil) {
func setLongTapEditing(_ editing: Bool, initialIndexPath: IndexPath? = nil) {
setEditing(editing, animated: true)
if editing {
tableView.selectRow(at: initialIndexPath, animated: true, scrollPosition: .none)
addEditingView()
if let viewModel = viewModel {
editingBar.showUnpinning = viewModel.hasOnlyPinnedChatsSelected(in: tableView.indexPathsForSelectedRows) ||
viewModel.hasOnlyPinnedChatsSelected(in: initialIndexPath)
editingBar.showUnpinning = viewModel.hasOnlyPinnedChatsSelected(in: tableView.indexPathsForSelectedRows)
}
} else {
removeEditingView()
Expand Down Expand Up @@ -691,7 +691,7 @@ class ChatListViewController: UITableViewController {
return false
}
titleView.accessibilityHint = nil
let cnt = tableView.indexPathsForSelectedRows?.count ?? 1
let cnt = tableView.indexPathsForSelectedRows?.count ?? 0
titleView.text = String.localized(stringID: "n_selected", parameter: cnt)
navigationItem.setLeftBarButton(cancelButton, animated: true)
navigationItem.setRightBarButton(markReadButton, animated: true)
Expand Down Expand Up @@ -925,9 +925,7 @@ extension ChatListViewController: ContactCellDelegate {
guard let chatList = viewModel?.chatList else { return }
if chatList.getChatId(index: indexPath.row) != Int(DC_CHAT_ID_ARCHIVED_LINK) {
UIImpactFeedbackGenerator(style: .medium).impactOccurred()
setLongTapEditing(true, initialIndexPath: [indexPath])
tableView.selectRow(at: indexPath, animated: true, scrollPosition: .none)
updateMarkReadButton()
setLongTapEditing(true, initialIndexPath: indexPath)
}
}
}
Expand Down

0 comments on commit 6134570

Please sign in to comment.