-
Notifications
You must be signed in to change notification settings - Fork 328
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
Support not showing Contact Customer Support if the user isn't on the most recent app version #4567
Changes from 7 commits
494cb2f
345e4dd
25e93c7
d839fac
d43953d
0baa665
441f3f1
c66d336
2972a4d
dac49f9
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 |
---|---|---|
|
@@ -20,7 +20,10 @@ enum CustomerCenterConfigTestData { | |
|
||
@available(iOS 14.0, *) | ||
// swiftlint:disable:next function_body_length | ||
static func customerCenterData(lastPublishedAppVersion: String?) -> CustomerCenterConfigData { | ||
static func customerCenterData( | ||
lastPublishedAppVersion: String?, | ||
shouldWarnCustomerToUpdate: Bool = false | ||
) -> CustomerCenterConfigData { | ||
CustomerCenterConfigData( | ||
screens: [.management: | ||
.init( | ||
|
@@ -111,7 +114,10 @@ enum CustomerCenterConfigTestData { | |
"back": "Back" | ||
] | ||
), | ||
support: .init(email: "[email protected]"), | ||
support: .init( | ||
email: "[email protected]", | ||
shouldWarnCustomerToUpdate: true | ||
), | ||
lastPublishedAppVersion: lastPublishedAppVersion, | ||
productId: 1 | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,7 +83,7 @@ struct RestorePurchasesAlert: ViewModifier { | |
|
||
case .purchasesNotFound: | ||
let message = Text(localization.commonLocalizedString(for: .purchasesNotRecovered)) | ||
if let url = supportURL { | ||
if let url = supportURL, !customerCenterViewModel.appUpdateRequiredToContactSupport { | ||
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. Hmm do we need to show the |
||
return Alert(title: Text(""), | ||
message: message, | ||
primaryButton: .default( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -412,9 +412,14 @@ public struct CustomerCenterConfigData { | |
public struct Support { | ||
|
||
public let email: String | ||
public let shouldWarnCustomerToUpdate: Bool | ||
|
||
public init(email: String) { | ||
public init( | ||
email: String, | ||
shouldWarnCustomerToUpdate: Bool | ||
) { | ||
self.email = email | ||
self.shouldWarnCustomerToUpdate = shouldWarnCustomerToUpdate | ||
} | ||
|
||
} | ||
|
@@ -550,6 +555,7 @@ extension CustomerCenterConfigData.Support { | |
|
||
init(from response: CustomerCenterConfigResponse.Support) { | ||
self.email = response.email | ||
self.shouldWarnCustomerToUpdate = response.shouldWarnCustomerToUpdate ?? false | ||
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. Defaults to false if it isn't included in the response from the backend since the checkbox's default value in the dashboard is false. |
||
} | ||
|
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,6 +132,7 @@ struct CustomerCenterConfigResponse { | |
struct Support { | ||
|
||
let email: String | ||
let shouldWarnCustomerToUpdate: Bool? | ||
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. Hmm I'm thinking... the original idea was that, if the backend sent the |
||
|
||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,10 @@ import XCTest | |
|
||
class ContactSupportUtilitiesTest: TestCase { | ||
|
||
private let support: CustomerCenterConfigData.Support = .init(email: "[email protected]") | ||
private let support: CustomerCenterConfigData.Support = .init( | ||
email: "[email protected]", | ||
shouldWarnCustomerToUpdate: false | ||
) | ||
private let localization: CustomerCenterConfigData.Localization = .init(locale: "en_US", localizedStrings: [:]) | ||
|
||
func testSupportEmailBodyWithDefaultDataIsCorrect() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ import XCTest | |
|
||
#if os(iOS) | ||
|
||
// swiftlint:disable file_length | ||
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *) | ||
@available(macOS, unavailable) | ||
@available(tvOS, unavailable) | ||
|
@@ -218,6 +219,55 @@ class CustomerCenterViewModelTests: TestCase { | |
} | ||
} | ||
|
||
func testAppUpdateRequiredToContactSupport_true() { | ||
let mockPurchases = MockCustomerCenterPurchases() | ||
let latestVersion = "3.0.0" | ||
let currentVersion = "2.0.0" | ||
let viewModel = CustomerCenterViewModel( | ||
customerCenterActionHandler: nil, | ||
currentVersionFetcher: { return currentVersion }, | ||
purchasesProvider: mockPurchases | ||
) | ||
viewModel.configuration = CustomerCenterConfigTestData.customerCenterData( | ||
lastPublishedAppVersion: latestVersion, | ||
shouldWarnCustomerToUpdate: true | ||
) | ||
|
||
expect(viewModel.appUpdateRequiredToContactSupport).to(beTrue()) | ||
} | ||
|
||
func testAppUpdateRequiredToContactSupport_false() { | ||
let mockPurchases = MockCustomerCenterPurchases() | ||
let latestVersion = "3.0.0" | ||
let viewModel = CustomerCenterViewModel( | ||
customerCenterActionHandler: nil, | ||
currentVersionFetcher: { return latestVersion }, | ||
purchasesProvider: mockPurchases | ||
) | ||
viewModel.configuration = CustomerCenterConfigTestData.customerCenterData( | ||
lastPublishedAppVersion: latestVersion, | ||
shouldWarnCustomerToUpdate: true | ||
) | ||
|
||
expect(viewModel.appUpdateRequiredToContactSupport).to(beFalse()) | ||
} | ||
|
||
func testAppUpdateRequiredToContactSupport_false_blocked_by_config() { | ||
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. the mix of casing here looks a little odd to my eye 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. I would maybe go with something more like 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. Ah, sometimes I mix them when the test names get super long in my apps - I'll change them to use the normal style here :) |
||
let mockPurchases = MockCustomerCenterPurchases() | ||
let latestVersion = "3.0.0" | ||
let viewModel = CustomerCenterViewModel( | ||
customerCenterActionHandler: nil, | ||
currentVersionFetcher: { return latestVersion }, | ||
purchasesProvider: mockPurchases | ||
) | ||
viewModel.configuration = CustomerCenterConfigTestData.customerCenterData( | ||
lastPublishedAppVersion: latestVersion, | ||
shouldWarnCustomerToUpdate: true | ||
) | ||
|
||
expect(viewModel.appUpdateRequiredToContactSupport).to(beFalse()) | ||
} | ||
|
||
} | ||
|
||
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,7 +106,10 @@ class CustomerCenterConfigDataTests: TestCase { | |
) | ||
], | ||
localization: .init(locale: "en_US", localizedStrings: ["key": "value"]), | ||
support: .init(email: "[email protected]") | ||
support: .init( | ||
email: "[email protected]", | ||
shouldWarnCustomerToUpdate: false | ||
) | ||
), | ||
lastPublishedAppVersion: "1.2.3", | ||
itunesTrackId: 123 | ||
|
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.
we don't entirely require but rather suggest, right?
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.
With this implementation, I built it the way the copy for the checkbox on the dashboard is worded and made it required to contact support in the WrongPlatformView & the Restore Purchases flow.
The checkbox's copy reads:
That said, I don't think it's great to prevent people from contacting support and would suggest that we instead show a message or button in the alert urging the user to update in addition to letting them contact support.