diff --git a/CHANGELOG.latest.md b/CHANGELOG.latest.md index ac532beda0..1a60b073a1 100644 --- a/CHANGELOG.latest.md +++ b/CHANGELOG.latest.md @@ -1,12 +1,5 @@ -_This release is compatible with `Xcode 15.3 beta 2`_ +## 5.0.0-beta.2 -### New Features -* `NonSubscriptionTransaction`: expose `storeTransactionIdentifier` (#3639) via NachoSoto (@NachoSoto) -### RevenueCatUI -* `Paywalls`: new `presentationMode` parameter (by @Lascorbe) (#3638) via NachoSoto (@NachoSoto) -### Bugfixes -* Add explicit `visionOS` deployment target (#3642) via NachoSoto (@NachoSoto) -### Dependency Updates -* Bump cocoapods from 1.15.0 to 1.15.1 (#3637) via dependabot[bot] (@dependabot[bot]) -### Other Changes -* `Xcode 15.3 beta 2`: remove `nonisolated` workaround (#3640) via NachoSoto (@NachoSoto) +RevenueCat iOS SDK v5 is here!! + +See our [RevenueCat v5 Migration Guide](Sources/DocCDocumentation/DocCDocumentation.docc/V5_API_Migration_guide.md) for all the details. \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b0a31c4c4..e564d54497 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 5.0.0-beta.2 + +RevenueCat iOS SDK v5 is here!! + +See our [RevenueCat v5 Migration Guide](Sources/DocCDocumentation/DocCDocumentation.docc/V5_API_Migration_guide.md) for all the details. + ## 4.36.0 _This release is compatible with `Xcode 15.3 beta 2`_ diff --git a/README.md b/README.md index f76ef4ae59..cbf7219ea0 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,10 @@ Sign up to [get started for free](https://app.revenuecat.com/signup). *RevenueCat* is the client for the [RevenueCat](https://www.revenuecat.com/) subscription and purchase tracking system. It's 100% `Swift` and compatible with `Objective-C`. -## Migrating from Purchases v3 +## Migrating from Purchases v4 to v5 +- See our [Migration guide](https://revenuecat.github.io/purchases-ios-docs/v5_api_migration_guide.html) + +## Migrating from Purchases v3 to v4 - See our [Migration guide](https://revenuecat.github.io/purchases-ios-docs/v4_api_migration_guide.html) ## RevenueCat SDK Features diff --git a/Sources/DocCDocumentation/DocCDocumentation.docc/RevenueCat.md b/Sources/DocCDocumentation/DocCDocumentation.docc/RevenueCat.md index 16e39c6a8d..cf019a19b0 100644 --- a/Sources/DocCDocumentation/DocCDocumentation.docc/RevenueCat.md +++ b/Sources/DocCDocumentation/DocCDocumentation.docc/RevenueCat.md @@ -33,13 +33,18 @@ Sign up to [get started for free](https://app.revenuecat.com/signup). - Important: You're viewing the documentation for RevenueCat iOS SDK version 4. For documentation on version 3, visit [the docs for RevenueCat iOS SDK version 3.](https://sdk.revenuecat.com/ios/index.html) -## Migrating from Purchases v3 -When transitioning between our V3 SDK, we ported our entire SDK into Swift. +## Migrating from Purchases v4 to v5 +Version 5.0 of the SDK enables full StoreKit 2 flow on the SDK and the RevenueCat backend by default. + +Our provides information on how to migrate from v4 to v5. + +## Migrating from Purchases v3 to v4 +When transitioning between our V3 SDK, we ported our entire SDK into Swift. Migrating from Objective-C to Swift required a number of API changes, but we feel that the changes resulted in the SDK having a more natural feel for developers. In addition, we introduced several new types and APIs. -Our provides information on how to migrate from V3 to V4. +Our provides information on how to migrate from v3 to v4. ## Getting Started For more detailed information, you can view our complete documentation at [docs.revenuecat.com](https://docs.revenuecat.com/docs). diff --git a/Sources/DocCDocumentation/DocCDocumentation.docc/V5_API_Migration_guide.md b/Sources/DocCDocumentation/DocCDocumentation.docc/V5_API_Migration_guide.md new file mode 100644 index 0000000000..34133474ff --- /dev/null +++ b/Sources/DocCDocumentation/DocCDocumentation.docc/V5_API_Migration_guide.md @@ -0,0 +1,82 @@ +# RevenueCat 4.x to 5.x Migration Guide + +## StoreKit 2 + +Version 5.0 of the RevenueCat SDK enables full StoreKit 2 flow on the SDK and the RevenueCat backend by default. + +We have been testing StoreKit 2 support in parallel to StoreKit 1 in our backend for a while and we believe it is ready for widespread use. + +Here's some of the benefits you get with StoreKit 2: + +- Better handling of a few specific edge cases which were unfixable with StoreKit 1: +- No more "Missing receipt" errors in Sandbox that could result in failure restoring purchases or getting trial eligibility status "unknown". +- No more "The purchased product was missing in the receipt" error that could cause an invalid receipt error when making a purchase. +- Future proofing: StoreKit 1 APIs are being progressively deprecated by Apple, and new features are being added to StoreKit 2. +- Faster processing time: More efficient and performant implementation of receipts validation. We have found that receipts validation can be ~200ms faster comparing to SK1 implementation for p95 of the requests. + +In order to use StoreKit 2, you will need to configure your [In-App Purchase Key](https://www.revenuecat.com/docs/in-app-purchase-key-configuration) in the RevenueCat dashboard. + +The previously deprecated configuration option `.with(usesStoreKit2IfAvailable: true)` has been removed. Remove it from your configuration option to continue using StoreKit 2. + +The SDK will automatically use StoreKit 1 in the following versions where StoreKit 2 is not supported: on macOS 11 or earlier, iOS 14 or earlier, iPadOS 14 or earlier, tvOS 14 or earlier, or watchOS 7 or earlier. + +If for any reason you need to always use StoreKit 1, it is possible to switch back using the following configuration API: + +```swift +Purchases.configure(with: .builder(withAPIKey: apiKey) + .with(storeKitVersion: .storeKit1) + .build() +``` + +### 3rd Party Analytics SDKs + +If you are using any 3rd party analytics SDKs to automatically track in-app purchases, you need to be aware most of them do not completely support logging purchases made with StoreKit 2. This is the case for some popular SDKs like Facebook, Mixpanel, OneSignal, Segment or Firebase. For these services, we recommend you use our [data integrations](https://www.revenuecat.com/integrations/). + +If you're using the Firebase SDK, you'll need to follow [these instructions](https://firebase.google.com/docs/analytics/measure-in-app-purchases#swift) to log purchases made with StoreKit 2. + +### Observer Mode + +Version 5.0 of the SDK introduces support for observer mode when making purchases with StoreKit 2. You can enable it when configuring the SDK: + +```swift +Purchases.configure(with: .builder(withAPIKey: apiKey) + .with(observerMode: true, storeKitVersion: .storeKit2) + .build() +``` + +Additionally, because of the way in which StoreKit 2 operates, you must manually handle newly purchased transactions by calling `Purchases.shared.handleObserverModeTransaction()`. Subscription updates will be automatically tracked. + +```swift +let result = try await product.purchase() +Purchases.shared.handleObserverModeTransaction(result) +``` + +If you're using observer mode with StoreKit 1, you will need to explicitly configure the SDK to use StoreKit 1: + +```swift +Purchases.configure(with: .builder(withAPIKey: apiKey) + .with(observerMode: true, storeKitVersion: .storeKit1) + .build() +``` + +### Original Application Version + +If you're converting a paid app to in-app subscriptions, and want to provide existing customers with certain features, [we recommend](https://www.revenuecat.com/blog/engineering/converting-a-paid-ios-app-to-subscriptions/) using the "original app version" field in customer info. + +Because of a limitation of StoreKit 2, this field is not available if the customer is running on iOS 15, tvOS 15, macOS 12 or watchOS 8. If this is a requirement for you, we recommend switching back to StoreKit 1. + +## Trusted Entitlements + +Version 5.0 of the SDK enables the Informational mode for Trusted Entitlements by default to protect your purchases from attackers. See the [Trusted Entitlements documentation](https://www.revenuecat.com/docs/trusted-entitlements) for more information. + +## Deployment Target + +The minimum targets have been raised to the folllowing: +- iOS 13.0 +- tvOS 13.0 +- watchOS 6.2 +- macOS 10.15 + +## Release Assets + +Pre-built .frameworks will no longer be included in releases, only .xcframeworks: https://github.com/RevenueCat/purchases-ios/pull/3582 \ No newline at end of file diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 9a7905446c..cf42e83367 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -18,7 +18,8 @@ files_with_version_number = { './Sources/Misc/SystemInfo.swift' => ['return "{x}"'], './.version' => ['{x}'], './scripts/docs/index.html' => ['purchases-ios-docs/{x}/documentation/revenuecat'], - './scripts/docs/v4_api_migration_guide.html' => ['purchases-ios-docs/{x}/documentation/revenuecat/v4_api_migration_guide'] + './scripts/docs/v4_api_migration_guide.html' => ['purchases-ios-docs/{x}/documentation/revenuecat/v4_api_migration_guide'], + './scripts/docs/v5_api_migration_guide.html' => ['purchases-ios-docs/{x}/documentation/revenuecat/v5_api_migration_guide'] } PLIST_VERSION_PATTERNS = ["CFBundleShortVersionString\n\t{x}",] files_with_version_number_without_prerelease_modifiers = { @@ -745,9 +746,8 @@ platform :ios do "--transform-for-static-hosting", "--enable-inherited-docs", "--additional-symbol-graph-dir", ".build") - - docs_index_path = File.join(Dir.pwd, "scripts/docs/index.html") - docs_migration_guide_path = File.join(Dir.pwd, "scripts/docs/v4_api_migration_guide.html") + + docs_files = Dir.glob("scripts/docs/*.html").map { |file| File.realpath(file) } # clone docs repo Dir.mktmpdir do |docs_repo_clone_dir| Dir.chdir(docs_repo_clone_dir) do @@ -756,17 +756,14 @@ platform :ios do # copy docs generated in the previous step into the docs folder # and push the changes docs_destination_folder = "docs/#{version_number}" - index_destination_path = "docs/index.html" - migration_guide_destination_path = "docs/v4_api_migration_guide.html" FileUtils.cp_r docs_generation_folder + "/.", docs_destination_folder - FileUtils.cp docs_index_path, index_destination_path - FileUtils.cp docs_migration_guide_path, migration_guide_destination_path + docs_files.each do |file| + FileUtils.cp file, "docs/" + end # using sh instead of fastlane commands because fastlane would run # from the repo root - sh("git", "add", docs_destination_folder) - sh("git", "add", index_destination_path) - sh("git", "add", migration_guide_destination_path) + sh("git", "add", "docs/*.html") sh("git", "commit", "-m", "Update documentation for #{version_number}") sh("git", "push") end diff --git a/scripts/docs/v5_api_migration_guide.html b/scripts/docs/v5_api_migration_guide.html new file mode 100644 index 0000000000..fc7f3a8c12 --- /dev/null +++ b/scripts/docs/v5_api_migration_guide.html @@ -0,0 +1,9 @@ + + + + + + + + +