diff --git a/Tusker/Screens/Utilities/Previewing.swift b/Tusker/Screens/Utilities/Previewing.swift index dcf5a9c854..984ec12f1d 100644 --- a/Tusker/Screens/Utilities/Previewing.swift +++ b/Tusker/Screens/Utilities/Previewing.swift @@ -138,7 +138,7 @@ extension MenuActionProvider { ] } - func actionsForStatus(_ status: StatusMO, sourceView: UIView?, includeReply: Bool = true) -> [UIMenuElement] { + func actionsForStatus(_ status: StatusMO, sourceView: UIView?, includeStatusButtonActions: Bool = true) -> [UIMenuElement] { guard let mastodonController = mastodonController else { return [] } guard let accountID = mastodonController.accountInfo?.id else { @@ -169,7 +169,8 @@ extension MenuActionProvider { }), ] - if #available(iOS 16.0, *) { + if #available(iOS 16.0, *), + includeStatusButtonActions { let favorited = status.favourited // TODO: move this color into an asset catalog or something var favImage = UIImage(systemName: favorited ? "star.fill" : "star")! @@ -200,7 +201,7 @@ extension MenuActionProvider { var actionsSection: [UIAction] = [] - if includeReply { + if includeStatusButtonActions { actionsSection.insert(createAction(identifier: "reply", title: "Reply", systemImageName: "arrowshape.turn.up.left", handler: { [weak self] (_) in guard let self = self else { return } self.navigationDelegate?.compose(inReplyToID: status.id) @@ -278,8 +279,9 @@ extension MenuActionProvider { addOpenInNewWindow(actions: &shareSection, activity: UserActivityManager.showConversationActivity(mainStatusID: status.id, accountID: accountID)) if #available(iOS 16.0, *) { + let toggleableAndActions = toggleableSection + actionsSection return [ - UIMenu(options: .displayInline, preferredElementSize: .medium, children: toggleableSection + actionsSection), + UIMenu(options: .displayInline, preferredElementSize: toggleableAndActions.count == 1 ? .large : .medium, children: toggleableAndActions), UIMenu(options: .displayInline, children: shareSection), ] } else { diff --git a/Tusker/Views/Status/BaseStatusTableViewCell.swift b/Tusker/Views/Status/BaseStatusTableViewCell.swift index 98a32ddacc..a314ce89c4 100644 --- a/Tusker/Views/Status/BaseStatusTableViewCell.swift +++ b/Tusker/Views/Status/BaseStatusTableViewCell.swift @@ -209,7 +209,7 @@ class BaseStatusTableViewCell: UITableViewCell { // keep menu in sync with changed states e.g. bookmarked, muted // do not include reply action here, because the cell already contains a button for it - moreButton.menu = UIMenu(title: "", image: nil, identifier: nil, options: [], children: delegate?.actionsForStatus(status, sourceView: moreButton, includeReply: false) ?? []) + moreButton.menu = UIMenu(title: "", image: nil, identifier: nil, options: [], children: delegate?.actionsForStatus(status, sourceView: moreButton, includeStatusButtonActions: false) ?? []) pollView.isHidden = status.poll == nil pollView.mastodonController = mastodonController diff --git a/Tusker/Views/Status/StatusCollectionViewCell.swift b/Tusker/Views/Status/StatusCollectionViewCell.swift index da7f39f91b..2bd63a25cb 100644 --- a/Tusker/Views/Status/StatusCollectionViewCell.swift +++ b/Tusker/Views/Status/StatusCollectionViewCell.swift @@ -195,7 +195,7 @@ extension StatusCollectionViewCell { // keep menu in sync with changed states e.g. bookmarked, muted // do not include reply action here, because the cell already contains a button for it - moreButton.menu = UIMenu(title: "", image: nil, identifier: nil, options: [], children: delegate?.actionsForStatus(status, sourceView: moreButton, includeReply: false) ?? []) + moreButton.menu = UIMenu(title: "", image: nil, identifier: nil, options: [], children: delegate?.actionsForStatus(status, sourceView: moreButton, includeStatusButtonActions: false) ?? []) contentContainer.pollView.isHidden = status.poll == nil contentContainer.pollView.mastodonController = mastodonController