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] Product list - Add favorite product filter option #13995

Merged
merged 7 commits into from
Sep 26, 2024

Conversation

selanthiraiyan
Copy link
Contributor

@selanthiraiyan selanthiraiyan commented Sep 18, 2024

Part of: #12274

Description

Start showing a new filter option in the product list filter screen.

The selection is persisted to storage and loaded again.

Changes

  • Added new FavoriteProductsFilter filter for filtering favorite products.
  • Store the favorite product filter to storage and load it from storage.
  • Show the new filter option only if the feature flag is turned on.
  • Update unit tests.

Steps to reproduce

Prerequisites

  • Use a Woo store with more than 100 products.
  • You can create a JN store and generate 100+ products using Woo Smooth generator.
  • Using the smooth generator helps to generate products with different types, status and category. (Helps with testing filters)

Feature flag off

  • Login into the app
  • Navigate to Products tab
  • Tap "Filter"
  • Test by applying different filters
  • Validate that the product filtering works as expected

Feature flag on

  • Turn on the favoriteProducts feature flag by returning true from here
  • Login into the app
  • Navigate to Products tab
  • Tap "Filter"
  • Validate that you see the "Favorite Products" filter.
  • Select the "Favorite Products" filter -> Switch to "Favorite Products" from "Any"
  • Tap "Show Products"
  • Validate that products are loaded correctly. (Actual filtering logic will be added in upcoming PRs)
  • Kill the app
  • Relaunch the app
  • Navigate to Products tab
  • Tap "Filter"
  • Validate that the "Favorite Products" filter selection was persisted and reloaded from storage

Testing information

  • Tested the product filtering works as before.
  • Tested that the new favorite products filter is displayed upon turning on feature flag.

Screenshots

Simulator Screen Recording - iPhone 15 Pro Max - 2024-09-18 at 13 53 37


  • 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.

@selanthiraiyan selanthiraiyan added the feature: product list Related to the product list. label Sep 18, 2024
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 18, 2024

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 Numberpr13995-154eec1
Version20.5
Bundle IDcom.automattic.alpha.woocommerce
Commit154eec1
App Center BuildWooCommerce - Prototype Builds #11019
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@selanthiraiyan selanthiraiyan added this to the 20.6 milestone Sep 19, 2024
@selanthiraiyan selanthiraiyan marked this pull request as ready for review September 20, 2024 08:02
@hafizrahman hafizrahman self-assigned this Sep 20, 2024
Copy link
Contributor

@hafizrahman hafizrahman left a comment

Choose a reason for hiding this comment

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

I tested this both in off and on feature flag state, and in the on state I tested all the cases including by killing the app and returning. I can confirm that everything works fine. The code is also following the existing filtering logic, so all good.

Aside:

While looking at the Filter screen, since Favorite Product is inherently a boolean, I wonder if it's better UI-wise to make it a toggle, instead of navigating to another screen to select. It wil save time, at least.

That is unrelated to this PR, though.

@selanthiraiyan
Copy link
Contributor Author

Thanks for the review.

While looking at the Filter screen, since Favorite Product is inherently a boolean, I wonder if it's better UI-wise to make it a toggle, instead of navigating to another screen to select. It wil save time, at least.

Good suggestion, Hafiz! Logged it as a subtask under enhancements #12274

Base automatically changed from feat/12274-mark-favorite to trunk September 26, 2024 05:38
@selanthiraiyan selanthiraiyan merged commit 84f2980 into trunk Sep 26, 2024
14 checks passed
@selanthiraiyan selanthiraiyan deleted the feat/12274-favorite-filter branch September 26, 2024 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: product list Related to the product list.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants