Skip to content

Commit

Permalink
use row-of-items only if there actually are reactions
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Apr 5, 2024
1 parent e8cc82e commit 03e0c68
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions deltachat-ios/Chat/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1983,11 +1983,12 @@ extension ChatViewController {
guard let self else { return nil }
let message = dcContext.getMessage(id: messageId)
var children: [UIMenuElement] = []
var preferredElementSizeSmall = false

if canReply(to: message) {
if #available(iOS 16.0, *) {
// together with preferredElementSize below, this shows the reaction options in a row
appendReactionItems(to: &children, indexPath: indexPath)
preferredElementSizeSmall = true
} else {
var items: [UIMenuElement] = []
appendReactionItems(to: &items, indexPath: indexPath)
Expand All @@ -2014,7 +2015,7 @@ extension ChatViewController {
])

let menu = UIMenu(children: children)
if #available(iOS 16.0, *) {
if preferredElementSizeSmall, #available(iOS 16.0, *) {
menu.preferredElementSize = .small
}
return menu
Expand Down

0 comments on commit 03e0c68

Please sign in to comment.