Skip to content

Conversation

@iamgabrielma
Copy link
Contributor

@iamgabrielma iamgabrielma commented Jul 8, 2025

Closes WOOMOB-708
Closes WOOMOB-709
Closes WOOMOB-710

Description

This PR starts the i2 for POS Orders by rendering a new "Sales Channel" option within the preexisting filters within Order List. This is not functional yet, merely an UI update behind a feature flag.

Screen.Recording.2025-07-08.at.11.37.58.mov

Changes

While I tried to make the minimal changes to only show the UI, I found the current filters quite complicated to follow. Luckily most changes were enforced by the compiler: OrdersRootViewController owns filters, via a FilterOrderListViewModel. This view model holds each individual filter as its own type and associated FilterTypeViewModel. These are created on demand as we tap the filters button:

  • Added pointOfSaleOrdersi2 feature flag
  • Added a new salesChannel case to FilterListViewController
  • Created a temporary SalesChannelFilter, most likely we'll fetch this from Yosemite/Networking later on
  • In FilterOrderListViewModel, we append the new filter only when the feature flag is on
  • Unit tests will be handled in WOOMOB-781

Testing information

  • Go to the orders tab, tap on Filters, observe that the new filter appears as an option. Tapping will push an empty view into the stack.
  • Switch pointOfSaleOrdersi2 to false and re-run the app. The new filter shouldn't be visible.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jul 8, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr15878-de53799
Version22.7
Bundle IDcom.automattic.alpha.woocommerce
Commitde53799
Installation URL3ji3ro4no4tio
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@iamgabrielma iamgabrielma added feature: order list Related to the order list. feature: POS labels Jul 8, 2025
@iamgabrielma iamgabrielma added this to the 22.8 milestone Jul 8, 2025
@iamgabrielma iamgabrielma marked this pull request as ready for review July 8, 2025 05:39
@iamgabrielma iamgabrielma requested a review from joshheald July 8, 2025 05:39
@iamgabrielma iamgabrielma added the type: task An internally driven task. label Jul 8, 2025
@joshheald joshheald self-assigned this Jul 8, 2025
Copy link
Contributor

@joshheald joshheald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected. A few suggestions inline which would make the PR more compact and reduce overhead 😊

Comment on lines 112 to 114
if featureFlagService.isFeatureFlagEnabled(.pointOfSaleOrdersi2) {
filterTypeViewModels.append(salesChannelFilterViewModel)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is the only reason the filterTypeViewModels needs to be a var, it would be better to make a local var, and then set the property with it when you're done constructing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the only reason indeed, changed on 4f93bca

Comment on lines +321 to +329
static let rowTitleOrderStatus = NSLocalizedString(
"filterOrderListViewModel.OrderListFilter.rowTitleOrderStatus",
value: "Order Status",
comment: "Row title for filtering orders by order status.")

static let rowTitleDateRange = NSLocalizedString(
"filterOrderListViewModel.OrderListFilter.rowTitleDateRange",
value: "Date Range",
comment: "Row title for filtering orders by date range.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no real benefit to changing existing localized string definitions to use the key, value, comment initialiser, AFAIK.

It incurrs cost/work, because the translation will need to be done again in all the langages even though it's not changed, and I don't know if Glotpress is good at linking up the old version with the new version...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting point, thanks! Since p91TBi-aJl-p2 I've been updating these to adopt the "DNS key thingy" approach every time I had to directly work with them. I'll take that into account moving forward 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, if you're changing a string, at all, it's definitely right to add the reverse DNS key.

var description: String {
switch self {
case .pointOfSale:
return "pos"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be upper case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can! And most likely it will soon, updated de53799

let dateRange: OrderDateRangeFilter?
let product: FilterOrdersByProduct?
let customer: CustomerFilter?
let salesChannel: SalesChannelFilter?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let salesChannel: SalesChannelFilter?
let salesChannel: SalesChannelFilter? = nil

You don't need to change it now, but for a partial PR like this, it might be better to use the default. It saves you a bunch of changes in the tests, which you're probably going to have to change again when you implement it properly. The compiler will still help you catch them all when you remove the default in a future PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True 😅 , thanks for pointing it out.

@iamgabrielma iamgabrielma enabled auto-merge July 8, 2025 11:06
@iamgabrielma iamgabrielma merged commit f689348 into trunk Jul 8, 2025
13 checks passed
@iamgabrielma iamgabrielma deleted the task/WOOMOB-709-make-sales-channel-filter branch July 8, 2025 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: order list Related to the order list. feature: POS type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants