-
Notifications
You must be signed in to change notification settings - Fork 319
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
[Customer Center] CustomerCenterViewModel checks whether the app is the latest version #4169
Conversation
Base branch is `integration/customer_support_workflow` so we don't merge into `main` yet Borrows a lot from #3865 Creates a new `CustomerCenterView` that can be used as a customer support workflow starting point. All details can be found in https://linear.app/revenuecat/project/sdk-support-workflow-cf7f6a1d5340/overview --------- Co-authored-by: Will Taylor <wtaylor151@gmail.com> Co-authored-by: James Borthwick <109382862+jamesrb1@users.noreply.github.com>
Adds `Purchases.shared.loadCustomerCenter()` that calls a new backend endpoint that returns the customer center configuration This API call doesn't exist yet and it will change. This PR is the ground work so that we don't have to wait for the backend to add this API and we can already pretend the API is there. --------- Co-authored-by: RevenueCat Git Bot <72824662+RCGitBot@users.noreply.github.com>
Based off #3933 https://github.com/RevenueCat/purchases-ios/assets/664544/11eae984-294a-4e14-8c40-7c2d50994c09 Can probably use some animations, but tuning that up will come up later It will open a feedback survey for an option if there's one
### Description This adds a modifier, `presentCustomerCenter` that can be used to more simply display the customer center. The API looks like: ``` .presentCustomerCenter(isPresented: self.$presentingCustomerCenter) { self.presentingCustomerCenter = false } ```
### Description This PR provides a possible approach to implementing an "action" handler. This allows developer to respond to events that happen during the customer support flow. The current approach consists of making `CustomerCenterActionHandler`, a lambda that receives an action that can be passed in by the developer. Then calling that with the appropriate action from the customer center. This PR also moves some code to the view model for simplicity and moving logic away from the view layer.
Adds displaying a Promotional Offer if the path has an offer id configured --------- Co-authored-by: JayShortway <29483617+JayShortway@users.noreply.github.com> Co-authored-by: RevenueCat Git Bot <72824662+RCGitBot@users.noreply.github.com>
### Description This is based on the changes in #3968 This PR: - Moves the strings currently hardcode into the `CustomerCenterConfigData.Localization` object. - Fixes an issue compiling paywall tester introduced in a previous PR - Modifies how we read backend strings to not account for the `common_` prefix, which is already removed by the backend.
Builds buttons from the Appearance object in the JSON
…nLocalizedString. (#4083)
I think this comes from a bad merge, because this project doesn't touch that file. Xcode is automatically cleaning it up
Add contact support button to the `ManageSubscriptionsView` --------- Co-authored-by: Toni Rico <toni.rico.diez@revenuecat.com>
We were not checking if the user is eligible for the promotional offer before trying to load it
- Adapt changes from RevenueCat/khepri#9707 which makes colors nullable and adds new colors for buttons - Change background and text color in all screens - Modified buttons to use `.buttonStyle(.borderedProminent)` so they look native by default - Applied accent color to back button in navigation view
I noticed the purchase button for the promo offers is always disabled. Changing the order of the modifiers fixes it
…urveyView on iOS 18. (#4144) Closes SDK-3519
The subscription details view could take advantage of more available space - expands details view - increases font sizes - wraps in a scrollview for smaller screen sizes - softens shadow - have buttons fill available space, limit width via container views | New | Old | |:-------------:|:-------------:| | ![New Version](https://github.com/user-attachments/assets/27c4a7fd-60be-4536-b88c-b2c9c6141c8f) | ![Old Version](https://github.com/user-attachments/assets/9bd80877-4fa6-4c7e-a813-5e7a3c1bbcc2) |
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.
Looking great!
RevenueCatUI/CustomerCenter/ViewModels/CustomerCenterViewModel.swift
Outdated
Show resolved
Hide resolved
RevenueCatUI/CustomerCenter/ViewModels/CustomerCenterViewModel.swift
Outdated
Show resolved
Hide resolved
] | ||
for (currentVersion, latestVersion, expectedAppIsLatestVersion) in testCases { |
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.
Can't wait until we can use parameterized tests from Swift Testing
https://github.com/swiftlang/swift-testing?tab=readme-ov-file#scalable-coverage-and-execution
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.
Yea somehow I often default to parameterized tests. Easy to cover many bases.
Swift Testing is Swift 6 only? We probably can't use that right away after it's released, right?
Tests/RevenueCatUITests/CustomerCenter/CustomerCenterViewModelTests.swift
Show resolved
Hide resolved
lol @jamesrb1 I just read this comment but I had the exact same thought. FWIW a very early early build of RevenueCatUI did use RegexBuilder, but we had to drop it when we extended compatibility to iOS 15 |
One day... but probably many days from now... |
@RCGitBot please test |
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.
Looks great!
Changed the label, because I'd imagine we don't want this under "New Features" in the changelog until it's properly released. |
**This is an automatic release.** ### New Features * Price rounding logic (#4132) via James Borthwick (@jamesrb1) ### Bugfixes * [Customer Center] Migrate to List style (#4190) via Cody Kerns (@codykerns) * [Paywalls] Improve locale consistency (#4158) via Josh Holtz (@joshdholtz) * Set Paywalls Tester deployment target to iOS 15 (#4196) via James Borthwick (@jamesrb1) * [Customer Center] Hide Contact Support button if URL can't be created (#4192) via Cesar de la Vega (@vegaro) * Fix the setting for SKIP_INSTALL in Xcode project (#4195) via Andy Boedo (@aboedo) * [Customer Center] Improving customer center buttons (#4165) via Cody Kerns (@codykerns) * Revert workaround for iOS 18 beta 5 SwiftUI crash (#4173) via Mark Villacampa (@MarkVillacampa) * [Paywalls] Make iOS version calculation lazy (#4163) via Mark Villacampa (@MarkVillacampa) * [Paywalls] Observe `PurchaseHandler` when owned externally (#4097) via James Borthwick (@jamesrb1) ### Other Changes * [Customer Center] Clean up colors in WrongPlatformView and NoSubscriptionsView (#4204) via Cesar de la Vega (@vegaro) * Fix failing `all-tests` and retry more flaky tests (#4188) via Josh Holtz (@joshdholtz) * Compatibility content unavailable improvements (#4197) via James Borthwick (@jamesrb1) * Create lane to enable customer center (#4191) via Cesar de la Vega (@vegaro) * XCFramework artifacts in CircleCI (#4189) via Andy Boedo (@aboedo) * [Customer Center] CustomerCenterViewModel checks whether the app is the latest version (#4169) via JayShortway (@JayShortway) * export RevenueCatUI xcframework (#4172) via Andy Boedo (@aboedo) * Corrects references from ManageSubscriptionsButtonStyle to ButtonsStyle. (#4186) via JayShortway (@JayShortway) * Speed up carthage installation tests (#4184) via Andy Boedo (@aboedo) * Customer center improvements (#4166) via James Borthwick (@jamesrb1) * replace `color(from colorInformation:)` global with extension (#4183) via Andy Boedo (@aboedo) * Fix tests in main (#4174) via Andy Boedo (@aboedo) * Enable customer center tests (#4171) via James Borthwick (@jamesrb1) * [Customer Center] Initial implementation (#3967) via Cesar de la Vega (@vegaro) --------- Co-authored-by: Josh Holtz <me@joshholtz.com>
**This is an automatic release.** ### New Features * Price rounding logic (#4132) via James Borthwick (@jamesrb1) ### Bugfixes * [Customer Center] Migrate to List style (#4190) via Cody Kerns (@codykerns) * [Paywalls] Improve locale consistency (#4158) via Josh Holtz (@joshdholtz) * Set Paywalls Tester deployment target to iOS 15 (#4196) via James Borthwick (@jamesrb1) * [Customer Center] Hide Contact Support button if URL can't be created (#4192) via Cesar de la Vega (@vegaro) * Fix the setting for SKIP_INSTALL in Xcode project (#4195) via Andy Boedo (@aboedo) * [Customer Center] Improving customer center buttons (#4165) via Cody Kerns (@codykerns) * Revert workaround for iOS 18 beta 5 SwiftUI crash (#4173) via Mark Villacampa (@MarkVillacampa) * [Paywalls] Make iOS version calculation lazy (#4163) via Mark Villacampa (@MarkVillacampa) * [Paywalls] Observe `PurchaseHandler` when owned externally (#4097) via James Borthwick (@jamesrb1) ### Other Changes * [Customer Center] Clean up colors in WrongPlatformView and NoSubscriptionsView (#4204) via Cesar de la Vega (@vegaro) * Fix failing `all-tests` and retry more flaky tests (#4188) via Josh Holtz (@joshdholtz) * Compatibility content unavailable improvements (#4197) via James Borthwick (@jamesrb1) * Create lane to enable customer center (#4191) via Cesar de la Vega (@vegaro) * XCFramework artifacts in CircleCI (#4189) via Andy Boedo (@aboedo) * [Customer Center] CustomerCenterViewModel checks whether the app is the latest version (#4169) via JayShortway (@JayShortway) * export RevenueCatUI xcframework (#4172) via Andy Boedo (@aboedo) * Corrects references from ManageSubscriptionsButtonStyle to ButtonsStyle. (#4186) via JayShortway (@JayShortway) * Speed up carthage installation tests (#4184) via Andy Boedo (@aboedo) * Customer center improvements (#4166) via James Borthwick (@jamesrb1) * replace `color(from colorInformation:)` global with extension (#4183) via Andy Boedo (@aboedo) * Fix tests in main (#4174) via Andy Boedo (@aboedo) * Enable customer center tests (#4171) via James Borthwick (@jamesrb1) * [Customer Center] Initial implementation (#3967) via Cesar de la Vega (@vegaro) --------- Co-authored-by: Josh Holtz <me@joshholtz.com>
In this PR
CustomerCenterViewModel
allowing it to check if the app is the latest version.SemanticVersion
struct is added which encapsulates version parsing and comparison logic.CustomerCenterViewModel
are consolidated somewhat with the use of default arguments, for simplification and to be able to more easily add fake values for the current app version in tests.Not in this PR
Any UI changes. Will be in a follow-up.