Skip to content

Commit

Permalink
Hide scrollbutton when showing the menu (#2147)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitschlag committed Jun 13, 2024
1 parent a970bdd commit c679dd9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions deltachat-ios/Chat/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ChatViewController: UITableViewController, UITableViewDropDelegate {
private var keepKeyboard: Bool = false
private var wasInputBarFirstResponder = false
private var reactionMessageId: Int?
private var contextMenuVisible = false

private lazy var isGroupChat: Bool = {
return dcContext.getChat(chatId: chatId).isGroup
Expand Down Expand Up @@ -699,9 +700,11 @@ class ChatViewController: UITableViewController, UITableViewDropDelegate {
}

private func updateScrollDownButtonVisibility() {
messageInputBar.scrollDownButton.isHidden = messageIds.isEmpty || isLastRowVisible(checkTopCellPostion: true,
checkBottomCellPosition: true,
allowPartialVisibility: true)
let scrollDownButtonHidden = contextMenuVisible || messageIds.isEmpty || isLastRowVisible(checkTopCellPostion: true,
checkBottomCellPosition: true,
allowPartialVisibility: true)

messageInputBar.scrollDownButton.isHidden = scrollDownButtonHidden
}

private func configureContactRequestBar() {
Expand Down Expand Up @@ -1884,6 +1887,9 @@ extension ChatViewController {

cell.messageBackgroundContainer.isHidden = true
cell.reactionsView.isHidden = true
contextMenuVisible = true

updateScrollDownButtonVisibility()
}

override func tableView(_ tableView: UITableView, willEndContextMenuInteraction configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionAnimating?) {
Expand All @@ -1900,6 +1906,9 @@ extension ChatViewController {

cell.messageBackgroundContainer.isHidden = false
cell.reactionsView.isHidden = false
contextMenuVisible = false

updateScrollDownButtonVisibility()
}

override func tableView(_ tableView: UITableView, previewForHighlightingContextMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview? {
Expand Down

0 comments on commit c679dd9

Please sign in to comment.