-
Notifications
You must be signed in to change notification settings - Fork 121
[POS Orders] Move sales channel representation to Networking #15863
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
[POS Orders] Move sales channel representation to Networking #15863
Conversation
|
|
|
|
||
| // Then | ||
| XCTAssertEqual(viewModel.salesChannel, OrderListCellViewModel.Localization.salesChannelPOSText) | ||
| XCTAssertEqual(viewModel.salesChannel, "POS") |
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 had to revert the localization here as now the localized string sits in Networking 🤔
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 think this is fine, a bunch of unit tests are already based on the English locale assumption.
jaclync
left a comment
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.
| @@ -0,0 +1,32 @@ | |||
| import Foundation | |||
|
|
|||
| public enum SalesChannelType { | |||
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.
nit: how about just SalesChannel? Doesn't seem like there is a naming conflict, just wondering.
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.
No special reason, updated here! 98aaff9
| public var description: String { | ||
| switch self { | ||
| case .pointOfSale: | ||
| return NSLocalizedString("saleschanneltype.pos.description", |
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.
nit: or salesChannel.pos.description depending on the final name of the enum
| return NSLocalizedString("saleschanneltype.pos.description", | |
| return NSLocalizedString("salesChannelType.pos.description", |
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.
| init(order: Order, | ||
| status: OrderStatus?, | ||
| calendar: Calendar = .current) { | ||
| self.order = order |
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.
nit: I see a salesChannel: String? above, maybe can set either the sales channel description or enum to the salesChannel property here?
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.
True 🤔 , I've updated it on 7df616b but since the enum is in Networking I've continued using a String, in which case we can remove also some duplication around the description
|
|
||
| // Then | ||
| XCTAssertEqual(viewModel.salesChannel, OrderListCellViewModel.Localization.salesChannelPOSText) | ||
| XCTAssertEqual(viewModel.salesChannel, "POS") |
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 think this is fine, a bunch of unit tests are already based on the English locale assumption.
|
Thanks for the review!
Good catch, specially the order list details seem to break very easily in larger accessibility sizes, I don't think we'll get much additional design feedback around these badges apart from the recently updated colors, so I'll take a look into this next 👍 |



Description
As follow-up from p1751433227323889-slack-CGPNUU63E , we move the sales channel representation from WooCommerce to Networking, removing some code duplication, and avoiding having to handle the
pos-rest-apiraw value directly in the app layer.Let me know if this is what you had in mind @jaclync , happy to iterate further!
Changes
SalesChannelType, where thecreated_viavalue is passed directly and returns the specific associated case and it's description ( for now, only.pointOfSale-"POS"is handled, any other value will return nil)Testing information