Skip to content
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

Closed
wants to merge 10 commits into from

Conversation

fire-at-will
Copy link
Contributor

@fire-at-will fire-at-will commented Dec 10, 2024

Description

This PR updates the Customer Center to support the "Require users to update to the latest version of your app before contacting support" checkbox in the dashboard. The checkbox now controls:

  • Whether users must be on the most recent app version to contact support
  • Whether the AppUpdateWarningView is shown when the Customer Center is shown and the user is on an old app version

Testing

  • Tested manually
  • Added unit tests for the new CustomerCenterViewModel.appUpdateRequiredToContactSupport

@@ -550,6 +555,7 @@ extension CustomerCenterConfigData.Support {

init(from response: CustomerCenterConfigResponse.Support) {
self.email = response.email
self.shouldWarnCustomerToUpdate = response.shouldWarnCustomerToUpdate ?? false
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

@fire-at-will fire-at-will marked this pull request as ready for review December 10, 2024 21:32
@fire-at-will fire-at-will requested review from vegaro and a team December 10, 2024 21:32
Copy link
Member

@aboedo aboedo left a comment

Choose a reason for hiding this comment

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

looks great so far, left a question


/// Whether or not the user needs to update their app version to contact support.
var appUpdateRequiredToContactSupport: Bool {
// For now, we're using the same flag as the app update warning.
Copy link
Member

Choose a reason for hiding this comment

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

I'd remove the "for now", since it assumes some kind of temporal nature to it, and if we never change it later on it will look to a maintainer like this was temporary or hacky code

expect(viewModel.appUpdateRequiredToContactSupport).to(beFalse())
}

func testAppUpdateRequiredToContactSupport_false_blocked_by_config() {
Copy link
Member

Choose a reason for hiding this comment

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

the mix of casing here looks a little odd to my eye

Copy link
Member

Choose a reason for hiding this comment

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

I would maybe go with something more like
testAppUpdateRequiredToContactSupportReturnsFalseIfBlockedByConfig

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 :)

}

/// Whether or not the user needs to update their app version to contact support.
var appUpdateRequiredToContactSupport: Bool {
Copy link
Member

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?

Copy link
Contributor Author

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:

Require users to update to the latest version of your app before contacting support

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.

Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

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

A couple comments... I believe we shouldn't force people to update in order to contact support, which I think is what we're doing now

@@ -132,6 +132,7 @@ struct CustomerCenterConfigResponse {
struct Support {

let email: String
let shouldWarnCustomerToUpdate: Bool?
Copy link
Contributor

Choose a reason for hiding this comment

The 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 lastPublishedAppVersion, the SDK would consider it "enabled" implicitly. The backend shouldn't send that version if it's disabled. So this property would be unnecessary I think?

@@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm do we need to show the AppUpdateWarningView in the else case? As in, right now we won't be able to contact support if the app update is required right? Which I think we didn't want to do? Same for the WrongPlatformView.

@fire-at-will
Copy link
Contributor Author

Closing in favor of #4571

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants