Skip to content

Commit 292b486

Browse files
authored
[POS as a tab i2] Update suggestion text in ineligible UI (#15943)
2 parents 8ded2dd + 0c8c720 commit 292b486

File tree

4 files changed

+42
-26
lines changed

4 files changed

+42
-26
lines changed

WooCommerce/Classes/POS/TabBar/POSIneligibleView.swift

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ struct POSIneligibleView: View {
112112
private var suggestionText: String {
113113
switch reason {
114114
case .unsupportedIOSVersion:
115-
return NSLocalizedString("pos.ineligible.suggestion.unsupportedIOSVersion",
116-
value: "Point of Sale requires iOS 17 or later. Please update your device to iOS 17+ to use this feature.",
115+
return NSLocalizedString("pos.ineligible.suggestion.unsupportedIOSVersion.1",
116+
value: "The POS system requires iOS 17 or later. Please update your device to iOS 17+ to use this feature.",
117117
comment: "Suggestion for unsupported iOS version: update iOS")
118118
case let .unsupportedWooCommerceVersion(minimumVersion):
119119
let format = NSLocalizedString("pos.ineligible.suggestion.unsupportedWooCommerceVersion",
@@ -123,29 +123,32 @@ struct POSIneligibleView: View {
123123
"%1$@ is a placeholder for the minimum required version.")
124124
return String.localizedStringWithFormat(format, minimumVersion)
125125
case .wooCommercePluginNotFound:
126-
return NSLocalizedString("pos.ineligible.suggestion.wooCommercePluginNotFound.2",
127-
value: "Please make sure the WooCommerce plugin is installed and activated from your WordPress admin. " +
128-
"If there is still an issue, please contact support for assistance.",
126+
return NSLocalizedString("pos.ineligible.suggestion.wooCommercePluginNotFound.3",
127+
value: "We were unable to load the WooCommerce plugin info. Please make sure the WooCommerce plugin is installed " +
128+
"and activated from your WordPress admin. If there is still an issue, contact support for assistance.",
129129
comment: "Suggestion for missing WooCommerce plugin: install plugin")
130130
case .featureSwitchDisabled:
131-
return NSLocalizedString("pos.ineligible.suggestion.featureSwitchDisabled.2",
131+
return NSLocalizedString("pos.ineligible.suggestion.featureSwitchDisabled.3",
132132
value: "Point of Sale must be enabled to proceed. " +
133-
"You can enable the POS feature below or from your WordPress admin under WooCommerce settings > Advanced > Features.",
133+
"Please enable the POS feature below or from your WordPress admin under WooCommerce settings > Advanced > Features " +
134+
"and try again.",
134135
comment: "Suggestion for disabled feature switch: enable feature in WooCommerce settings")
135-
case let .unsupportedCurrency(supportedCurrencies):
136+
case let .unsupportedCurrency(countryCode, supportedCurrencies):
136137
let currencyList = supportedCurrencies.map { $0.rawValue }
137138
let formattedCurrencyList = ListFormatter.localizedString(byJoining: currencyList)
138139
let format = NSLocalizedString(
139-
"pos.ineligible.suggestion.unsupportedCurrency",
140-
value: "The POS system is not available for your store’s currency. It currently supports only %1$@. " +
140+
"pos.ineligible.suggestion.unsupportedCurrency.1",
141+
value: "The POS system is not available for your store’s currency. In %1$@, it currently supports only %2$@. " +
141142
"Please check your store currency settings or contact support for assistance.",
142143
comment: "Suggestion for unsupported currency with list of supported currencies. " +
143-
"%1$@ is a placeholder for the localized list of supported currency codes."
144+
"%1$@ is a placeholder for the localized country name, " +
145+
"and %2$@ is a placeholder for the localized list of supported currency codes."
144146
)
145-
return String.localizedStringWithFormat(format, formattedCurrencyList)
147+
return String.localizedStringWithFormat(format, countryCode.readableCountry, formattedCurrencyList)
146148
case .siteSettingsNotAvailable:
147-
return NSLocalizedString("pos.ineligible.suggestion.siteSettingsNotAvailable",
148-
value: "Check your internet connection and try again. If the issue persists, please contact support.",
149+
return NSLocalizedString("pos.ineligible.suggestion.siteSettingsNotAvailable.1",
150+
value: "We were unable to load the site settings info. Please check your internet connection and try again. " +
151+
"If the issue persists, contact support for assistance.",
149152
comment: "Suggestion for site settings unavailable: check connection or contact support")
150153
case .selfDeallocated:
151154
return NSLocalizedString("pos.ineligible.suggestion.selfDeallocated",
@@ -192,8 +195,8 @@ private extension POSIneligibleReason {
192195
switch self {
193196
case .featureSwitchDisabled:
194197
return NSLocalizedString(
195-
"pos.ineligible.enable.pos.feature.and.refresh.button.title",
196-
value: "Enable POS & Retry",
198+
"pos.ineligible.enable.pos.feature.and.refresh.button.title.1",
199+
value: "Enable POS feature",
197200
comment: "Button title to enable the POS feature switch and refresh POS eligibility check"
198201
)
199202
case .unsupportedIOSVersion,
@@ -216,7 +219,7 @@ private extension POSIneligibleReason {
216219
#Preview("Unsupported currency") {
217220
if #available(iOS 17.0, *) {
218221
POSIneligibleView(
219-
reason: .unsupportedCurrency(supportedCurrencies: [.USD]),
222+
reason: .unsupportedCurrency(countryCode: .US, supportedCurrencies: [.USD]),
220223
onRefresh: {}
221224
)
222225
}

WooCommerce/Classes/ViewRelated/Dashboard/Settings/POS/POSTabEligibilityChecker.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ enum POSIneligibleReason: Equatable {
2424
case siteSettingsNotAvailable
2525
case wooCommercePluginNotFound
2626
case featureSwitchDisabled
27-
case unsupportedCurrency(supportedCurrencies: [CurrencyCode])
27+
case unsupportedCurrency(countryCode: CountryCode, supportedCurrencies: [CurrencyCode])
2828
case selfDeallocated
2929
}
3030

@@ -212,7 +212,7 @@ private extension POSTabEligibilityChecker {
212212
enum SiteSettingsIneligibleReason {
213213
case siteSettingsNotAvailable
214214
case unsupportedCountry(supportedCountries: [CountryCode])
215-
case unsupportedCurrency(supportedCurrencies: [CurrencyCode])
215+
case unsupportedCurrency(countryCode: CountryCode, supportedCurrencies: [CurrencyCode])
216216
}
217217

218218
func checkSiteSettingsEligibility() async -> POSEligibilityState {
@@ -227,8 +227,8 @@ private extension POSTabEligibilityChecker {
227227
// changed to an unsupported country during the session. In this case, we return an ineligible reason that prompts the merchant to
228228
// relaunch the app.
229229
return .ineligible(reason: .siteSettingsNotAvailable)
230-
case let .unsupportedCurrency(supportedCurrencies: supportedCurrencies):
231-
return .ineligible(reason: .unsupportedCurrency(supportedCurrencies: supportedCurrencies))
230+
case let .unsupportedCurrency(countryCode: countryCode, supportedCurrencies: supportedCurrencies):
231+
return .ineligible(reason: .unsupportedCurrency(countryCode: countryCode, supportedCurrencies: supportedCurrencies))
232232
}
233233
}
234234
}
@@ -270,7 +270,7 @@ private extension POSTabEligibilityChecker {
270270

271271
let supportedCurrenciesForCountry = supportedCurrencies[countryCode] ?? []
272272
guard supportedCurrenciesForCountry.contains(currencyCode) else {
273-
return .ineligible(reason: .unsupportedCurrency(supportedCurrencies: supportedCurrenciesForCountry))
273+
return .ineligible(reason: .unsupportedCurrency(countryCode: countryCode, supportedCurrencies: supportedCurrenciesForCountry))
274274
}
275275
return .eligible
276276
}

WooCommerce/WooCommerceTests/POS/ViewHelpers/PointOfSaleDashboardViewHelperTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ struct PointOfSaleDashboardViewHelperTests {
6767
@Test(arguments: [
6868
POSIneligibleReason.unsupportedIOSVersion,
6969
POSIneligibleReason.unsupportedWooCommerceVersion(minimumVersion: "9.6.0"),
70-
POSIneligibleReason.unsupportedCurrency(supportedCurrencies: [.USD, .GBP]),
70+
POSIneligibleReason.unsupportedCurrency(countryCode: .US, supportedCurrencies: [.USD, .GBP]),
7171
POSIneligibleReason.siteSettingsNotAvailable,
7272
POSIneligibleReason.wooCommercePluginNotFound,
7373
POSIneligibleReason.featureSwitchDisabled,

WooCommerce/WooCommerceTests/ViewRelated/Settings/POS/POSTabEligibilityCheckerTests.swift

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ struct POSTabEligibilityCheckerTests {
451451
let result = await checker.checkEligibility()
452452

453453
// Then
454-
#expect(result == .ineligible(reason: .unsupportedCurrency(supportedCurrencies: expectedSupportedCurrencies)))
454+
#expect(result == .ineligible(reason: .unsupportedCurrency(countryCode: country.countryCode, supportedCurrencies: expectedSupportedCurrencies)))
455455
}
456456

457457
func is_ineligible_when_woocommerce_version_is_below_minimum() async throws {
@@ -551,7 +551,7 @@ struct POSTabEligibilityCheckerTests {
551551

552552
@Test(arguments: [
553553
POSIneligibleReason.siteSettingsNotAvailable,
554-
POSIneligibleReason.unsupportedCurrency(supportedCurrencies: [.USD])
554+
POSIneligibleReason.unsupportedCurrency(countryCode: .US, supportedCurrencies: [.USD])
555555
])
556556
fileprivate func refreshEligibility_syncs_site_settings_and_checks_eligibility_for_site_settings_issues(ineligibleReason: POSIneligibleReason) async throws {
557557
// Given
@@ -586,7 +586,7 @@ struct POSTabEligibilityCheckerTests {
586586

587587
@Test(arguments: [
588588
POSIneligibleReason.siteSettingsNotAvailable,
589-
POSIneligibleReason.unsupportedCurrency(supportedCurrencies: [.USD])
589+
POSIneligibleReason.unsupportedCurrency(countryCode: .US, supportedCurrencies: [.USD])
590590
])
591591
fileprivate func refreshEligibility_returns_siteSettingsNotAvailable_when_site_settings_sync_fails(ineligibleReason: POSIneligibleReason) async throws {
592592
// Given
@@ -828,6 +828,19 @@ private extension POSTabEligibilityCheckerTests {
828828
case ca = "CA:NS"
829829
case gb = "GB"
830830
case es = "ES"
831+
832+
var countryCode: CountryCode {
833+
switch self {
834+
case .us:
835+
return .US
836+
case .ca:
837+
return .CA
838+
case .gb:
839+
return .GB
840+
case .es:
841+
return .ES
842+
}
843+
}
831844
}
832845

833846
func mockCountrySetting(country: Country, siteID: Int64? = nil) -> SiteSetting {

0 commit comments

Comments
 (0)