Skip to content

Conversation

@iamgabrielma
Copy link
Contributor

Closes WOOMOB-1039

Description

This PR adds the basic scaffolding and navigation for the Hardware section of POS settings, by allowing the merchant to navigate through card reader and barcode scanner setup in a detail view to the right, as well as see documentation full screen (for now) presented on top of the view.

Final UI is not handled yet, this will be done separately.

Screen.Recording.2025-08-26.at.10.14.20.mov

Testing information

  • In POS, tap on the ... CTA, and go to Settings
  • Tap Hardware > Card Readers. Observe that you can open documentation full screen, and the last known reader model will appear if any.
  • Tap Hardware > Barcode scanner . Observe you can trigger the barcode scanner setup, as well as see the documentation.

@iamgabrielma iamgabrielma added type: task An internally driven task. feature: POS labels Aug 26, 2025
@iamgabrielma iamgabrielma added this to the 23.2 milestone Aug 26, 2025
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@iamgabrielma iamgabrielma requested a review from staskus August 26, 2025 03:22
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Aug 26, 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 Numberpr16038-7af11a0
Version23.1
Bundle IDcom.automattic.alpha.woocommerce
Commit7af11a0
Installation URL285a3sjni4e9g
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

SafariView(url: WooConstants.URLs.inPersonPaymentsLearnMoreWCPay.asURL())
}
.task { @MainActor in
// TODO: WOOMOB-1172
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is temporary, most likely we'll fetch card reader information from passing in either a reference to the aggregate model or expose its card reader details.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Yes, the aggregate model works.

If we think that this state sharing in an aggregate model is not needed, and we only need information within this view, we could rely on a separate view model for this view that fetches information.

I had the same question for orders, and at least for order it felt like it made sense to have something separate and there was no value putting information within the aggregate model.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Jinx! I just had the same question when reviewing your PR :D

I also think that in this case, for settings, it makes more sense to go through the aggregate, as we'll deal with settings across different features that are part of such aggregate, but we'll see what fits better 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I agree. 👍

Copy link
Contributor

@staskus staskus left a comment

Choose a reason for hiding this comment

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

👍

SafariView(url: WooConstants.URLs.inPersonPaymentsLearnMoreWCPay.asURL())
}
.task { @MainActor in
// TODO: WOOMOB-1172
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Yes, the aggregate model works.

If we think that this state sharing in an aggregate model is not needed, and we only need information within this view, we could rely on a separate view model for this view that fetches information.

I had the same question for orders, and at least for order it felt like it made sense to have something separate and there was no value putting information within the aggregate model.


extension PointOfSaleSettingsView {
enum Constants {
static let sidebarWidthFraction: CGFloat = 0.35
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is one of those we can share between Dashboard/Orders/Settings when we decide if we need a unified look and functionality.

default:
EmptyView()
.frame(width: geometry.size.width * Constants.sidebarWidthFraction)
Group {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wwe could avoid using Group if you would move the switch into a separate @ViewBuilder:

    @ViewBuilder
    private var detailView: some View {
        switch selection {
        case .store:
            PointOfSaleSettingsStoreDetailView()
        case .hardware:
            PointOfSaleSettingsHardwareDetailView()
        case .help:
            PointOfSaleSettingsHelpDetailView()
        default:
            EmptyView()
        }
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! 2098428

cardReadersView
case .hardware(.scanners):
scannersView
case .scanner:
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we remove scanner from the NavigationDestination then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I thought would be needed but it isn't since only buttons are there now. Updated: 9fdcf36

Comment on lines 152 to 155
enum NavigationDestination: Hashable {
case hardware(PointOfSaleSettingsView.HardwareDestination)
case scanner(ScannerDestination)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be removed

Suggested change
enum NavigationDestination: Hashable {
case hardware(PointOfSaleSettingsView.HardwareDestination)
case scanner(ScannerDestination)
}
enum NavigationDestination: Hashable {
case hardware(PointOfSaleSettingsView.HardwareDestination)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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


struct PointOfSaleSettingsHardwareDetailView: View {
@State private var navigationPath: [PointOfSaleSettingsView.HardwareDestination] = []
@State private var navigationPath: [NavigationDestination] = []
Copy link
Contributor

Choose a reason for hiding this comment

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

In a broader conversation, I think the fact that "< Back" button is displayed within the details view, the "X" (Close) should be presented within the the list view.

And we likely need to use POSPageHeaderView and not the native navigation bar, and of course, not both. As I understand, we leave this for later 👍

Simulator Screenshot - iPad Pro 11-inch (M4) - 2025-08-26 at 14 11 48

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In a broader conversation, I think the fact that "< Back" button is displayed within the details view, the "X" (Close) should be presented within the the list view. And we likely need to use POSPageHeaderView and not the native navigation bar, and of course, not both. As I understand, we leave this for later 👍

Yes, that's something I'm precisely discussing today, as Android currently does not show a header across the full view (separates list and detail view), nor X to close the view that I can see. Neither this has been provided in the initial design drafts p1756257438170999?thread_ts=1755784099.956039&cid=C070SJRA8DP-slack-C070SJRA8DP

I think could even make sense to get the "Help" card up with the rest, and take that bottom-left position to go back to the dashboard, let's see what design thinks 👍

Base automatically changed from task/WOOMOB-1025-two-panel-settings-view to trunk August 27, 2025 00:38
At the moment the scanner child view only has buttons that will prompt modal flow or web view, so no need to be part of the nav stack further down.
@iamgabrielma iamgabrielma enabled auto-merge August 27, 2025 01:25
@iamgabrielma iamgabrielma merged commit 413b1a7 into trunk Aug 27, 2025
14 checks passed
@iamgabrielma iamgabrielma deleted the task/WOOMOB-1039-pos-settings-hardware-section branch August 27, 2025 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: POS type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants