-
Notifications
You must be signed in to change notification settings - Fork 121
[Woo POS][Settings] i2: Reader connection modal flow (2) #16290
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
[Woo POS][Settings] i2: Reader connection modal flow (2) #16290
Conversation
|
|
joshheald
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.
Works as expected. Some questions/suggestions inling
| private func handleScannerDestination(_ destination: ScannerDestination) { | ||
| switch destination { | ||
| case .setup: | ||
| showBarcodeScanningSetupModal = true | ||
| case .documentation: | ||
| showBarcodeScanningDocumentationModal = true | ||
| } | ||
| } |
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.
Should this be part of this PR? It seems to work fine but just be unrelated...
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.
Yeah, is not new code, just moved it from lines 93-100 from being declared in the view to the private extension on 345-352. I see I forgot to remove the double private access control though, fixed here: 3b4822d
| .posModal(item: $posModel.cardPresentPaymentAlertViewModel, onDismiss: { | ||
| posModel.cardPresentPaymentAlertViewModel?.onDismiss?() | ||
| }, content: { alertType in | ||
| PointOfSaleCardPresentPaymentAlert(alertType: alertType) | ||
| .posInteractiveDismissDisabled(alertType.isDismissDisabled) | ||
| }) |
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.
Perhaps there could be a shared definition of this somehow? Not if it's difficult; we're not going to use it in that many places, but it's essentially identical to PointOfSaleDashboardView's use.
I think it would have to be a view modifier, something like this:
struct CardReaderConnectingModifier: ViewModifier {
@Environment(PointOfSaleAggregateModel.self) private var posModel
func body(content: Content) -> some View {
@Bindable var posModel = self.posModel
content
.posModal(item: $posModel.cardPresentPaymentAlertViewModel,
onDismiss: {
posModel.cardPresentPaymentAlertViewModel?.onDismiss?()
}) { alertType in
PointOfSaleCardPresentPaymentAlert(alertType: alertType)
.posInteractiveDismissDisabled(alertType.isDismissDisabled)
}
}
}
extension View {
func cardReaderConnecting() -> some View {
modifier(CardReaderConnectingModifier())
}
}
Though perhaps it would be better named as POS specific, and have the posModal requirement more obvious than using the environment var directly. It might be interesting to try some options for a few minutes.
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.
That definitely looks cleaner, thanks! I'll play with this separately and merge this PR for now.

Continuation of #16283
Closes WOOMOB-1570
Description
This PR adds the card reader connection modal flow through POS settings. For this we copy the existing implementation held in
PointOfSaleDashboardView, except the onboarding part (this will come in the next PR), so the merchant already has to be onboarded.I kept onboarding out of scope of the PR for now, so we can test it separately.
Changes
POSprefixPOSSettingsHardwareDetailViewcontains 1 new modal, triggeringPointOfSaleCardPresentPaymentAlert, which listens tocardPresentPaymentAlertViewModeland triggers the alert presentation for the card reader connection flow depending on the current reader state.Test Steps
Screen.Recording.2025-10-29.at.17.18.11.480p.mov