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 toggling update warnings & show update in restore flow #4571

Merged
merged 17 commits into from
Dec 11, 2024

Conversation

fire-at-will
Copy link
Contributor

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

Description

This PR:

  • Uses the Support.shouldWarnCustomerToUpdate boolean from the backend to determine if update warnings should be displayed to the user
  • Switches the restore flow from using a SwiftUI Alert to a ConfirmationDialog since we have up to 3 actions that a user can take, and Alert only supports a max of 2
  • Adds message & button to the restore flow to instruct the user to update their app if no purchases are found, Support.shouldWarnCustomerToUpdate is enabled, and the user is an old app version

Warning

This PR is a breaking change from a UI standpoint because it now requires Support.shouldWarnCustomerToUpdate to be set for the AppUpdateWarningView to be displayed. This hasn't been enabled by default yet, so most people using Customer Center so far will need to enable the checkbox to see the warnings.

Follow-Up Actions

  • Update the copy of the checkbox in the dashboard from "Require users to update to the latest version of your app before contacting support" to something like "Show a warning to users not on the latest version of your app"
  • Consider enabling the checkbox by default

Screenshots

Restore Flow

iOS

01_RESTORE_PURCHASES_CHECK_PAST_PURCHASES
02_RESTORE_PURCHASES_CONTACT_SUPPORT
03_RESTORE_PURCHASES_SHOW_UPDATE

iPadOS

simulator_screenshot_ED2960CA-C996-4717-80D1-970ED4776529

macOS (Designed for iPad)

image

@@ -117,6 +125,13 @@ import RevenueCat
func loadCustomerCenterConfig() async {
do {
self.configuration = try await Purchases.shared.loadCustomerCenter()
if let productId = configuration?.productId {
Copy link
Contributor Author

@fire-at-will fire-at-will Dec 11, 2024

Choose a reason for hiding this comment

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

Moved this from the AppUpdateWarningView to centralize the logic into one place since it's also used in the restore flow now

@fire-at-will fire-at-will marked this pull request as ready for review December 11, 2024 17:26
@fire-at-will fire-at-will changed the title WIP: Support toggling update warnings Support toggling update warnings & show update in restore flow Dec 11, 2024
private(set) var onUpdateAppClick: (() -> Void)?

/// Whether or not the Customer Center should warn the customer that they're on an outdated version of the app.
var shouldShowAppUpdateWarnings: Bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be private(var)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it can - since it's used in other views it needs to be non-private and it can't be made private(set) because it's a computed property

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

is this nullable in the response?

Copy link
Contributor Author

@fire-at-will fire-at-will Dec 11, 2024

Choose a reason for hiding this comment

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

Yeah, some configurations made from before the field was introduced don't have it. It's also nullable in the dashboard!

@fire-at-will fire-at-will merged commit f87bd03 into main Dec 11, 2024
10 checks passed
@fire-at-will fire-at-will deleted the support-toggling-update-warnings branch December 11, 2024 21:16
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.

2 participants