-
Notifications
You must be signed in to change notification settings - Fork 116
[Woo POS] Expose item controllers for POS list views to use directly #15504
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
Conversation
Generated by 🚫 Danger |
|
@@ -14,21 +14,23 @@ struct ItemListView: View { | |||
|
|||
@Binding var selectedItemType: ItemType | |||
|
|||
var itemListController: PointOfSaleItemsControllerProtocol { |
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.
Let's call selected ones selected
or current
, or it's easy to conflict with actual itemsController
var itemListController: PointOfSaleItemsControllerProtocol { | |
var selectedItemListController: PointOfSaleItemsControllerProtocol { |
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.
It's probably clear enough now that the posModel only has specifically named controllers, no general itemsController
– WDYT?
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.
Yes 👍 then it's clear.
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.
Thank you for this refactoring. Looks good. Thanks for additional improvements of extracting VM out of the view.
Tested on iOS 18 iPad simulator, tested products and variations with features flags disabled, and additionally coupons with feature flags enabled.
Closes: #
Description
This PR exposes the items controllers, and then switches between them in the
ItemListView
.ItemList
andChildItemList
(mostly) don't know what controller they're using, they have it passed in by theItemListView
as we swap between them.Initially, in 452247f I did the switching in the dashboard view and then had one
ItemListView
per controller... but I actually think this is better. When we have searching for multiple item types, we might want to change the responsibilities of theItemListView
or add another intermediate view, to simplify knowing which controller we're searching... but equally, it might work fairly neatly.Steps to reproduce
Enable the coupons and search feature flags
N.B. the search list is far from perfect, but it's all behind a feature flag. I'll improve it further in future PRs
Testing information
Tested on iPad Air running iOS 17.7.3, and a simulator running 18.3
Screenshots
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: