woocommerce-ios
woocommerce-ios copied to clipboard
[HACK week] Product form - Action buttons to mark/remove as favorite
Part of: #12274
Description
Show action buttons in product form to mark/remove a product as a favorite. We will show favorite products in the product list screen in a future PR.
Changes
- Feature flag to allow marking a product as favorite.
- Use case to store favorite product list into user defaults.
- Add action buttons to mark/remove a product as favorite.
Testing instructions
- Login into the app
- Navigate to Products tab
- Open any product
- Tap "…" from the action sheet tap "Mark as favorite"
- From Xcode log ensure that
product_detail_mark_as_favorite_tappedevent is tracked - Navigate back/Quit the app
- Open the same product again from the Products tab
- Tap "…" from the action sheet
- You should see "Remove from favorite" option. Tap on it to remove the product from favorite list.
- From Xcode log ensure that
product_detail_remove_from_favorite_tappedevent is tracked - Reopen the product and validate that you see "Mark as favorite"
- Switch stores and ensure that the product marked as favorite is still marked as favorite.
- Log out and log into the same store again. Validate that the favorite products list is cleared after logout.
Screenshots
- [x] I have considered if this change warrants user-facing release notes and have added them to
RELEASE-NOTES.txtif necessary.
📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.
| App Name | ||
| Build Number | pr12284-b729f90 | |
| Version | 20.5 | |
| Bundle ID | com.automattic.alpha.woocommerce | |
| Commit | b729f9034f5772dc5bb9079305c0ffec80365e1a | |
| App Center Build | WooCommerce - Prototype Builds #11018 |
| 1 Warning | |
|---|---|
| :warning: | This PR is assigned to the milestone 20.6. This milestone is due in less than 2 days. Please make sure to get it merged by then or assign it to a milestone with a later deadline. |
| 1 Message | |
|---|---|
| :book: | This PR contains changes to Tracks-related logic. Please ensure (author and reviewer) the following are completed:
|
Generated by :no_entry_sign: Danger
Thanks for the review, Hafiz! Marking it as draft to address feedback about using userdefaults in https://github.com/woocommerce/woocommerce-ios/pull/12287.
I tried looking into Core to see if there is a built-in feature for this. The closest I found is the "Favorite" feature:
Thanks for the input, @hafizrahman!
Yes, I took a look at this before starting work and learned that this feature in core is used to feature the product to the users (customers).
Our "Favorite product" feature's goal is to allow merchants to favorite products for easy management.
They are different features and our feature will be mobile only (with no backend support from core) at least for now.
👋 again @hafizrahman,
I have revisited this PR and pushed changes to,
- Stop using user defaults to store favorite product information.
- Use
GeneralStoreSettingsandAppSettingsStoreto store the favorite products information. - Add unit tests.
Please take another look at the PR when you can. Thank you!
Sorry, Hafiz! I am marking this PR as a draft until I find time to address the feedback from this child PR. https://github.com/woocommerce/woocommerce-ios/pull/12287#issuecomment-2175450767
Thanks for the review, @hafizrahman! The PR is ready for another look.