Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to 'mark all selected chats read' #2226

Merged
merged 2 commits into from
Jul 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a while to understand what cnt stands for

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leaving vocals out to make names shorter is a thing maybe only ppl understand growing up with 8+3 filename and other restrictions, hard to get rid of this habit obviously :)

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