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

[WIP] Release 8.0 #919

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions RNPurchases.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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
16 changes: 8 additions & 8 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
22 changes: 17 additions & 5 deletions apitesters/purchases.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
ENTITLEMENT_VERIFICATION_MODE,
IN_APP_MESSAGE_TYPE,
STOREKIT_VERSION,
PurchasesOffering,
} from "@revenuecat/purchases-typescript-internal";
import {
Expand Down Expand Up @@ -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;
Expand All @@ -158,28 +160,30 @@ 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({
apiKey,
appUserID,
observerMode,
userDefaultsSuiteName,
usesStoreKit2IfAvailable,
storeKitVersion,
entitlementVerificationMode,
useAmazon,
});
Expand All @@ -188,7 +192,7 @@ async function checkConfigure() {
appUserID,
observerMode,
userDefaultsSuiteName,
usesStoreKit2IfAvailable,
storeKitVersion,
useAmazon,
shouldShowInAppMessagesAutomatically,
});
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/MagicWeather/ios/Podfile
Original file line number Diff line number Diff line change
@@ -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!
Expand Down
2 changes: 1 addition & 1 deletion examples/purchaseTesterTypescript/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Member Author

Choose a reason for hiding this comment

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

Currently, min_ios_version_supported of React Native is 12.4 but we only support 13+ in the new iOS SDK

prepare_react_native_project!

linkage = ENV['USE_FRAMEWORKS']
Expand Down
Loading