-
Notifications
You must be signed in to change notification settings - Fork 121
[POS as a tab i2] Update POS ineligible UI with detailed text and design updates #15859
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
Changes from 8 commits
fd5a6e0
c186f7f
1f63381
a2b5591
ab94a2c
35374aa
5989d55
9f7fe65
33eb215
f95efc5
8ae5ba5
156eefe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,129 +2,259 @@ import SwiftUI | |||||
|
|
||||||
| /// A view that displays when the Point of Sale (POS) feature is not available for the current store. | ||||||
| /// Shows the specific reason why POS is ineligible and provides a button to re-check eligibility. | ||||||
| @available(iOS 17.0, *) | ||||||
| struct POSIneligibleView: View { | ||||||
| let reason: POSIneligibleReason | ||||||
| let onRefresh: () async throws -> Void | ||||||
| @Environment(\.dismiss) private var dismiss | ||||||
| @State private var isLoading: Bool = false | ||||||
|
|
||||||
| var body: some View { | ||||||
| VStack(spacing: POSSpacing.large) { | ||||||
| HStack { | ||||||
| Spacer() | ||||||
| Button { | ||||||
| dismiss() | ||||||
| } label: { | ||||||
| Text(Image(systemName: "xmark")) | ||||||
| .font(POSFontStyle.posButtonSymbolLarge.font()) | ||||||
| } | ||||||
| .foregroundColor(Color.posOnSurfaceVariantLowest) | ||||||
| } | ||||||
|
|
||||||
| VStack(spacing: 0) { | ||||||
| Spacer() | ||||||
|
|
||||||
| VStack(spacing: POSSpacing.medium) { | ||||||
| VStack(alignment: .center, spacing: 0) { | ||||||
| Image(PointOfSaleAssets.exclamationMark.imageName) | ||||||
| .resizable() | ||||||
| .frame(width: POSErrorAndAlertIconSize.large.dimension, | ||||||
| height: POSErrorAndAlertIconSize.large.dimension) | ||||||
|
|
||||||
| Text(reasonText) | ||||||
| .font(POSFontStyle.posHeadingBold.font()) | ||||||
| .multilineTextAlignment(.center) | ||||||
| .foregroundColor(Color.posOnSurface) | ||||||
|
|
||||||
| Button { | ||||||
| Task { @MainActor in | ||||||
| do { | ||||||
| isLoading = true | ||||||
| try await onRefresh() | ||||||
| isLoading = false | ||||||
| } catch { | ||||||
| // TODO-jc: handle error if needed, e.g., show an error message | ||||||
| print("Error refreshing eligibility: \(error)") | ||||||
| isLoading = false | ||||||
| Spacer() | ||||||
| .frame(height: POSSpacing.medium) | ||||||
|
|
||||||
| VStack(spacing: POSSpacing.small) { | ||||||
| Text(Localization.title) | ||||||
| .font(POSFontStyle.posHeadingBold.font()) | ||||||
| .multilineTextAlignment(.center) | ||||||
| .foregroundColor(Color.posOnSurface) | ||||||
|
|
||||||
| Text(suggestionText) | ||||||
| .font(POSFontStyle.posBodyLargeRegular().font()) | ||||||
| .multilineTextAlignment(.center) | ||||||
| .foregroundColor(Color.posOnSurface) | ||||||
| } | ||||||
| .containerRelativeFrame(.horizontal) { length, _ in | ||||||
| length * 0.5 | ||||||
| } | ||||||
|
|
||||||
| Spacer() | ||||||
| .frame(height: POSSpacing.large) | ||||||
|
|
||||||
| VStack(spacing: POSSpacing.medium) { | ||||||
| Button { | ||||||
| Task { @MainActor in | ||||||
| do { | ||||||
| isLoading = true | ||||||
| try await onRefresh() | ||||||
| isLoading = false | ||||||
| } catch { | ||||||
| // TODO: WOOMOB-720 - handle error if needed, e.g., show an error message | ||||||
| print("Error refreshing eligibility: \(error)") | ||||||
|
||||||
| isLoading = false | ||||||
| } | ||||||
| } | ||||||
| } label: { | ||||||
| Text(Localization.refreshEligibility) | ||||||
| } | ||||||
| } label: { | ||||||
| Text(Localization.refreshEligibility) | ||||||
| .buttonStyle(POSFilledButtonStyle(size: .normal, isLoading: isLoading)) | ||||||
|
|
||||||
| Button { | ||||||
| dismiss() | ||||||
| } label: { | ||||||
| Text(Localization.dismiss) | ||||||
| } | ||||||
| .buttonStyle(POSOutlinedButtonStyle(size: .normal)) | ||||||
| } | ||||||
| .containerRelativeFrame(.horizontal) { length, _ in | ||||||
| length * 0.5 - 132 | ||||||
|
||||||
| } | ||||||
| .buttonStyle(POSFilledButtonStyle(size: .normal, isLoading: isLoading)) | ||||||
| } | ||||||
|
|
||||||
| Spacer() | ||||||
| } | ||||||
| .padding(POSPadding.large) | ||||||
| } | ||||||
|
|
||||||
| private var reasonText: String { | ||||||
| private var suggestionText: String { | ||||||
| switch reason { | ||||||
| case .notTablet: | ||||||
| return NSLocalizedString("pos.ineligible.reason.notTablet", | ||||||
| value: "POS is only available on iPad.", | ||||||
| comment: "Ineligible reason: not a tablet") | ||||||
| return NSLocalizedString("pos.ineligible.suggestion.notTablet", | ||||||
| value: "Please use a tablet to access POS features.", | ||||||
| comment: "Suggestion for not tablet: use iPad") | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the tab show up on the phone? I can't see it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not now and in the near future, but it's an eligibility check that I thought it's better to throw an ineligible error than |
||||||
| case .unsupportedIOSVersion: | ||||||
| return NSLocalizedString("pos.ineligible.reason.unsupportedIOSVersion", | ||||||
| value: "POS requires a newer version of iOS 17 and above.", | ||||||
| comment: "Ineligible reason: iOS version too low") | ||||||
| case .unsupportedWooCommerceVersion: | ||||||
| return NSLocalizedString("pos.ineligible.reason.unsupportedWooCommerceVersion", | ||||||
| value: "Please update WooCommerce plugin to use POS.", | ||||||
| comment: "Ineligible reason: WooCommerce version too low") | ||||||
| return NSLocalizedString("pos.ineligible.suggestion.unsupportedIOSVersion", | ||||||
| value: "The POS system requires iOS 17 or later. Please update your device to iOS 17+ to use this feature.", | ||||||
|
||||||
| value: "The POS system requires iOS 17 or later. Please update your device to iOS 17+ to use this feature.", | |
| value: "Point of Sale requires iOS 17 or later. Please update your device to iOS 17+ to use this feature.", |
"The POS system" feels quite clumsy to read, I'd suggest replacing it with "Point of Sale" everywhere as it's clearer and shorter.
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.
Copy updated in 8ae5ba5.
Outdated
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.
| value: "The POS core feature must be enabled to proceed. " + | |
| value: "Point of Sale must be enabled to proceed. " + |
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.
Copy updated in 8ae5ba5.
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.
Is there an API we can use to just do this when people tap a button on this screen?
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.
Good point, there is pdfdoF-6VP-p2#endpoint, I created an issue to integrate with the API in WOOMOB-759.
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 don't see the tab in unsupported countries yet; I'm assuming that's just not changed yet 😊
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.
Similar to the previous comment https://github.com/woocommerce/woocommerce-ios/pull/15859/files#r2182744134, it's because the ineligible enum includes the cases that make the POS tab invisible. I will handle that in the separate issue linked there.
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.
😬 hope we don't need this one!




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: we have
POSSpacing.noneif you want. It doesn't make a big difference though – I can't see us ever changing the value of that constant!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.
Makes sense, updated in 33eb215.