From 61ba1c84f7aa9166c9f04019650cc444d66a15c2 Mon Sep 17 00:00:00 2001 From: Mark Villacampa Date: Sat, 24 Feb 2024 15:16:03 +0100 Subject: [PATCH 1/9] Updated to support PHC 10.0 --- RNPurchases.podspec | 2 +- .../purchases/react/RNPurchasesModule.java | 2 +- apitesters/purchases.ts | 22 +++++++++--- examples/MagicWeather/ios/Podfile | 2 +- examples/purchaseTesterTypescript/ios/Podfile | 2 +- .../PurchaseTester.xcodeproj/project.pbxproj | 8 ++--- ios/RNPurchases.m | 17 ++++++++-- react-native-purchases-ui/RNPaywalls.podspec | 2 +- src/purchases.ts | 34 +++++++++++++++++-- 9 files changed, 72 insertions(+), 19 deletions(-) diff --git a/RNPurchases.podspec b/RNPurchases.podspec index 547027d4..1f0b93ce 100644 --- a/RNPurchases.podspec +++ b/RNPurchases.podspec @@ -10,7 +10,7 @@ Pod::Spec.new do |spec| spec.authors = package['author'] spec.homepage = "https://github.com/RevenueCat/react-native-purchases" spec.license = package['license'] - spec.platforms = {:ios => "11.0", :tvos => "11.0"} + spec.platform = {:ios => "13.0", :tvos => "13.0"} spec.source = { :git => "https://github.com/RevenueCat/react-native-purchases.git" } spec.source_files = "ios/**/*.{h,m,swift}" diff --git a/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java b/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java index 219c3ac0..9d32c99b 100644 --- a/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java +++ b/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java @@ -83,7 +83,7 @@ public void removeListeners(Integer count) { @ReactMethod public void setupPurchases(String apiKey, @Nullable String appUserID, boolean observerMode, @Nullable String userDefaultsSuiteName, - @Nullable Boolean usesStoreKit2IfAvailable, boolean useAmazon, + @Nullable String storeKitVersion, boolean useAmazon, boolean shouldShowInAppMessagesAutomatically, @Nullable String entitlementVerificationMode) { PlatformInfo platformInfo = new PlatformInfo(PLATFORM_NAME, PLUGIN_VERSION); diff --git a/apitesters/purchases.ts b/apitesters/purchases.ts index fecd13a1..15cb4827 100644 --- a/apitesters/purchases.ts +++ b/apitesters/purchases.ts @@ -1,6 +1,7 @@ import { ENTITLEMENT_VERIFICATION_MODE, IN_APP_MESSAGE_TYPE, + STOREKIT_VERSION, PurchasesOffering, } from "@revenuecat/purchases-typescript-internal"; import { @@ -135,13 +136,14 @@ async function checkPurchasing( await Purchases.showInAppMessages(); await Purchases.showInAppMessages(messageTypes); + await Purchases.handleObserverModeTransaction("product_id"); } async function checkConfigure() { const apiKey: string = ""; const appUserID: string | null = ""; const observerMode: boolean = false; - const usesStoreKit2IfAvailable: boolean = true; + const storeKitVersion: STOREKIT_VERSION = Purchases.STOREKIT_VERSION.DEFAULT; const useAmazon: boolean = true; const entitlementVerificationMode: ENTITLEMENT_VERIFICATION_MODE = Purchases.ENTITLEMENT_VERIFICATION_MODE.INFORMATIONAL; @@ -158,20 +160,22 @@ async function checkConfigure() { appUserID, observerMode, userDefaultsSuiteName, + storeKitVersion }); Purchases.configure({ apiKey, appUserID, observerMode, userDefaultsSuiteName, - usesStoreKit2IfAvailable, + storeKitVersion, + entitlementVerificationMode }); Purchases.configure({ apiKey, appUserID, observerMode, userDefaultsSuiteName, - usesStoreKit2IfAvailable, + storeKitVersion, entitlementVerificationMode, }); Purchases.configure({ @@ -179,7 +183,7 @@ async function checkConfigure() { appUserID, observerMode, userDefaultsSuiteName, - usesStoreKit2IfAvailable, + storeKitVersion, entitlementVerificationMode, useAmazon, }); @@ -188,7 +192,7 @@ async function checkConfigure() { appUserID, observerMode, userDefaultsSuiteName, - usesStoreKit2IfAvailable, + storeKitVersion, useAmazon, shouldShowInAppMessagesAutomatically, }); @@ -227,6 +231,14 @@ async function checkEntitlementVerificationModeEnum( } } +function checkStoreKitVersion(status: STOREKIT_VERSION) { + switch (status) { + case STOREKIT_VERSION.DEFAULT: + case STOREKIT_VERSION.STOREKIT_1: + case STOREKIT_VERSION.STOREKIT_2: + } +} + function checkListeners() { const customerInfoUpdateListener: CustomerInfoUpdateListener = ( customerInfo diff --git a/examples/MagicWeather/ios/Podfile b/examples/MagicWeather/ios/Podfile index e4d97a4e..cba9edab 100644 --- a/examples/MagicWeather/ios/Podfile +++ b/examples/MagicWeather/ios/Podfile @@ -1,7 +1,7 @@ require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' -platform :ios, '11.0' +platform :ios, '13.0' target 'MagicWeatherReactNative' do config = use_native_modules! diff --git a/examples/purchaseTesterTypescript/ios/Podfile b/examples/purchaseTesterTypescript/ios/Podfile index a7ccc401..345555e0 100644 --- a/examples/purchaseTesterTypescript/ios/Podfile +++ b/examples/purchaseTesterTypescript/ios/Podfile @@ -5,7 +5,7 @@ require Pod::Executable.execute_command('node', ['-p', {paths: [process.argv[1]]}, )', __dir__]).strip -platform :ios, min_ios_version_supported +platform :ios, "13.0" prepare_react_native_project! linkage = ENV['USE_FRAMEWORKS'] diff --git a/examples/purchaseTesterTypescript/ios/PurchaseTester.xcodeproj/project.pbxproj b/examples/purchaseTesterTypescript/ios/PurchaseTester.xcodeproj/project.pbxproj index 343c2f6b..891ee9dd 100644 --- a/examples/purchaseTesterTypescript/ios/PurchaseTester.xcodeproj/project.pbxproj +++ b/examples/purchaseTesterTypescript/ios/PurchaseTester.xcodeproj/project.pbxproj @@ -470,7 +470,7 @@ "$(inherited)", ); INFOPLIST_FILE = PurchaseTesterTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.4; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -495,7 +495,7 @@ COPY_PHASE_STRIP = NO; DEVELOPMENT_TEAM = 8SXR2327BM; INFOPLIST_FILE = PurchaseTesterTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.4; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -616,7 +616,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.4; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( /usr/lib/swift, "$(inherited)", @@ -691,7 +691,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.4; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( /usr/lib/swift, "$(inherited)", diff --git a/ios/RNPurchases.m b/ios/RNPurchases.m index eed12efc..c6042ac9 100644 --- a/ios/RNPurchases.m +++ b/ios/RNPurchases.m @@ -41,7 +41,7 @@ - (dispatch_queue_t)methodQueue { appUserID:(nullable NSString *)appUserID observerMode:(BOOL)observerMode userDefaultsSuiteName:(nullable NSString *)userDefaultsSuiteName - usesStoreKit2IfAvailable:(BOOL)usesStoreKit2IfAvailable + storeKitVersion:(nullable NSString *)storeKitVersion useAmazon:(BOOL)useAmazon shouldShowInAppMessagesAutomatically:(BOOL)shouldShowInAppMessagesAutomatically entitlementVerificationMode:(nullable NSString *)entitlementVerificationMode) { @@ -51,7 +51,7 @@ - (dispatch_queue_t)methodQueue { userDefaultsSuiteName:userDefaultsSuiteName platformFlavor:self.platformFlavor platformFlavorVersion:self.platformFlavorVersion - usesStoreKit2IfAvailable:usesStoreKit2IfAvailable + storeKitVersion:storeKitVersion dangerousSettings:nil shouldShowInAppMessagesAutomatically:shouldShowInAppMessagesAutomatically verificationMode:entitlementVerificationMode]; @@ -254,6 +254,19 @@ static void logUnavailablePresentCodeRedemptionSheet() { NSLog(@"[Purchases] Warning: tried to present codeRedemptionSheet, but it's only available on iOS 14.0 or greater."); } +RCT_EXPORT_METHOD(handleObserverModeTransactionForProductID:(nonnull NSString *)productID + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject) { + if (@available(iOS 15.0, *)) { + [RCCommonFunctionality handleObserverModeTransactionForProductID:@"" + completion: [self getResponseCompletionBlockWithResolve:resolve + reject:reject]]; + } else { + NSLog(@"[Purchases] Warning: tried to handle Observer Mode transaction, but it's only available on iOS 15.0 or greater."); + resolve(nil); + } +} + #pragma mark - Subscriber Attributes RCT_EXPORT_METHOD(setProxyURLString:(nullable NSString *)proxyURLString) { diff --git a/react-native-purchases-ui/RNPaywalls.podspec b/react-native-purchases-ui/RNPaywalls.podspec index 71f3eb74..519e9aaa 100644 --- a/react-native-purchases-ui/RNPaywalls.podspec +++ b/react-native-purchases-ui/RNPaywalls.podspec @@ -10,7 +10,7 @@ Pod::Spec.new do |spec| spec.authors = package['author'] spec.homepage = "https://github.com/RevenueCat/react-native-purchases" spec.license = package['license'] - spec.platform = :ios, "11.0" + spec.platform = :ios, "13.0" spec.source = { :git => "https://github.com/RevenueCat/react-native-purchases.git" } spec.source_files = "ios/**/*.{h,m,swift}" diff --git a/src/purchases.ts b/src/purchases.ts index 5ef9bd75..6dbfc211 100644 --- a/src/purchases.ts +++ b/src/purchases.ts @@ -32,6 +32,8 @@ import { IN_APP_MESSAGE_TYPE, ENTITLEMENT_VERIFICATION_MODE, VERIFICATION_RESULT, + STOREKIT_VERSION, + PurchasesStoreTransaction, PurchasesOffering, } from "@revenuecat/purchases-typescript-internal"; @@ -171,6 +173,13 @@ export default class Purchases { */ public static VERIFICATION_RESULT = VERIFICATION_RESULT; + /** + * Enum of StoreKit version. + * @readonly + * @enum {string} + */ + public static STOREKIT_VERSION = STOREKIT_VERSION; + /** * @internal */ @@ -186,7 +195,7 @@ export default class Purchases { * @param {String} apiKey RevenueCat API Key. Needs to be a String * @param {String?} appUserID An optional unique id for identifying the user. Needs to be a string. * @param {boolean} [observerMode=false] An optional boolean. Set this to TRUE if you have your own IAP implementation and want to use only RevenueCat's backend. Default is FALSE. - * @param {boolean} [usesStoreKit2IfAvailable=false] DEPRECATED. An optional boolean. iOS-only. Defaults to FALSE. Setting this to TRUE will enable StoreKit2 on compatible devices. + * @param {STOREKIT_VERSION} [storeKitVersion=STOREKIT_2] iOS-only. Defaults to STOREKIT_2. StoreKit 2 is only available on iOS 15+. StoreKit 1 will be used for previous iOS versions regardless of this setting. * We recommend not using this parameter, letting RevenueCat decide for you which StoreKit implementation to use. * @param {ENTITLEMENT_VERIFICATION_MODE} [entitlementVerificationMode=ENTITLEMENT_VERIFICATION_MODE.DISABLED] Sets the entitlement verifciation mode to use. For more details, check https://rev.cat/trusted-entitlements * @param {boolean} [useAmazon=false] An optional boolean. Android-only. Set this to TRUE to enable Amazon on compatible devices. @@ -199,7 +208,7 @@ export default class Purchases { appUserID = null, observerMode = false, userDefaultsSuiteName, - usesStoreKit2IfAvailable = false, + storeKitVersion = STOREKIT_VERSION.DEFAULT, useAmazon = false, shouldShowInAppMessagesAutomatically = true, entitlementVerificationMode = ENTITLEMENT_VERIFICATION_MODE.DISABLED, @@ -223,7 +232,7 @@ export default class Purchases { appUserID, observerMode, userDefaultsSuiteName, - usesStoreKit2IfAvailable, + storeKitVersion, useAmazon, shouldShowInAppMessagesAutomatically, entitlementVerificationMode @@ -731,6 +740,25 @@ export default class Purchases { ); } + /** + * Use this method only if you already have your own IAP implementation using StoreKit 2 and want to use + * RevenueCat's backend. If you are using StoreKit 1 for your implementation, you do not need this method. + * + * You only need to use this method with *new* purchases. Subscription updates are observed automatically. + * + * Important: This should only be used if you have enabled observer mode during SDK configuration. + * + * @warning You need to finish the transaction yourself after calling this method. + * + * @param {string} productID Product ID that was just purchased + * @returns {Promise} If there was a transacton found and handled for the provided product ID. + */ + public static async handleObserverModeTransaction(productID: string): Promise { + await Purchases.throwIfAndroidPlatform(); + await Purchases.throwIfNotConfigured(); + return RNPurchases.handleObserverModeTransactionForProductID(productID); + } + /** * @deprecated, use enableAdServicesAttributionTokenCollection instead. * Enable automatic collection of Apple Search Ad attribution. Disabled by default From 7f8e8aa1f773c65e79edb90e27fe72e7772de64f Mon Sep 17 00:00:00 2001 From: Mark Villacampa Date: Mon, 26 Feb 2024 18:17:54 +0100 Subject: [PATCH 2/9] fix --- ios/RNPurchases.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ios/RNPurchases.m b/ios/RNPurchases.m index c6042ac9..afa51bdb 100644 --- a/ios/RNPurchases.m +++ b/ios/RNPurchases.m @@ -258,9 +258,9 @@ static void logUnavailablePresentCodeRedemptionSheet() { resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) { if (@available(iOS 15.0, *)) { - [RCCommonFunctionality handleObserverModeTransactionForProductID:@"" - completion: [self getResponseCompletionBlockWithResolve:resolve - reject:reject]]; + [RCCommonFunctionality handleObserverModeTransactionForProductID:productID + completion:[self getResponseCompletionBlockWithResolve:resolve + reject:reject]]; } else { NSLog(@"[Purchases] Warning: tried to handle Observer Mode transaction, but it's only available on iOS 15.0 or greater."); resolve(nil); From ab5b020994aa39533a50199861c10359bf6a6237 Mon Sep 17 00:00:00 2001 From: Mark Villacampa Date: Tue, 27 Feb 2024 17:16:00 +0100 Subject: [PATCH 3/9] Bump PHC to version 10.0.0-beta.1 --- RNPurchases.podspec | 2 +- .../purchaseTesterTypescript/ios/Podfile.lock | 244 +++++------------- package.json | 2 +- react-native-purchases-ui/RNPaywalls.podspec | 2 +- yarn.lock | 28 +- 5 files changed, 83 insertions(+), 195 deletions(-) diff --git a/RNPurchases.podspec b/RNPurchases.podspec index 1f0b93ce..97ad01e2 100644 --- a/RNPurchases.podspec +++ b/RNPurchases.podspec @@ -25,6 +25,6 @@ Pod::Spec.new do |spec| ] spec.dependency "React-Core" - spec.dependency "PurchasesHybridCommon", '10.3.2' + spec.dependency "PurchasesHybridCommon", "10.0.0-beta.1" spec.swift_version = '5.7' end diff --git a/examples/purchaseTesterTypescript/ios/Podfile.lock b/examples/purchaseTesterTypescript/ios/Podfile.lock index f5c7aff3..c32ceaa1 100644 --- a/examples/purchaseTesterTypescript/ios/Podfile.lock +++ b/examples/purchaseTesterTypescript/ios/Podfile.lock @@ -15,12 +15,13 @@ PODS: - hermes-engine/Pre-built (= 0.73.5) - hermes-engine/Pre-built (0.73.5) - libevent (2.1.12) - - PurchasesHybridCommon (10.3.2): - - RevenueCat (= 4.39.1) - - PurchasesHybridCommonUI (10.3.2): - - PurchasesHybridCommon (= 10.3.2) - - RevenueCatUI (= 4.39.1) - - RCT-Folly (2022.05.16.00): + - OpenSSL-Universal (1.1.1100) + - PurchasesHybridCommon (10.0.0-beta.1): + - RevenueCat (= 5.0.0-beta.3) + - PurchasesHybridCommonUI (10.0.0-beta.1): + - PurchasesHybridCommon (= 10.0.0-beta.1) + - RevenueCatUI (= 5.0.0-beta.3) + - RCT-Folly (2021.07.22.00): - boost - DoubleConversion - fmt (~> 6.2.1) @@ -942,132 +943,32 @@ PODS: - React-RCTFabric (0.73.5): - glog - hermes-engine - - RCT-Folly/Fabric (= 2022.05.16.00) - - React-Core - - React-debug - - React-Fabric - - React-FabricImage - - React-graphics - - React-ImageManager - - React-jsi - - React-nativeconfig - - React-RCTImage - - React-RCTText - - React-rendererdebug - - React-runtimescheduler - - React-utils - - Yoga - - React-RCTImage (0.73.5): - - RCT-Folly (= 2022.05.16.00) - - RCTTypeSafety - - React-Codegen - - React-Core/RCTImageHeaders - - React-jsi - - React-NativeModulesApple - - React-RCTNetwork - - ReactCommon - - React-RCTLinking (0.73.5): - - React-Codegen - - React-Core/RCTLinkingHeaders (= 0.73.5) - - React-jsi (= 0.73.5) - - React-NativeModulesApple - - ReactCommon - - ReactCommon/turbomodule/core (= 0.73.5) - - React-RCTNetwork (0.73.5): - - RCT-Folly (= 2022.05.16.00) - - RCTTypeSafety - - React-Codegen - - React-Core/RCTNetworkHeaders - - React-jsi - - React-NativeModulesApple - - ReactCommon - - React-RCTSettings (0.73.5): - - RCT-Folly (= 2022.05.16.00) - - RCTTypeSafety - - React-Codegen - - React-Core/RCTSettingsHeaders - - React-jsi - - React-NativeModulesApple - - ReactCommon - - React-RCTText (0.73.5): - - React-Core/RCTTextHeaders (= 0.73.5) - - Yoga - - React-RCTVibration (0.73.5): - - RCT-Folly (= 2022.05.16.00) - - React-Codegen - - React-Core/RCTVibrationHeaders - - React-jsi - - React-NativeModulesApple - - ReactCommon - - React-rendererdebug (0.73.5): - - DoubleConversion - - fmt (~> 6.2.1) - - RCT-Folly (= 2022.05.16.00) - - React-debug - - React-rncore (0.73.5) - - React-runtimeexecutor (0.73.5): - - React-jsi (= 0.73.5) - - React-runtimescheduler (0.73.5): - - glog - - hermes-engine - - RCT-Folly (= 2022.05.16.00) - - React-callinvoker - - React-cxxreact - - React-debug - - React-jsi - - React-rendererdebug - - React-runtimeexecutor - - React-utils - - React-utils (0.73.5): - - glog - - RCT-Folly (= 2022.05.16.00) - - React-debug - - ReactCommon (0.73.5): - - React-logger (= 0.73.5) - - ReactCommon/turbomodule (= 0.73.5) - - ReactCommon/turbomodule (0.73.5): + - RCT-Folly (= 2021.07.22.00) + - React-callinvoker (= 0.71.6) + - React-Core (= 0.71.6) + - React-cxxreact (= 0.71.6) + - React-jsi (= 0.71.6) + - React-logger (= 0.71.6) + - React-perflogger (= 0.71.6) + - ReactCommon/turbomodule/core (0.71.6): - DoubleConversion - - fmt (~> 6.2.1) - glog - hermes-engine - - RCT-Folly (= 2022.05.16.00) - - React-callinvoker (= 0.73.5) - - React-cxxreact (= 0.73.5) - - React-jsi (= 0.73.5) - - React-logger (= 0.73.5) - - React-perflogger (= 0.73.5) - - ReactCommon/turbomodule/bridging (= 0.73.5) - - ReactCommon/turbomodule/core (= 0.73.5) - - ReactCommon/turbomodule/bridging (0.73.5): - - DoubleConversion - - fmt (~> 6.2.1) - - glog - - hermes-engine - - RCT-Folly (= 2022.05.16.00) - - React-callinvoker (= 0.73.5) - - React-cxxreact (= 0.73.5) - - React-jsi (= 0.73.5) - - React-logger (= 0.73.5) - - React-perflogger (= 0.73.5) - - ReactCommon/turbomodule/core (0.73.5): - - DoubleConversion - - fmt (~> 6.2.1) - - glog - - hermes-engine - - RCT-Folly (= 2022.05.16.00) - - React-callinvoker (= 0.73.5) - - React-cxxreact (= 0.73.5) - - React-jsi (= 0.73.5) - - React-logger (= 0.73.5) - - React-perflogger (= 0.73.5) - - RevenueCat (4.39.1) - - RevenueCatUI (4.39.1): - - RevenueCat (= 4.39.1) - - RNPaywalls (7.24.1): - - PurchasesHybridCommonUI (= 10.3.2) + - RCT-Folly (= 2021.07.22.00) + - React-callinvoker (= 0.71.6) + - React-Core (= 0.71.6) + - React-cxxreact (= 0.71.6) + - React-jsi (= 0.71.6) + - React-logger (= 0.71.6) + - React-perflogger (= 0.71.6) + - RevenueCat (5.0.0-beta.3) + - RevenueCatUI (5.0.0-beta.3): + - RevenueCat (= 5.0.0-beta.3) + - RNPaywalls (7.21.1): + - PurchasesHybridCommonUI (= 10.0.0-beta.1) - React-Core - - RNPurchases (7.24.1): - - PurchasesHybridCommon (= 10.3.2) + - RNPurchases (7.21.1): + - PurchasesHybridCommon (= 10.0.0-beta.1) - React-Core - RNScreens (3.29.0): - glog @@ -1259,58 +1160,45 @@ SPEC CHECKSUMS: glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2 hermes-engine: 1d1835b2cc54c381909d94d1b3c8e0a2f1a94a0e libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 - PurchasesHybridCommon: 222e00edaee550b48d8e9388eca9048a053f7c33 - PurchasesHybridCommonUI: 8aba2dbe988e43cd91df09802a485c1eff4f48ed - RCT-Folly: 7169b2b1c44399c76a47b5deaaba715eeeb476c0 - RCTRequired: 2544c0f1081a5fa12e108bb8cb40e5f4581ccd87 - RCTTypeSafety: 50efabe2b115c11ed03fbf3fd79e2f163ddb5d7c - React: 84221d5e0ce297bc57c4b6af539a62d812d89f10 - React-callinvoker: 5d17577ecc7f784535ebedf3aad4bcbf8f4b5117 - React-Codegen: 857e7984fc277aadde2a7a427288b6918ece7b2b - React-Core: 8e782e7e24c7843871a0d9c3c8d7c5b3ebb73832 - React-CoreModules: 7875ee247e3e6e0e683b52cd1cdda1b71618bd55 - React-cxxreact: 788cd771c6e94d44f8d472fdfae89b67226067ea - React-debug: 55c7f2b8463bfe85567c9f4ede904085601130c9 - React-Fabric: 8cb43853496bb8032420edf62e7281c53109e682 - React-FabricImage: fbdc0ef7ed58a87c77600017c19a751932de3e47 - React-graphics: dc8307b615f14e13f1081ac23ea66697808bcd29 - React-hermes: d9acaa4ebf2118d9bd8a541af8c620c467b356b6 - React-ImageManager: 2a97ddc9b1f459121697d629cfbe69712997d76f - React-jserrorhandler: b97b16674258ccaeff5a70047a097a140e76d12d - React-jsi: 1d59d0a148c76641ac577729e0268bafa494152c - React-jsiexecutor: 262b66928ad948491d03fd328bb5b822cce94647 - React-jsinspector: 32db5e364bcae8fca8cdf8891830636275add0c5 - React-logger: 0331362115f0f5b392bd7ed14636d1a3ea612479 - React-Mapbuffer: 7c35cd53a22d0be04d3f26f7881c7fb7dd230216 - react-native-safe-area-context: b97eb6f9e3b7f437806c2ce5983f479f8eb5de4b - React-nativeconfig: 1166714a4f7ea57a0df5c2cb44fbc70f98d580f9 - React-NativeModulesApple: 726664e9829eb5eed8170241000e46ead269a05f - React-perflogger: 0dd9f1725d55f8264b81efadd373fe1d9cca7dc2 - React-RCTActionSheet: 05656d2102b0d0a2676d58bad4d80106af5367b2 - React-RCTAnimation: 6c66beae98730fb7615df28caf651e295f2401e5 - React-RCTAppDelegate: 891b80c596fffcb3f90431739495d606a9a0d610 - React-RCTBlob: 8ecee445ec5fa9ed8a8621a136183c1045165100 - React-RCTFabric: f291e06bc63fef26cdd105537bae5c6a8d3bdca8 - React-RCTImage: 585b16465146cb839da02f3179ce7cb19d332642 - React-RCTLinking: 09ba11f7df62946e7ddca1b51aa3bf47b230e008 - React-RCTNetwork: e070f8d2fca60f1e9571936ce54d165e77129e76 - React-RCTSettings: b08c7ff191f0a5421aab198ea1086c9a8d513bde - React-RCTText: f6cc5a3cf0f1a4f3d1256657dca1025e4cfe45e0 - React-RCTVibration: d9948962139f9924ef87f23ab240e045e496213b - React-rendererdebug: ee05480666415f7a76e6cf0a7a50363423f44809 - React-rncore: 010565651e9cf2e4fac9517a348446789dd55e01 - React-runtimeexecutor: 56f562a608056fb0c1711d900a992e26f375d817 - React-runtimescheduler: 814b644a5f456c7df1fba7bcd9914707152527c6 - React-utils: 987a4526a2fc0acdfaf87888adfe0bf9d0452066 - ReactCommon: 2947b0bffd82ea0e58ca7928881152d4c6dae9af - RevenueCat: 237cb14ba0ba0fa07153c801585b42b73be0fe7e - RevenueCatUI: 07f7ca5cc4879a712e2e7891a7434bd35320d42b - RNPaywalls: fb73ae4db87a9f92a48005c6e0439cf8ed35049f - RNPurchases: 726bf254205d1da6ad3bcdc19cfe1991d9de5d01 - RNScreens: 17e2f657f1b09a71ec3c821368a04acbb7ebcb46 + OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c + PurchasesHybridCommon: 5257cc1e726aab5867097f40c3c5661f294e8b06 + PurchasesHybridCommonUI: fd180a4d2862ecb5edd9db404f4a17314baac66f + RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1 + RCTRequired: 5c6fd63b03abb06947d348dadac51c93e3485bd8 + RCTTypeSafety: 1c66daedd66f674e39ce9f40782f0d490c78b175 + React: e11ca7cdc7aa4ddd7e6a59278b808cfe17ebbd9f + React-callinvoker: 77a82869505c96945c074b80bbdc8df919646d51 + React-Codegen: 9ee33090c38ab3da3c4dc029924d50fb649f0dfc + React-Core: 44903e47b428a491f48fd0eae54caddb2ea05ebf + React-CoreModules: 83d989defdfc82be1f7386f84a56b6509f54ac74 + React-cxxreact: 058e7e6349649eae9cfcdec5854e702b26298932 + React-hermes: ba19a405804b833c9b832c1f2061ad5038bb97f2 + React-jsi: 3fe6f589c9cafbef85ed5a4be7c6dc8edfb4ab54 + React-jsiexecutor: 7894956638ff3e00819dd3f9f6f4a84da38f2409 + React-jsinspector: d5ce2ef3eb8fd30c28389d0bc577918c70821bd6 + React-logger: 9332c3e7b4ef007a0211c0a9868253aac3e1da82 + react-native-safe-area-context: 0ee144a6170530ccc37a0fd9388e28d06f516a89 + React-perflogger: 43392072a5b867a504e2b4857606f8fc5a403d7f + React-RCTActionSheet: c7b67c125bebeda9fb19fc7b200d85cb9d6899c4 + React-RCTAnimation: c2de79906f607986633a7114bee44854e4c7e2f5 + React-RCTAppDelegate: 96bc933c3228a549718a6475c4d3f9dd4bbae98d + React-RCTBlob: cf72446957310e7da6627a4bdaadf970d3a8f232 + React-RCTImage: c6093f1bf3d67c0428d779b00390617d5bd90699 + React-RCTLinking: 5de47e37937889d22599af4b99d0552bad1b1c3c + React-RCTNetwork: e7d7077e073b08e5dd486fba3fe87ccad90a9bc4 + React-RCTSettings: 72a04921b2e8fb832da7201a60ffffff2a7c62f7 + React-RCTText: 7123c70fef5367e2121fea37e65b9ad6d3747e54 + React-RCTVibration: 73d201599a64ea14b4e0b8f91b64970979fd92e6 + React-runtimeexecutor: 8692ac548bec648fa121980ccb4304afd136d584 + ReactCommon: 0c43eaeaaee231d7d8dc24fc5a6e4cf2b75bf196 + RevenueCat: 40e259013468caf616c49cd67a78e5754f123547 + RevenueCatUI: 7b9d1cc5ca8e5eabb92be8ee39c7c2352561041d + RNPaywalls: d2369def7727f3b74c51f971625d16978bcc895d + RNPurchases: fd2314142b1ea4299d3edb89c362e735f5f4ce9a + RNScreens: 3c5b9f4a9dcde752466854b6109b79c0e205dad3 SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Yoga: a716eea57d0d3430219c0a5a233e1e93ee931eb7 -PODFILE CHECKSUM: ef31637b966dabf84533f91f817cd6515b22cbe8 +PODFILE CHECKSUM: 0ba7730e6826403cbf5ed12eaccbfb772c95217e COCOAPODS: 1.15.2 diff --git a/package.json b/package.json index b4c9e446..7eeed521 100644 --- a/package.json +++ b/package.json @@ -100,6 +100,6 @@ ] }, "dependencies": { - "@revenuecat/purchases-typescript-internal": "10.3.2" + "@revenuecat/purchases-typescript-internal": "10.0.0-beta.1" } } diff --git a/react-native-purchases-ui/RNPaywalls.podspec b/react-native-purchases-ui/RNPaywalls.podspec index 519e9aaa..d6c92ce7 100644 --- a/react-native-purchases-ui/RNPaywalls.podspec +++ b/react-native-purchases-ui/RNPaywalls.podspec @@ -17,6 +17,6 @@ Pod::Spec.new do |spec| spec.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } spec.dependency "React-Core" - spec.dependency "PurchasesHybridCommonUI", '10.3.2' + spec.dependency "PurchasesHybridCommonUI", "10.0.0-beta.1" spec.swift_version = '5.7' end diff --git a/yarn.lock b/yarn.lock index d2ca892a..5d5ec854 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2530,23 +2530,23 @@ __metadata: languageName: node linkType: hard -"@revenuecat/purchases-typescript-internal@npm:10.1.0": - version: 10.1.0 - resolution: "@revenuecat/purchases-typescript-internal@npm:10.1.0" - checksum: 7986a806a631113a9db29d73852c307ff91ac23f12bf8f0ff34fa99cbfd6d062c8fc6493249f0b2a588b37e1532b89b407a081d2d66e20a4e82452b9ef0a4c7e +"@revenuecat/purchases-typescript-internal@npm:10.0.0-beta.1": + version: 10.0.0-beta.1 + resolution: "@revenuecat/purchases-typescript-internal@npm:10.0.0-beta.1" + checksum: 7dfac6b183011f717ddbfa70d399c661049ada98d2fbbc1990ad003f21092ed84d7281b87c23a82b7526f6ee0cd55d4de4e9ca9e2e798393ce225a3db85aced3 languageName: node linkType: hard -"@revenuecat/purchases-typescript-internal@npm:10.3.2": - version: 10.3.2 - resolution: "@revenuecat/purchases-typescript-internal@npm:10.3.2" - checksum: c203081b146f6b65682cfbda5a03022cee219abbea32e2479df58cb0ec327669d94a95adc576fca3a463e1465830cc7a953eb72523de1658a56dd9c43a94258f +"@revenuecat/purchases-typescript-internal@npm:8.10.1": + version: 8.10.1 + resolution: "@revenuecat/purchases-typescript-internal@npm:8.10.1" + checksum: 1563bb24fd326d5b1cc584b563ea48dbb2a4f50908d8955e704782f8646770e47a74221e89a3dd21733f6fc2201914e406c7aca6cde6fe4fab1ee890cf2189c0 languageName: node linkType: hard -"@sideway/address@npm:^4.1.5": - version: 4.1.5 - resolution: "@sideway/address@npm:4.1.5" +"@sideway/address@npm:^4.1.3": + version: 4.1.4 + resolution: "@sideway/address@npm:4.1.4" dependencies: "@hapi/hoek": ^9.0.0 checksum: 3e3ea0f00b4765d86509282290368a4a5fd39a7995fdc6de42116ca19a96120858e56c2c995081def06e1c53e1f8bccc7d013f6326602bec9d56b72ee2772b9d @@ -6993,9 +6993,9 @@ __metadata: version: 0.0.0-use.local resolution: "react-native-purchases@workspace:." dependencies: - "@revenuecat/purchases-typescript-internal": 10.3.2 - "@types/jest": ^29.5.12 - "@types/react": ^18.2.44 + "@revenuecat/purchases-typescript-internal": 10.0.0-beta.1 + "@types/jest": ^28.1.2 + "@types/react": ~18.2.0 "@types/react-dom": ~18.2.0 jest: ^29.7.0 jest-react-native: ^18.0.0 From f284c0f699dac0727b0c89844ade986e1af03a33 Mon Sep 17 00:00:00 2001 From: Mark Villacampa Date: Tue, 27 Feb 2024 17:16:08 +0100 Subject: [PATCH 4/9] update tests --- __tests__/index.test.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/__tests__/index.test.js b/__tests__/index.test.js index 9e1ea9e9..9ef9c6a1 100644 --- a/__tests__/index.test.js +++ b/__tests__/index.test.js @@ -578,42 +578,42 @@ describe("Purchases", () => { const defaultVerificationMode = "DISABLED" Purchases.configure({apiKey: "key", appUserID: "user"}); - expect(NativeModules.RNPurchases.setupPurchases).toBeCalledWith("key", "user", false, undefined, false, false, true, defaultVerificationMode); + expect(NativeModules.RNPurchases.setupPurchases).toBeCalledWith("key", "user", false, undefined, "DEFAULT", false, true, defaultVerificationMode); Purchases.configure({apiKey: "key", appUserID: "user", observerMode: true}); - expect(NativeModules.RNPurchases.setupPurchases).toBeCalledWith("key", "user", true, undefined, false, false, true, defaultVerificationMode); + expect(NativeModules.RNPurchases.setupPurchases).toBeCalledWith("key", "user", true, undefined, "DEFAULT", false, true, defaultVerificationMode); Purchases.configure({ apiKey: "key", appUserID: "user", observerMode: false, userDefaultsSuiteName: "suite name", - usesStoreKit2IfAvailable: true + storeKitVersion: Purchases.STOREKIT_VERSION.STOREKIT_1 }); - expect(NativeModules.RNPurchases.setupPurchases).toBeCalledWith("key", "user", false, "suite name", true, false, true, defaultVerificationMode); + expect(NativeModules.RNPurchases.setupPurchases).toBeCalledWith("key", "user", false, "suite name", "STOREKIT_1", false, true, defaultVerificationMode); Purchases.configure({ apiKey: "key", appUserID: "user", observerMode: true, userDefaultsSuiteName: "suite name", - usesStoreKit2IfAvailable: true, + storeKitVersion: Purchases.STOREKIT_VERSION.DEFAULT, useAmazon: true, shouldShowInAppMessagesAutomatically: true, entitlementVerificationMode: Purchases.ENTITLEMENT_VERIFICATION_MODE.INFORMATIONAL }); - expect(NativeModules.RNPurchases.setupPurchases).toBeCalledWith("key", "user", true, "suite name", true, true, true, Purchases.ENTITLEMENT_VERIFICATION_MODE.INFORMATIONAL); + expect(NativeModules.RNPurchases.setupPurchases).toBeCalledWith("key", "user", true, "suite name", "DEFAULT", true, true, Purchases.ENTITLEMENT_VERIFICATION_MODE.INFORMATIONAL); Purchases.configure({ apiKey: "key", appUserID: "user", observerMode: true, userDefaultsSuiteName: "suite name", - usesStoreKit2IfAvailable: true, + storeKitVersion: Purchases.STOREKIT_VERSION.STOREKIT_2, useAmazon: true, shouldShowInAppMessagesAutomatically: false }); - expect(NativeModules.RNPurchases.setupPurchases).toBeCalledWith("key", "user", true, "suite name", true, true, false, defaultVerificationMode); + expect(NativeModules.RNPurchases.setupPurchases).toBeCalledWith("key", "user", true, "suite name", "STOREKIT_2", true, false, defaultVerificationMode); expect(NativeModules.RNPurchases.setupPurchases).toBeCalledTimes(5); }) From 5c1952be00960f1263d9dd96ad5e69e3b0c23d07 Mon Sep 17 00:00:00 2001 From: Mark Villacampa Date: Tue, 27 Feb 2024 17:56:37 +0100 Subject: [PATCH 5/9] formatting --- RNPurchases.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RNPurchases.podspec b/RNPurchases.podspec index 97ad01e2..82f74a2d 100644 --- a/RNPurchases.podspec +++ b/RNPurchases.podspec @@ -25,6 +25,6 @@ Pod::Spec.new do |spec| ] spec.dependency "React-Core" - spec.dependency "PurchasesHybridCommon", "10.0.0-beta.1" + spec.dependency "PurchasesHybridCommon", '10.0.0-beta.1' spec.swift_version = '5.7' end From 85571070eca8b09c10f8b6010b3c9c7dcc27d9e1 Mon Sep 17 00:00:00 2001 From: Mark Villacampa Date: Wed, 28 Feb 2024 10:16:52 +0100 Subject: [PATCH 6/9] Clarify method is only iOS < 15 --- src/purchases.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/purchases.ts b/src/purchases.ts index 6dbfc211..fa21b644 100644 --- a/src/purchases.ts +++ b/src/purchases.ts @@ -741,6 +741,8 @@ export default class Purchases { } /** + * iOS only. Always returns an error on iOS < 15. + * * Use this method only if you already have your own IAP implementation using StoreKit 2 and want to use * RevenueCat's backend. If you are using StoreKit 1 for your implementation, you do not need this method. * From 56760dc3374921ba4fbb7765d9343ef22b721675 Mon Sep 17 00:00:00 2001 From: Mark Villacampa Date: Wed, 28 Feb 2024 10:23:40 +0100 Subject: [PATCH 7/9] return error --- ios/RNPurchases.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ios/RNPurchases.m b/ios/RNPurchases.m index afa51bdb..69468df7 100644 --- a/ios/RNPurchases.m +++ b/ios/RNPurchases.m @@ -262,8 +262,11 @@ static void logUnavailablePresentCodeRedemptionSheet() { completion:[self getResponseCompletionBlockWithResolve:resolve reject:reject]]; } else { - NSLog(@"[Purchases] Warning: tried to handle Observer Mode transaction, but it's only available on iOS 15.0 or greater."); - resolve(nil); + NSString* description = @"Tried to handle Observer Mode transaction, but it's only available on iOS 15.0 or greater."; + NSError* error = [[NSError alloc] initWithDomain: RCPurchasesErrorCodeDomain + code: RCUnknownError + userInfo: @{NSLocalizedDescriptionKey : description}]; + reject([NSString stringWithFormat:@"%ld", (long) error.code], [error localizedDescription], error); } } From 730308aee29644b0ac3bcdf96ac369b90b8c24d9 Mon Sep 17 00:00:00 2001 From: Mark Villacampa Date: Wed, 28 Feb 2024 10:50:54 +0100 Subject: [PATCH 8/9] use unsupported error code --- ios/RNPurchases.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/RNPurchases.m b/ios/RNPurchases.m index 69468df7..b7fc8bd3 100644 --- a/ios/RNPurchases.m +++ b/ios/RNPurchases.m @@ -264,7 +264,7 @@ static void logUnavailablePresentCodeRedemptionSheet() { } else { NSString* description = @"Tried to handle Observer Mode transaction, but it's only available on iOS 15.0 or greater."; NSError* error = [[NSError alloc] initWithDomain: RCPurchasesErrorCodeDomain - code: RCUnknownError + code: RCUnsupportedError userInfo: @{NSLocalizedDescriptionKey : description}]; reject([NSString stringWithFormat:@"%ld", (long) error.code], [error localizedDescription], error); } From da5f3aba5a54158d7414c99bffd37e307e3cbde3 Mon Sep 17 00:00:00 2001 From: Mark Villacampa Date: Tue, 9 Apr 2024 20:46:59 +0200 Subject: [PATCH 9/9] fix yarn --- yarn.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5d5ec854..bc30610d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2537,16 +2537,16 @@ __metadata: languageName: node linkType: hard -"@revenuecat/purchases-typescript-internal@npm:8.10.1": - version: 8.10.1 - resolution: "@revenuecat/purchases-typescript-internal@npm:8.10.1" - checksum: 1563bb24fd326d5b1cc584b563ea48dbb2a4f50908d8955e704782f8646770e47a74221e89a3dd21733f6fc2201914e406c7aca6cde6fe4fab1ee890cf2189c0 +"@revenuecat/purchases-typescript-internal@npm:10.1.0": + version: 10.1.0 + resolution: "@revenuecat/purchases-typescript-internal@npm:10.1.0" + checksum: 7986a806a631113a9db29d73852c307ff91ac23f12bf8f0ff34fa99cbfd6d062c8fc6493249f0b2a588b37e1532b89b407a081d2d66e20a4e82452b9ef0a4c7e languageName: node linkType: hard -"@sideway/address@npm:^4.1.3": - version: 4.1.4 - resolution: "@sideway/address@npm:4.1.4" +"@sideway/address@npm:^4.1.5": + version: 4.1.5 + resolution: "@sideway/address@npm:4.1.5" dependencies: "@hapi/hoek": ^9.0.0 checksum: 3e3ea0f00b4765d86509282290368a4a5fd39a7995fdc6de42116ca19a96120858e56c2c995081def06e1c53e1f8bccc7d013f6326602bec9d56b72ee2772b9d @@ -6994,8 +6994,8 @@ __metadata: resolution: "react-native-purchases@workspace:." dependencies: "@revenuecat/purchases-typescript-internal": 10.0.0-beta.1 - "@types/jest": ^28.1.2 - "@types/react": ~18.2.0 + "@types/jest": ^29.5.12 + "@types/react": ^18.2.44 "@types/react-dom": ~18.2.0 jest: ^29.7.0 jest-react-native: ^18.0.0