woocommerce / woocommerce-ios

WooCommerce iOS app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
314 stars 113 forks source link

[Woo POS] Simplify CartViewModel #14482

Closed joshheald closed 3 hours ago

joshheald commented 1 day ago

Part of: #14458

Description

This PR simplifies the CartViewModel, removing its dependency on the aggregate model and making it a plain class, no longer an ObservedObject.

My thinking is moving towards renaming these – they're simpler because they don't have any state, but if they don't have any state, are they really a (View)Model? Probably not. I don't have a new name yet though.

Testing information

There wasn't much change required here. The main thing to test is the items count at the top of the cart when you have items showing.

We no longer keep state in the "view model", just depend on it from the view.

I checked that it responds as expected to adding items, removing items, clearing the cart, going back after completing an order, and going back from an error state.


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:

dangermattic commented 1 day ago
1 Warning
:warning: View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.

Generated by :no_entry_sign: Danger

wpmobilebot commented 1 day ago

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 Numberpr14482-ab3af49
Version21.1
Bundle IDcom.automattic.alpha.woocommerce
Commitab3af49d33db5a89cc146d2a923af938a5efb7da
App Center BuildWooCommerce - Prototype Builds #11705

Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

wpmobilebot commented 6 hours ago

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