-
Notifications
You must be signed in to change notification settings - Fork 329
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
Merged
Merged
Changes from 54 commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
444d450
Create file
vegaro c5aaf56
[Customer Center] Create `CustomerCenterView` (#3919)
vegaro 9bc2c08
[Customer Center] Add API call to get Customer Center config (#3933)
vegaro fec9486
[Customer Center] Build feedback survey from JSON (#3959)
vegaro b087782
[Customer Center] Show the right subscription on the Manage Subscript…
JayShortway 6cd489f
[CustomerCenter] Add `presentCustomerCenter` modifier (#4053)
tonidero 5ea67b2
[Customer Center] Adds the Customer Center to PaywallsTester (#4055)
JayShortway 5030a3c
[Customer Center] Improves the UI of the current subscription (#4072)
JayShortway 1868044
[Customer Center] Updates the presentation of the refund status (#4082)
JayShortway 2a9cd2c
[CustomerCenter] Add action handler (#4057)
tonidero fa06324
[Customer Center] Promotional Offers support (#3968)
vegaro 0d7530e
Move No subscriptions page strings to Localization (#4089)
tonidero bd7e4c9
Merge branch 'main' into integration/customer_support_workflow
tonidero b45e274
[Customer Center] Add colors support (#3983)
vegaro dcbfb7d
[Customer Center] SubscriptionDetailsView gets its strings from Commo…
JayShortway ced36e8
Merge branch 'main' into integration/customer_support_workflow
vegaro e3f9250
Merge branch 'main' into integration/customer_support_workflow
vegaro dc22e0d
ignore tags
vegaro acbc391
[Customer Center] Fix project.pbxproj (#4122)
vegaro 29340ca
[Customer Center] Fix `BackendGetCustomerCenterConfigTests` (#4124)
vegaro 7a9e3e9
Merge branch 'main' into integration/customer_support_workflow
vegaro 2977e6b
[Customer Center] Add contact support button (#4023)
vegaro b6a3069
Merge branch 'main' into integration/customer_support_workflow
vegaro c255107
[Customer Center] Fix checking eligibility (#4138)
vegaro 167a609
[Customer Center] Make colors nullable (#4134)
vegaro 43ad9b1
Merge branch 'main' into integration/customer_support_workflow
vegaro dbd43aa
[Customer Center] Fix for disabled promo offer button (#4142)
vegaro 6084a2c
Version 5.2.2-customercenter.alpha.3
vegaro 7e9b355
[Customer Center] Fixes an extra blank screen after popping FeedbackS…
JayShortway e1b0cf4
[Customer Center] Improve subscription details view (#4152)
codykerns 92db864
Customer Center compilation flag (#4149)
aboedo 789d26a
Merge branch 'main' of github.com:RevenueCat/purchases-ios into integ…
tonidero c52f3cf
[Customer Center] UI polish for empty content (#4147)
codykerns 3662879
[Customer Center] Use system navigation titles (#4161)
codykerns 9284107
Disable `CustomerCenter` build flags (#4160)
tonidero 759fd53
Fix compilation issues in older targets
tonidero ae44b59
Adds SemanticVersion
JayShortway 52195fb
Revert "Disable `CustomerCenter` build flags (#4160)"
JayShortway f1e4da2
CustomerCenterViewModel checks whether the app is the latest version.
JayShortway 9e943fa
Merge branch 'main' into check-latest-version
JayShortway 08000e5
Cleanup
JayShortway 9d5cffb
More cleanup.
JayShortway b11307b
Merge branch 'main' into check-latest-version
JayShortway dc1f795
CustomerCenterConfigResponse now provides lastPublishedAppVersion.
JayShortway be65640
Fixes CustomerCenterConfigDataTests.
JayShortway 507d91c
Adds some more test cases.
JayShortway 71171ac
Correctly (?) adds SemanticVersion to Xcode.
JayShortway 5be6750
Fixes some warnings and adds the compiler flag to SemanticVersion[Tes…
JayShortway 305d28e
Fixes a compile error.
JayShortway b9e241b
Fixes some warnings.
JayShortway 50d7102
SemanticVersion only accepts UInts now.
JayShortway 54c6ff6
appIsLatestVersion is initialized with defaultAppIsLatestVersion.
JayShortway 8072747
Renames takeVersion to versionString.
JayShortway a64e6b4
Fixes a compilation error in SemanticVersionTests.
JayShortway 385ab4e
defaultAppIsLatestVersion is static now.
JayShortway bbe3fca
Revert "Disable `CustomerCenter` build flags (#4160)"
tonidero 7329cb6
Uses the existing SystemInfo.appVersion.
JayShortway 19b7881
Uses a single guard let statement.
JayShortway 1473222
Adds some more test cases.
JayShortway 1ae81ea
Revert "Revert "Disable `CustomerCenter` build flags (#4160)""
JayShortway d32e24a
Uses CFBundleShortVersionString directly.
JayShortway b72d05c
Fixes CustomerCenterConfigDataAPI.
JayShortway aae889a
Revert "Disable `CustomerCenter` build flags (#4160)"
tonidero 1412b6b
Revert "Revert "Disable `CustomerCenter` build flags (#4160)""
JayShortway 0c2bdaa
Merge branch 'main' into check-latest-version
JayShortway 129b124
Merge branch 'main' into check-latest-version
JayShortway File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,87 +21,94 @@ import RevenueCat | |
enum CustomerCenterConfigTestData { | ||
|
||
@available(iOS 14.0, *) | ||
static let customerCenterData = CustomerCenterConfigData( | ||
screens: [.management: | ||
.init( | ||
type: .management, | ||
title: "Manage Subscription", | ||
subtitle: "Manage your subscription details here", | ||
paths: [ | ||
.init( | ||
id: "1", | ||
title: "Didn't receive purchase", | ||
type: .missingPurchase, | ||
detail: nil | ||
), | ||
.init( | ||
id: "2", | ||
title: "Request a refund", | ||
type: .refundRequest, | ||
detail: .promotionalOffer(CustomerCenterConfigData.HelpPath.PromotionalOffer( | ||
iosOfferId: "offer_id", | ||
eligible: true, | ||
title: "title", | ||
subtitle: "subtitle" | ||
)) | ||
), | ||
.init( | ||
id: "3", | ||
title: "Change plans", | ||
type: .changePlans, | ||
detail: nil | ||
), | ||
.init( | ||
id: "4", | ||
title: "Cancel subscription", | ||
type: .cancel, | ||
detail: .feedbackSurvey(.init( | ||
title: "Why are you cancelling?", | ||
options: [ | ||
.init( | ||
id: "1", | ||
title: "Too expensive", | ||
promotionalOffer: nil | ||
), | ||
.init( | ||
id: "2", | ||
title: "Don't use the app", | ||
promotionalOffer: nil | ||
), | ||
.init( | ||
id: "3", | ||
title: "Bought by mistake", | ||
promotionalOffer: nil | ||
) | ||
] | ||
)) | ||
) | ||
] | ||
), | ||
.noActive: .init( | ||
type: .noActive, | ||
title: "No Active Subscription", | ||
subtitle: "You currently have no active subscriptions", | ||
paths: [ | ||
.init( | ||
id: "9q9719171o", | ||
title: "Check purchases", | ||
type: .missingPurchase, | ||
detail: nil | ||
) | ||
] | ||
) | ||
], | ||
appearance: standardAppearance, | ||
localization: .init( | ||
locale: "en_US", | ||
localizedStrings: [ | ||
"cancel": "Cancel", | ||
"back": "Back" | ||
] | ||
), | ||
support: .init(email: "[email protected]") | ||
) | ||
// swiftlint:disable:next function_body_length | ||
static func customerCenterData(lastPublishedAppVersion: String?) -> CustomerCenterConfigData { | ||
CustomerCenterConfigData( | ||
screens: [.management: | ||
.init( | ||
type: .management, | ||
title: "Manage Subscription", | ||
subtitle: "Manage your subscription details here", | ||
paths: [ | ||
.init( | ||
id: "1", | ||
title: "Didn't receive purchase", | ||
type: .missingPurchase, | ||
detail: nil | ||
), | ||
.init( | ||
id: "2", | ||
title: "Request a refund", | ||
type: .refundRequest, | ||
detail: .promotionalOffer(CustomerCenterConfigData.HelpPath.PromotionalOffer( | ||
iosOfferId: "offer_id", | ||
eligible: true, | ||
title: "title", | ||
subtitle: "subtitle" | ||
)) | ||
), | ||
.init( | ||
id: "3", | ||
title: "Change plans", | ||
type: .changePlans, | ||
detail: nil | ||
), | ||
.init( | ||
id: "4", | ||
title: "Cancel subscription", | ||
type: .cancel, | ||
detail: .feedbackSurvey(.init( | ||
title: "Why are you cancelling?", | ||
options: [ | ||
.init( | ||
id: "1", | ||
title: "Too expensive", | ||
promotionalOffer: nil | ||
), | ||
.init( | ||
id: "2", | ||
title: "Don't use the app", | ||
promotionalOffer: nil | ||
), | ||
.init( | ||
id: "3", | ||
title: "Bought by mistake", | ||
promotionalOffer: nil | ||
) | ||
] | ||
)) | ||
) | ||
] | ||
), | ||
.noActive: .init( | ||
type: .noActive, | ||
title: "No Active Subscription", | ||
subtitle: "You currently have no active subscriptions", | ||
paths: [ | ||
.init( | ||
id: "9q9719171o", | ||
title: "Check purchases", | ||
type: .missingPurchase, | ||
detail: nil | ||
) | ||
] | ||
) | ||
], | ||
appearance: standardAppearance, | ||
localization: .init( | ||
locale: "en_US", | ||
localizedStrings: [ | ||
"cancel": "Cancel", | ||
"back": "Back" | ||
] | ||
), | ||
support: .init(email: "[email protected]"), | ||
lastPublishedAppVersion: lastPublishedAppVersion | ||
) | ||
} | ||
|
||
@available(iOS 14.0, *) | ||
static let customerCenterData = customerCenterData(lastPublishedAppVersion: "1.0.0") | ||
|
||
static let standardAppearance = CustomerCenterConfigData.Appearance( | ||
accentColor: .init(light: "#007AFF", dark: "#007AFF"), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// | ||
// Copyright RevenueCat Inc. All Rights Reserved. | ||
// | ||
// Licensed under the MIT License (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://opensource.org/licenses/MIT | ||
// | ||
// SemanticVersion.swift | ||
// | ||
// Created by JayShortway on 08/08/2024. | ||
|
||
#if CUSTOMER_CENTER_ENABLED | ||
|
||
import Foundation | ||
|
||
struct SemanticVersion: Comparable { | ||
let major: UInt | ||
let minor: UInt | ||
let patch: UInt | ||
|
||
init(major: UInt, minor: UInt, patch: UInt) { | ||
self.major = major | ||
self.minor = minor | ||
self.patch = patch | ||
} | ||
|
||
init(_ version: String) throws { | ||
let pattern = #"^(\d+)(?:\.(\d+))?(?:\.(\d+))?$"# | ||
guard let regex = try? NSRegularExpression(pattern: pattern), | ||
JayShortway marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let match = regex.firstMatch(in: version, range: NSRange(version.startIndex..., in: version)) else { | ||
throw SemanticVersionError.invalidVersionString(version) | ||
} | ||
|
||
let major = UInt(version[Range(match.range(at: 1), in: version)!])! | ||
let minor = match.range(at: 2).location != NSNotFound ? | ||
UInt(version[Range(match.range(at: 2), in: version)!])! : | ||
0 | ||
let patch = match.range(at: 3).location != NSNotFound ? | ||
UInt(version[Range(match.range(at: 3), in: version)!])! : | ||
0 | ||
|
||
self.init(major: major, minor: minor, patch: patch) | ||
} | ||
|
||
static func < (lhs: SemanticVersion, rhs: SemanticVersion) -> Bool { | ||
if lhs.major != rhs.major { | ||
return lhs.major < rhs.major | ||
} else if lhs.minor != rhs.minor { | ||
return lhs.minor < rhs.minor | ||
} else { | ||
return lhs.patch < rhs.patch | ||
} | ||
} | ||
|
||
static func == (lhs: SemanticVersion, rhs: SemanticVersion) -> Bool { | ||
return lhs.major == rhs.major && lhs.minor == rhs.minor && lhs.patch == rhs.patch | ||
} | ||
} | ||
|
||
enum SemanticVersionError: LocalizedError { | ||
case invalidVersionString(String) | ||
|
||
var errorDescription: String? { | ||
switch self { | ||
case .invalidVersionString(let version): | ||
return "Invalid version string: '\(version)'. Expected format: 'major.minor.patch'" | ||
} | ||
} | ||
} | ||
|
||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I recommend reviewing this file while hiding whitespace (on GitHub), as the actual change is tiny.