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

avoid scrolling context menu #2510

Merged
merged 1 commit into from
Jan 11, 2025
Merged
Changes from all commits
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
16 changes: 14 additions & 2 deletions deltachat-ios/Chat/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,9 @@ class ChatViewController: UITableViewController, UITableViewDropDelegate {
if canShare() {
alert.addAction(UIAlertAction(title: String.localized("menu_share"), style: .default, handler: onShareActionPressed(_:)))
}
if canInfo() {
alert.addAction(UIAlertAction(title: String.localized("info"), style: .default, handler: onInfoActionPressed(_:)))
}
alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
present(alert, animated: true, completion: nil)
}
Expand All @@ -1291,6 +1294,12 @@ class ChatViewController: UITableViewController, UITableViewDropDelegate {
}
}

private func onInfoActionPressed(_ action: UIAlertAction) {
if let rows = tableView.indexPathsForSelectedRows, let firstRow = rows.first {
info(at: firstRow)
}
}

private func askToDeleteChat() {
let chat = dcContext.getChat(chatId: chatId)
let title = String.localizedStringWithFormat(String.localized("ask_delete_named_chat"), chat.name)
Expand Down Expand Up @@ -1970,7 +1979,6 @@ extension ChatViewController {
}

children.append(contentsOf: [
UIAction.menuAction(localizationKey: "info", systemImageName: "info", indexPath: indexPath, action: info),
UIMenu(options: [.displayInline], children: [
UIAction.menuAction(localizationKey: "menu_more_options", systemImageName: "checkmark.circle", indexPath: indexPath, action: selectMore),
])
Expand Down Expand Up @@ -2144,8 +2152,12 @@ extension ChatViewController {
return false
}

private func canInfo() -> Bool {
return tableView.indexPathsForSelectedRows?.count == 1
}

private func evaluateMoreButton() {
editingBar.moreButton.isEnabled = canShare() || canResend()
editingBar.moreButton.isEnabled = canShare() || canResend() || canInfo()
}

func setEditing(isEditing: Bool, selectedAtIndexPath: IndexPath? = nil) {
Expand Down
Loading