Skip to content

Commit

Permalink
Maintain consistent top-down menu order in posts screen
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanw committed Mar 18, 2024
1 parent 38e8b4d commit f66a99f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion App/View Controllers/Posts/PostsPageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ final class PostsPageViewController: ViewController {
private lazy var hiddenMenuButton: HiddenMenuButton = {
let postActionButton = HiddenMenuButton()
postActionButton.alpha = 0
if #available(iOS 16.0, *) {
postActionButton.preferredMenuElementOrder = .fixed
}
postsView.addSubview(postActionButton)
return postActionButton
}()
Expand Down Expand Up @@ -555,7 +558,11 @@ final class PostsPageViewController: ViewController {


private func actionsItem() -> UIBarButtonItem {
UIBarButtonItem(title: "Menu", image: UIImage(named: "steamed-ham"), primaryAction: nil, menu: threadActionsMenu())
let buttonItem = UIBarButtonItem(title: "Menu", image: UIImage(named: "steamed-ham"), menu: threadActionsMenu())
if #available(iOS 16.0, *) {
buttonItem.preferredMenuElementOrder = .fixed
}
return buttonItem
}

private func refetchPosts() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,14 @@ extension BookmarksTableViewController {
contextMenuConfigurationForRowAt indexPath: IndexPath,
point: CGPoint
) -> UIContextMenuConfiguration? {
return .makeFromThreadList(
let configuration = UIContextMenuConfiguration.makeFromThreadList(
for: dataSource!.thread(at: indexPath),
presenter: self
)
if #available(iOS 16.0, *) {
configuration.preferredMenuElementOrder = .fixed
}
return configuration
}
}

Expand Down

0 comments on commit f66a99f

Please sign in to comment.