-
Notifications
You must be signed in to change notification settings - Fork 108
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 Favorites section #12287
base: feat/12274-mark-favorite
Are you sure you want to change the base?
[HACK week] Product list - Add Favorites section #12287
Conversation
📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.
|
ce34482
to
ff41447
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works as described in the PR description 👍 I have a few concerns:
- Regarding the logic of the previous PR, I wonder if we should switch to saving favorite products in a local file with
GeneralAppSettings
rather than user defaults. IMO we should keep only simpler checks in user defaults, especially those that require synchronous requests. Favorite products might fit better with local file storage. - I'm unsure about the limit of the favorite items, as it's unclear to users when their older items are removed. We should keep all items and if that's too clustering, we can keep the feature under a feature flag before adding the view more option.
@@ -21,7 +21,7 @@ struct FavoriteProductsUseCase { | |||
func markAsFavorite(productID: Int64) { | |||
if var productIdDict = productIdDict { | |||
let existingFavProductIDs = productIdDict[idAsString] ?? [] | |||
productIdDict[idAsString] = Array(Set(existingFavProductIDs + [productID])) | |||
productIdDict[idAsString] = Array(Set(existingFavProductIDs + [productID])).suffix(Constants.favoriteProductsMaxLimit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting this limit would remove the older items from the favorite list right? I don't think this is easy for users to understand, they might question where the other items go. Should we keep the list under the feature flag and add the view more option when we have time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed this limit now as we added a way to expand/collapse the favorites section.
WooCommerce/Classes/ViewRelated/Products/FavoriteProducts/ProductListViewSection.swift
Outdated
Show resolved
Hide resolved
WooCommerce/Classes/ViewRelated/Products/ProductsListViewModel.swift
Outdated
Show resolved
Hide resolved
WooCommerce/Classes/ViewRelated/Products/ProductsViewController.swift
Outdated
Show resolved
Hide resolved
Thanks for the review, Huong! I am marking the PR as a draft until I get time to address the feedback. |
guard let self else { return } | ||
if let sort = settings.sort { | ||
sortOrder = ProductsSortOrder(rawValue: sort) ?? .default | ||
private func syncLocalProductsSettings() async throws -> StoredProductSettings.Setting { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made this method async
and the rest are just indentation changes.
👋 @itsmeichigo , Thank you for the review and input. 🙇 I have pushed the necessary changes to make the favorites section collapse/expand. The PR is ready for another round of review. Please note that I don't check for feature flag anywhere because,
Changes include
Known scrolling issueWhen you select a product from the "Favorites" section and navigate back, the product will be selected in the "All" section
@jaclync 👋 Kindly share if you have any ideas or input about this issue. Thank you! DemoiPhone Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-06-14.at.17.31.20.mp4iPad Rotated.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works as described (again). I appreciate your efforts, but I have some suggestions for improvements:
- Having the favorite list as a section comes with a few complications like the selection state you mentioned. I also see that when selecting a filter, showing the favorite section can be misleading as the section is not filtered.
- Some minor UI issues: the product list has a divider at the top, while there's no divider between the Favorites and All sections, which looks odd. There should be a divider between the sections for better clarity:
For a simpler UX, we can remove the Favorite section and update the product rows with an additional star icon for favorite items instead. Then, we can add an option to see only favorite items in the Filter list.
Thanks again for the review, Huong!
This is a good suggestion. I will try to address this when I find time. I will mark the PR as a draft until then. |
Generated by 🚫 Danger |
Part of: #12274
Description
List favorite products under a new section in product list table view.
Changes
Testing instructions
Screenshots
RELEASE-NOTES.txt
if necessary.