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

HACK Week: Add filter history to order list filter #14820

Open
wants to merge 15 commits into
base: trunk
Choose a base branch
from

Conversation

itsmeichigo
Copy link
Contributor

@itsmeichigo itsmeichigo commented Jan 8, 2025

Part of #14791

Description

This PR adds UI and logic for the filter history screen of the order list. Features include:

  • Applying a filter saves it to the top of the history.
  • Selecting a past filter updates the filters screen with the details.
  • Items on the filter history screen can be deleted by swiping to the left.
  • All items on the filter history can be cleared at once.

Steps to reproduce

  • Ensure that filterHistoryOnOrderAndProductLists feature flag is enabled and run the app.
  • Log in to a store with existing orders.
  • Navigate to the Orders tab > Filters > select the Clock button on the top right.
  • Confirm that the filter history is empty by default.
  • Navigate back to the Filters screen, select some filters and apply it.
  • Navigate back to the Filter history screen and confirm that the last filter is displayed in the history.
  • Go back to the Filters screen and apply new filters.
  • Go to the Filter history screen and confirm that the latest filters are displayed at the top of the history.
  • Swipe left on one of the filters and tap Delete. Confirm that the filter is no longer displayed on the Filter History screen
  • Apply a past filter and confirm that the Filters screen are updated with the details of the filter.
  • Tap Show orders and confirm that the order list are updated correctly.

Testing information

Tested on simulator iPhone 16 Pro iOS 18.2 in light mode, dark mode and different text sizes and confirmed that all look good and work as expected.

Screenshots

Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-01-08.at.17.18.19.mp4

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on all devices (phone/tablet) and no regressions are added.

@itsmeichigo itsmeichigo added type: enhancement A request for an enhancement. feature: order list Related to the order list. labels Jan 8, 2025
@itsmeichigo itsmeichigo added this to the 21.4 milestone Jan 8, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 8, 2025

WooCommerce iOS📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr14820-4b1ad48
Version21.3
Bundle IDcom.automattic.alpha.woocommerce
Commit4b1ad48
App Center BuildWooCommerce - Prototype Builds #12406
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@itsmeichigo itsmeichigo marked this pull request as ready for review January 8, 2025 09:51
@dangermattic
Copy link
Collaborator

dangermattic commented Jan 8, 2025

1 Warning
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

Comment on lines +31 to +35
private let title = NSLocalizedString(
"filterHistoryView.title",
value: "Filter History",
comment: "Title of the Filter History view"
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the view has to be generic, using the static variables for localization is not supported. I'm keeping them all as constants instead.

Comment on lines +26 to +29
@State private var selectedFilter: ViewModel.Criteria?
@State private var savedFilters: [ViewModel.Criteria] = []
@State private var error: Error?
@State private var shouldConfirmClearingHistory = false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not possible to have a generic observable object as a view model, so I'm keeping the states in the view for simplicity.

Base automatically changed from hackweek/14791-entry-point-filter-history to trunk January 9, 2025 06:50
@wpmobilebot wpmobilebot modified the milestones: 21.4, 21.5 Jan 10, 2025
@wpmobilebot
Copy link
Collaborator

Version 21.4 has now entered code-freeze, so the milestone of this PR has been updated to 21.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: order list Related to the order list. type: enhancement A request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants