woocommerce-ios icon indicating copy to clipboard operation
woocommerce-ios copied to clipboard

[HACK week] Product form - Action buttons to mark/remove as favorite

Open selanthiraiyan opened this issue 1 year ago • 6 comments

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_tapped event 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_tapped event 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

Simulator Screen Recording - iPhone 15 Pro - 2024-03-15 at 11 13 16


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

selanthiraiyan avatar Mar 15 '24 05:03 selanthiraiyan

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

wpmobilebot avatar Mar 15 '24 06:03 wpmobilebot

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:

  • The tracks events must be validated in the Tracks system.
  • Verify the internal Tracks spreadsheet has also been updated.
  • Please consider registering any new events.
  • The PR must be assigned the category: tracks label.

Generated by :no_entry_sign: Danger

dangermattic avatar Mar 16 '24 11:03 dangermattic

Thanks for the review, Hafiz! Marking it as draft to address feedback about using userdefaults in https://github.com/woocommerce/woocommerce-ios/pull/12287.

selanthiraiyan avatar Mar 27 '24 03:03 selanthiraiyan

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.

selanthiraiyan avatar Jun 14 '24 03:06 selanthiraiyan

👋 again @hafizrahman,

I have revisited this PR and pushed changes to,

  • Stop using user defaults to store favorite product information.
  • Use GeneralStoreSettings and AppSettingsStore to store the favorite products information.
  • Add unit tests.

Please take another look at the PR when you can. Thank you!

selanthiraiyan avatar Jun 14 '24 03:06 selanthiraiyan

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

selanthiraiyan avatar Jun 18 '24 08:06 selanthiraiyan

Thanks for the review, @hafizrahman! The PR is ready for another look.

selanthiraiyan avatar Sep 18 '24 04:09 selanthiraiyan