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

Posts & Pages: Move post actions to a context menu #21850

Merged

Conversation

momo-ozawa
Copy link
Contributor

@momo-ozawa momo-ozawa commented Oct 23, 2023

Closes #21717

Description

  • Converted the Posts action sheet to a context menu
  • Post actions are divided into sections
Before After

Notes

  • TODO
    • Add comments action
    • Adapt for Pages context menu
  • Using system images for the icons, for consistency - I can change this if needed

How to test

  • On the Posts list page, tap on the ellipsis button
  • Verify post actions are presented in a context menu
  • Verify post actions are in the correct grouping (ref: eYeHXEMDbnFptE40xUqZ2T-fi-836_5909)
  • Verify each post action has the expected result (no regressions)

Regression Notes

  1. Potential unintended areas of impact
    Post actions

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    Tested manually

  3. What automated tests I added (or what prevented me from doing so)
    n/a

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

UI Changes testing checklist:

  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • VoiceOver.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • iPhone and iPad.
  • Multi-tasking: Split view and Slide over. (iPad)

switch self {
case .retry: UIImage()
case .view: UIImage(systemName: "eye")
case .publish: UIImage(systemName: "icon.globe")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • There is no icon.globe but there is globe
  • I'd suggest using chart.bar because it has no fill

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! 11ab0be

buttons.append(.stats)
}

// TODO: Add reader and comments
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reader is out of the scope p1696870367221659/1696868289.514809-slack-C04SFL0RP51 (no need to update the comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good shout, thanks for the reminder!

@@ -2,5 +2,4 @@ import Foundation

protocol InteractivePostView {
func setInteractionDelegate(_ delegate: InteractivePostViewDelegate)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope I'm going to able to use PostListViewController implementation of the delegate in the search list. I think hit should work, but If not, I'll extract it to a separate class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll end up having to extract it to a separate class, if we want to reuse it for pages. The pages screen doesn't use the delegate - it builds the action sheet straight in the class 😞


return buttons.map { button in
UIAction(title: button.title(for: post), image: button.icon, attributes: button.attributes, handler: { _ in
button.performAction(for: post, view: presentingView, delegate: delegate)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if there is a retain cycle, but I would suggest making the delegate weak just in case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! 67b8085

@momo-ozawa momo-ozawa requested a review from kean October 23, 2023 17:45
@kean
Copy link
Contributor

kean commented Oct 23, 2023

Using system images for the icons, for consistency - I can change this if needed

I think Chris wanted us to start adopting the Gutenberg icons. It can be done separately. It's not always easy to find what you need there.

Copy link
Contributor

@kean kean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, but with a couple of comments.

}
buttons.append(.share)
}
if autoUploadInteractor.canRetryUpload(of: post) ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest removing isInternetReachable. It's unreliable.

private typealias StatusMessages = PostCardStatusViewModel.StatusMessages

class PostCardCellTests: CoreDataTestCase {
private var postCell: PostCardCell!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a plan to re-implement (some of) these tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I'll add them in the next PR

@peril-wordpress-mobile
Copy link

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@wpmobilebot
Copy link
Contributor

WordPress Alpha📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr21850-591f3c3
Version23.4
Bundle IDorg.wordpress.alpha
Commit591f3c3
App Center BuildWPiOS - One-Offs #7516
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot
Copy link
Contributor

Jetpack Alpha📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr21850-591f3c3
Version23.4
Bundle IDcom.jetpack.alpha
Commit591f3c3
App Center Buildjetpack-installable-builds #6543
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@momo-ozawa momo-ozawa merged commit 63f1929 into task/ui-modernization-posts-and-pages Oct 24, 2023
@momo-ozawa momo-ozawa deleted the task/21717-post-context-menu branch October 24, 2023 12:16
@momo-ozawa momo-ozawa linked an issue Oct 27, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Posts & Pages: Update Post context menu
3 participants