react-native-iap 13.0.4 → 14.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NitroIap.podspec +33 -0
- package/README.md +163 -51
- package/android/CMakeLists.txt +32 -0
- package/android/build.gradle +107 -138
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -13
- package/android/src/main/AndroidManifest.xml +1 -4
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +843 -0
- package/android/src/main/java/com/margelo/nitro/iap/NitroIapPackage.java +33 -0
- package/android/src/main/java/com/margelo/nitro/iap/Types.kt +173 -0
- package/ios/Bridge.h +8 -0
- package/ios/ErrorUtils.swift +153 -0
- package/ios/HybridRnIap.swift +1326 -0
- package/ios/ProductStore.swift +33 -0
- package/ios/reactnativeiap.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/reactnativeiap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/lib/module/helpers/subscription.js +56 -0
- package/lib/module/helpers/subscription.js.map +1 -0
- package/lib/module/hooks/useIAP.js +175 -123
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +1015 -9
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/specs/RnIap.nitro.js +4 -0
- package/lib/{commonjs/modules/common.js.map → module/specs/RnIap.nitro.js.map} +1 -1
- package/lib/module/types.js +187 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/error.js +80 -0
- package/lib/module/utils/error.js.map +1 -0
- package/lib/module/utils/type-bridge.js +202 -0
- package/lib/module/utils/type-bridge.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/plugin/src/withIAP.d.ts +2 -7
- package/lib/typescript/plugin/src/withIAP.d.ts.map +1 -1
- package/lib/typescript/scripts/check-nitro-versions.d.ts +3 -0
- package/lib/typescript/scripts/check-nitro-versions.d.ts.map +1 -0
- package/lib/typescript/src/helpers/subscription.d.ts +14 -0
- package/lib/typescript/src/helpers/subscription.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useIAP.d.ts +42 -26
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +356 -8
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +404 -0
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +544 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/error.d.ts +30 -0
- package/lib/typescript/src/utils/error.d.ts.map +1 -0
- package/lib/typescript/src/utils/type-bridge.d.ts +40 -0
- package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/NitroIap+autolinking.cmake +80 -0
- package/nitrogen/generated/android/NitroIap+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroIapOnLoad.cpp +50 -0
- package/nitrogen/generated/android/NitroIapOnLoad.hpp +25 -0
- package/nitrogen/generated/android/c++/JFunc_void_NitroProduct.hpp +78 -0
- package/nitrogen/generated/android/c++/JFunc_void_NitroPurchase.hpp +78 -0
- package/nitrogen/generated/android/c++/JFunc_void_NitroPurchaseResult.hpp +78 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +577 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +93 -0
- package/nitrogen/generated/android/c++/JNitroAndroidReceiptValidationOptions.hpp +66 -0
- package/nitrogen/generated/android/c++/JNitroAvailablePurchasesAndroidOptions.hpp +54 -0
- package/nitrogen/generated/android/c++/JNitroAvailablePurchasesIosOptions.hpp +65 -0
- package/nitrogen/generated/android/c++/JNitroAvailablePurchasesOptions.hpp +62 -0
- package/nitrogen/generated/android/c++/JNitroFinishTransactionAndroidParams.hpp +58 -0
- package/nitrogen/generated/android/c++/JNitroFinishTransactionIosParams.hpp +53 -0
- package/nitrogen/generated/android/c++/JNitroFinishTransactionParams.hpp +62 -0
- package/nitrogen/generated/android/c++/JNitroProduct.hpp +154 -0
- package/nitrogen/generated/android/c++/JNitroPurchase.hpp +122 -0
- package/nitrogen/generated/android/c++/JNitroPurchaseRequest.hpp +66 -0
- package/nitrogen/generated/android/c++/JNitroPurchaseResult.hpp +70 -0
- package/nitrogen/generated/android/c++/JNitroReceiptValidationParams.hpp +60 -0
- package/nitrogen/generated/android/c++/JNitroReceiptValidationResultAndroid.hpp +122 -0
- package/nitrogen/generated/android/c++/JNitroReceiptValidationResultIOS.hpp +68 -0
- package/nitrogen/generated/android/c++/JNitroRequestPurchaseAndroid.hpp +115 -0
- package/nitrogen/generated/android/c++/JNitroRequestPurchaseIos.hpp +84 -0
- package/nitrogen/generated/android/c++/JNitroSubscriptionOffer.hpp +57 -0
- package/nitrogen/generated/android/c++/JNitroSubscriptionRenewalInfo.hpp +74 -0
- package/nitrogen/generated/android/c++/JNitroSubscriptionStatus.hpp +64 -0
- package/nitrogen/generated/android/c++/JVariant_Boolean_NitroPurchaseResult.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_Boolean_NitroPurchaseResult.hpp +71 -0
- package/nitrogen/generated/android/c++/JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.hpp +75 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_NitroProduct.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_NitroPurchase.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Func_void_NitroPurchaseResult.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +198 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAndroidReceiptValidationOptions.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesAndroidOptions.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesIosOptions.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroAvailablePurchasesOptions.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroFinishTransactionAndroidParams.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroFinishTransactionIosParams.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroFinishTransactionParams.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroIapOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroProduct.kt +104 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchase.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseRequest.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroPurchaseResult.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationParams.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationResultAndroid.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroReceiptValidationResultIOS.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseAndroid.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroRequestPurchaseIos.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroSubscriptionOffer.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroSubscriptionRenewalInfo.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroSubscriptionStatus.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_Boolean_NitroPurchaseResult.kt +42 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.kt +42 -0
- package/nitrogen/generated/ios/NitroIap+autolinking.rb +60 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +152 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +1061 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +107 -0
- package/nitrogen/generated/ios/NitroIapAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroIapAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +355 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_NitroProduct.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_NitroPurchase.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_NitroPurchaseResult.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_NitroProduct_.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_NitroPurchase_.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__vector_NitroSubscriptionStatus__.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_NitroReceiptValidationResultIOS__NitroReceiptValidationResultAndroid_.swift +59 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_bool__NitroPurchaseResult_.swift +59 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_NitroProduct_.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_NitroPurchase_.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +78 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +750 -0
- package/nitrogen/generated/ios/swift/NitroAndroidReceiptValidationOptions.swift +80 -0
- package/nitrogen/generated/ios/swift/NitroAvailablePurchasesAndroidOptions.swift +54 -0
- package/nitrogen/generated/ios/swift/NitroAvailablePurchasesIosOptions.swift +116 -0
- package/nitrogen/generated/ios/swift/NitroAvailablePurchasesOptions.swift +84 -0
- package/nitrogen/generated/ios/swift/NitroFinishTransactionAndroidParams.swift +58 -0
- package/nitrogen/generated/ios/swift/NitroFinishTransactionIosParams.swift +35 -0
- package/nitrogen/generated/ios/swift/NitroFinishTransactionParams.swift +84 -0
- package/nitrogen/generated/ios/swift/NitroProduct.swift +653 -0
- package/nitrogen/generated/ios/swift/NitroPurchase.swift +453 -0
- package/nitrogen/generated/ios/swift/NitroPurchaseRequest.swift +84 -0
- package/nitrogen/generated/ios/swift/NitroPurchaseResult.swift +117 -0
- package/nitrogen/generated/ios/swift/NitroReceiptValidationParams.swift +65 -0
- package/nitrogen/generated/ios/swift/NitroReceiptValidationResultAndroid.swift +258 -0
- package/nitrogen/generated/ios/swift/NitroReceiptValidationResultIOS.swift +87 -0
- package/nitrogen/generated/ios/swift/NitroRequestPurchaseAndroid.swift +225 -0
- package/nitrogen/generated/ios/swift/NitroRequestPurchaseIos.swift +161 -0
- package/nitrogen/generated/ios/swift/NitroSubscriptionOffer.swift +46 -0
- package/nitrogen/generated/ios/swift/NitroSubscriptionRenewalInfo.swift +152 -0
- package/nitrogen/generated/ios/swift/NitroSubscriptionStatus.swift +76 -0
- package/nitrogen/generated/ios/swift/Variant_Bool_NitroPurchaseResult.swift +18 -0
- package/nitrogen/generated/ios/swift/Variant_NitroReceiptValidationResultIOS_NitroReceiptValidationResultAndroid.swift +18 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +50 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +125 -0
- package/nitrogen/generated/shared/c++/NitroAndroidReceiptValidationOptions.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroAvailablePurchasesAndroidOptions.hpp +68 -0
- package/nitrogen/generated/shared/c++/NitroAvailablePurchasesIosOptions.hpp +79 -0
- package/nitrogen/generated/shared/c++/NitroAvailablePurchasesOptions.hpp +76 -0
- package/nitrogen/generated/shared/c++/NitroFinishTransactionAndroidParams.hpp +72 -0
- package/nitrogen/generated/shared/c++/NitroFinishTransactionIosParams.hpp +67 -0
- package/nitrogen/generated/shared/c++/NitroFinishTransactionParams.hpp +76 -0
- package/nitrogen/generated/shared/c++/NitroProduct.hpp +168 -0
- package/nitrogen/generated/shared/c++/NitroPurchase.hpp +136 -0
- package/nitrogen/generated/shared/c++/NitroPurchaseRequest.hpp +76 -0
- package/nitrogen/generated/shared/c++/NitroPurchaseResult.hpp +84 -0
- package/nitrogen/generated/shared/c++/NitroReceiptValidationParams.hpp +74 -0
- package/nitrogen/generated/shared/c++/NitroReceiptValidationResultAndroid.hpp +136 -0
- package/nitrogen/generated/shared/c++/NitroReceiptValidationResultIOS.hpp +82 -0
- package/nitrogen/generated/shared/c++/NitroRequestPurchaseAndroid.hpp +95 -0
- package/nitrogen/generated/shared/c++/NitroRequestPurchaseIos.hpp +85 -0
- package/nitrogen/generated/shared/c++/NitroSubscriptionOffer.hpp +71 -0
- package/nitrogen/generated/shared/c++/NitroSubscriptionRenewalInfo.hpp +88 -0
- package/nitrogen/generated/shared/c++/NitroSubscriptionStatus.hpp +78 -0
- package/package.json +144 -104
- package/plugin/build/src/withIAP.d.ts +3 -0
- package/plugin/build/src/withIAP.js +81 -0
- package/plugin/build/tsconfig.tsbuildinfo +1 -0
- package/plugin/build/withIAP.d.ts +2 -7
- package/plugin/build/withIAP.js +62 -51
- package/plugin/src/withIAP.ts +119 -0
- package/plugin/tsconfig.json +18 -0
- package/plugin/tsconfig.tsbuildinfo +1 -0
- package/src/helpers/subscription.ts +65 -0
- package/src/hooks/useIAP.ts +361 -222
- package/src/index.ts +1194 -9
- package/src/specs/RnIap.nitro.ts +501 -0
- package/src/types.ts +680 -0
- package/src/utils/error.ts +97 -0
- package/src/utils/type-bridge.ts +209 -0
- package/LICENSE +0 -21
- package/RNIap.podspec +0 -36
- package/android/src/amazon/AndroidManifest.xml +0 -14
- package/android/src/amazon/java/com/dooboolab/rniap/EventSender.kt +0 -10
- package/android/src/amazon/java/com/dooboolab/rniap/PurchasingServiceProxy.kt +0 -29
- package/android/src/amazon/java/com/dooboolab/rniap/PurchasingServiceProxyAmazonImpl.kt +0 -31
- package/android/src/amazon/java/com/dooboolab/rniap/RNIapActivityListener.kt +0 -55
- package/android/src/amazon/java/com/dooboolab/rniap/RNIapAmazonListener.kt +0 -325
- package/android/src/amazon/java/com/dooboolab/rniap/RNIapAmazonModule.kt +0 -244
- package/android/src/amazon/java/com/dooboolab/rniap/RNIapPackage.kt +0 -17
- package/android/src/amazon/java/com/dooboolab/rniap/modifysubscription/RNIapAmazonModifySubscriptionListener.kt +0 -88
- package/android/src/amazon/java/com/dooboolab/rniap/utils/Extensions.kt +0 -22
- package/android/src/main/java/com/dooboolab/rniap/PromiseUtils.kt +0 -62
- package/android/src/main/java/com/dooboolab/rniap/PromiseUtlis.kt +0 -43
- package/android/src/play/java/com/dooboolab/rniap/PlayUtils.kt +0 -114
- package/android/src/play/java/com/dooboolab/rniap/RNIapActivityListener.kt +0 -15
- package/android/src/play/java/com/dooboolab/rniap/RNIapModule.kt +0 -911
- package/android/src/play/java/com/dooboolab/rniap/RNIapPackage.kt +0 -17
- package/android/src/testAmazon/java/com/dooboolab/rniap/RNIapAmazonModuleTest.kt +0 -170
- package/app.plugin.js +0 -1
- package/ios/IapSerializationUtils.swift +0 -290
- package/ios/IapTypes.swift +0 -56
- package/ios/IapUtils.swift +0 -40
- package/ios/LatestPromiseKeeper.swift +0 -52
- package/ios/RNIapIos-Bridging-Header.h +0 -2
- package/ios/RNIapIos.m +0 -69
- package/ios/RNIapIos.swift +0 -868
- package/ios/RNIapIos.xcodeproj/project.pbxproj +0 -289
- package/ios/RNIapIosSk2.m +0 -126
- package/ios/RNIapIosSk2.swift +0 -1413
- package/ios/ThreadSafe.swift +0 -18
- package/lib/commonjs/eventEmitter.js +0 -195
- package/lib/commonjs/eventEmitter.js.map +0 -1
- package/lib/commonjs/hooks/index.js +0 -17
- package/lib/commonjs/hooks/index.js.map +0 -1
- package/lib/commonjs/hooks/useIAP.js +0 -203
- package/lib/commonjs/hooks/useIAP.js.map +0 -1
- package/lib/commonjs/hooks/withIAPContext.js +0 -95
- package/lib/commonjs/hooks/withIAPContext.js.map +0 -1
- package/lib/commonjs/iap.js +0 -836
- package/lib/commonjs/iap.js.map +0 -1
- package/lib/commonjs/index.js +0 -105
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/internal/enhancedFetch.js +0 -26
- package/lib/commonjs/internal/enhancedFetch.js.map +0 -1
- package/lib/commonjs/internal/fillProductsWithAdditionalData.js +0 -50
- package/lib/commonjs/internal/fillProductsWithAdditionalData.js.map +0 -1
- package/lib/commonjs/internal/index.js +0 -39
- package/lib/commonjs/internal/index.js.map +0 -1
- package/lib/commonjs/internal/platform.js +0 -119
- package/lib/commonjs/internal/platform.js.map +0 -1
- package/lib/commonjs/modules/amazon.js +0 -50
- package/lib/commonjs/modules/amazon.js.map +0 -1
- package/lib/commonjs/modules/android.js +0 -92
- package/lib/commonjs/modules/android.js.map +0 -1
- package/lib/commonjs/modules/common.js +0 -2
- package/lib/commonjs/modules/index.js +0 -50
- package/lib/commonjs/modules/index.js.map +0 -1
- package/lib/commonjs/modules/ios.js +0 -160
- package/lib/commonjs/modules/ios.js.map +0 -1
- package/lib/commonjs/modules/iosSk2.js +0 -113
- package/lib/commonjs/modules/iosSk2.js.map +0 -1
- package/lib/commonjs/purchaseError.js +0 -170
- package/lib/commonjs/purchaseError.js.map +0 -1
- package/lib/commonjs/types/amazon.js +0 -2
- package/lib/commonjs/types/amazon.js.map +0 -1
- package/lib/commonjs/types/android.js +0 -67
- package/lib/commonjs/types/android.js.map +0 -1
- package/lib/commonjs/types/apple.js +0 -24
- package/lib/commonjs/types/apple.js.map +0 -1
- package/lib/commonjs/types/appleSk2.js +0 -137
- package/lib/commonjs/types/appleSk2.js.map +0 -1
- package/lib/commonjs/types/index.js +0 -67
- package/lib/commonjs/types/index.js.map +0 -1
- package/lib/commonjs/utils/errorMapping.js +0 -83
- package/lib/commonjs/utils/errorMapping.js.map +0 -1
- package/lib/commonjs/utils/typeGuards.js +0 -74
- package/lib/commonjs/utils/typeGuards.js.map +0 -1
- package/lib/module/eventEmitter.js +0 -185
- package/lib/module/eventEmitter.js.map +0 -1
- package/lib/module/hooks/index.js +0 -2
- package/lib/module/hooks/index.js.map +0 -1
- package/lib/module/hooks/withIAPContext.js +0 -86
- package/lib/module/hooks/withIAPContext.js.map +0 -1
- package/lib/module/iap.js +0 -805
- package/lib/module/iap.js.map +0 -1
- package/lib/module/internal/enhancedFetch.js +0 -19
- package/lib/module/internal/enhancedFetch.js.map +0 -1
- package/lib/module/internal/fillProductsWithAdditionalData.js +0 -43
- package/lib/module/internal/fillProductsWithAdditionalData.js.map +0 -1
- package/lib/module/internal/index.js +0 -4
- package/lib/module/internal/index.js.map +0 -1
- package/lib/module/internal/platform.js +0 -102
- package/lib/module/internal/platform.js.map +0 -1
- package/lib/module/modules/amazon.js +0 -42
- package/lib/module/modules/amazon.js.map +0 -1
- package/lib/module/modules/android.js +0 -81
- package/lib/module/modules/android.js.map +0 -1
- package/lib/module/modules/common.js +0 -2
- package/lib/module/modules/common.js.map +0 -1
- package/lib/module/modules/index.js +0 -5
- package/lib/module/modules/index.js.map +0 -1
- package/lib/module/modules/ios.js +0 -145
- package/lib/module/modules/ios.js.map +0 -1
- package/lib/module/modules/iosSk2.js +0 -96
- package/lib/module/modules/iosSk2.js.map +0 -1
- package/lib/module/purchaseError.js +0 -164
- package/lib/module/purchaseError.js.map +0 -1
- package/lib/module/types/amazon.js +0 -2
- package/lib/module/types/amazon.js.map +0 -1
- package/lib/module/types/android.js +0 -63
- package/lib/module/types/android.js.map +0 -1
- package/lib/module/types/apple.js +0 -17
- package/lib/module/types/apple.js.map +0 -1
- package/lib/module/types/appleSk2.js +0 -129
- package/lib/module/types/appleSk2.js.map +0 -1
- package/lib/module/types/index.js +0 -75
- package/lib/module/types/index.js.map +0 -1
- package/lib/module/utils/errorMapping.js +0 -75
- package/lib/module/utils/errorMapping.js.map +0 -1
- package/lib/module/utils/typeGuards.js +0 -61
- package/lib/module/utils/typeGuards.js.map +0 -1
- package/lib/typescript/src/eventEmitter.d.ts +0 -151
- package/lib/typescript/src/eventEmitter.d.ts.map +0 -1
- package/lib/typescript/src/hooks/index.d.ts +0 -2
- package/lib/typescript/src/hooks/index.d.ts.map +0 -1
- package/lib/typescript/src/hooks/withIAPContext.d.ts +0 -27
- package/lib/typescript/src/hooks/withIAPContext.d.ts.map +0 -1
- package/lib/typescript/src/iap.d.ts +0 -503
- package/lib/typescript/src/iap.d.ts.map +0 -1
- package/lib/typescript/src/internal/enhancedFetch.d.ts +0 -6
- package/lib/typescript/src/internal/enhancedFetch.d.ts.map +0 -1
- package/lib/typescript/src/internal/fillProductsWithAdditionalData.d.ts +0 -7
- package/lib/typescript/src/internal/fillProductsWithAdditionalData.d.ts.map +0 -1
- package/lib/typescript/src/internal/index.d.ts +0 -4
- package/lib/typescript/src/internal/index.d.ts.map +0 -1
- package/lib/typescript/src/internal/platform.d.ts +0 -27
- package/lib/typescript/src/internal/platform.d.ts.map +0 -1
- package/lib/typescript/src/modules/amazon.d.ts +0 -55
- package/lib/typescript/src/modules/amazon.d.ts.map +0 -1
- package/lib/typescript/src/modules/android.d.ts +0 -74
- package/lib/typescript/src/modules/android.d.ts.map +0 -1
- package/lib/typescript/src/modules/common.d.ts +0 -14
- package/lib/typescript/src/modules/common.d.ts.map +0 -1
- package/lib/typescript/src/modules/index.d.ts +0 -5
- package/lib/typescript/src/modules/index.d.ts.map +0 -1
- package/lib/typescript/src/modules/ios.d.ts +0 -117
- package/lib/typescript/src/modules/ios.d.ts.map +0 -1
- package/lib/typescript/src/modules/iosSk2.d.ts +0 -140
- package/lib/typescript/src/modules/iosSk2.d.ts.map +0 -1
- package/lib/typescript/src/purchaseError.d.ts +0 -133
- package/lib/typescript/src/purchaseError.d.ts.map +0 -1
- package/lib/typescript/src/types/amazon.d.ts +0 -33
- package/lib/typescript/src/types/amazon.d.ts.map +0 -1
- package/lib/typescript/src/types/android.d.ts +0 -66
- package/lib/typescript/src/types/android.d.ts.map +0 -1
- package/lib/typescript/src/types/apple.d.ts +0 -27
- package/lib/typescript/src/types/apple.d.ts.map +0 -1
- package/lib/typescript/src/types/appleSk2.d.ts +0 -129
- package/lib/typescript/src/types/appleSk2.d.ts.map +0 -1
- package/lib/typescript/src/types/index.d.ts +0 -302
- package/lib/typescript/src/types/index.d.ts.map +0 -1
- package/lib/typescript/src/utils/errorMapping.d.ts +0 -29
- package/lib/typescript/src/utils/errorMapping.d.ts.map +0 -1
- package/lib/typescript/src/utils/typeGuards.d.ts +0 -53
- package/lib/typescript/src/utils/typeGuards.d.ts.map +0 -1
- package/src/eventEmitter.ts +0 -212
- package/src/hooks/index.ts +0 -1
- package/src/hooks/withIAPContext.tsx +0 -179
- package/src/iap.ts +0 -1046
- package/src/internal/enhancedFetch.ts +0 -25
- package/src/internal/fillProductsWithAdditionalData.ts +0 -47
- package/src/internal/index.ts +0 -3
- package/src/internal/platform.ts +0 -135
- package/src/modules/amazon.ts +0 -94
- package/src/modules/android.ts +0 -179
- package/src/modules/common.ts +0 -16
- package/src/modules/index.ts +0 -4
- package/src/modules/ios.ts +0 -229
- package/src/modules/iosSk2.ts +0 -194
- package/src/purchaseError.ts +0 -196
- package/src/types/amazon.ts +0 -40
- package/src/types/android.ts +0 -89
- package/src/types/apple.ts +0 -44
- package/src/types/appleSk2.ts +0 -275
- package/src/types/index.ts +0 -379
- package/src/utils/errorMapping.ts +0 -88
- package/src/utils/typeGuards.ts +0 -90
package/NitroIap.podspec
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "NitroIap"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported, :visionos => 1.0 }
|
|
14
|
+
s.source = { :git => "https://github.com/hyochan/react-native-iap.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = [
|
|
17
|
+
"ios/**/*.{swift}",
|
|
18
|
+
"ios/**/*.{m,mm}",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
s.exclude_files = [
|
|
22
|
+
"ios/RnIap-Bridging-Header.h",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
load 'nitrogen/generated/ios/NitroIap+autolinking.rb'
|
|
26
|
+
add_nitrogen_files(s)
|
|
27
|
+
|
|
28
|
+
s.dependency 'React-Core'
|
|
29
|
+
s.dependency 'React-jsi'
|
|
30
|
+
s.dependency 'React-callinvoker'
|
|
31
|
+
|
|
32
|
+
install_modules_dependencies(s)
|
|
33
|
+
end
|
package/README.md
CHANGED
|
@@ -1,91 +1,203 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
---
|
|
1
|
+
# React Native IAP
|
|
4
2
|
|
|
3
|
+
<div align="center">
|
|
4
|
+
<img src="https://react-native-iap.hyo.dev/img/icon.png" alt="React Native IAP Logo" width="150" />
|
|
5
|
+
|
|
5
6
|
[](https://npmjs.org/package/react-native-iap)
|
|
6
7
|
[](https://npmjs.org/package/react-native-iap)
|
|
7
8
|
[](https://npmjs.org/package/react-native-iap)
|
|
8
9
|
[](https://opencollective.com/react-native-iap)
|
|
9
10
|
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fhyochan%2Freact-native-iap?ref=badge_shield&issueType=license)
|
|
11
|
+
|
|
12
|
+
**React Native IAP** is a high-performance in-app purchase library using Nitro Modules that **conforms to the [Open IAP specification](https://openiap.dev)**. It provides a unified API for handling in-app purchases across iOS and Android platforms with comprehensive error handling and modern TypeScript support.
|
|
13
|
+
|
|
14
|
+
<a href="https://openiap.dev"><img src="https://openiap.dev/logo.png" alt="Open IAP" height="40" /></a>
|
|
15
|
+
</div>
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
## 📚 Documentation
|
|
18
|
+
|
|
19
|
+
**[📖 Visit our comprehensive documentation site →](https://react-native-iap.hyo.dev)**
|
|
20
|
+
|
|
21
|
+
## ⚠️ Notice
|
|
22
|
+
|
|
23
|
+
**Starting from version 14.0.0**, this library uses [Nitro Modules](https://github.com/mrousavy/nitro) for high-performance native bridge implementation. You must install `react-native-nitro-modules` alongside `react-native-iap`.
|
|
24
|
+
|
|
25
|
+
## ✨ Features
|
|
26
|
+
|
|
27
|
+
- 🔄 **Cross-platform Support**: Works seamlessly on both iOS and Android
|
|
28
|
+
- ⚡ **Nitro Modules**: High-performance native bridge with minimal overhead
|
|
29
|
+
- 🎯 **TypeScript First**: Full TypeScript support with comprehensive type definitions
|
|
30
|
+
- 🛡️ **Centralized Error Handling**: Unified error management with platform-specific error code mapping
|
|
31
|
+
- 🎣 **React Hooks**: Modern React hooks API with `useIAP`
|
|
32
|
+
- 📱 **Expo Compatible**: Works with Expo development builds
|
|
33
|
+
- 🔍 **Receipt Validation**: Built-in receipt validation for both platforms
|
|
34
|
+
- 💎 **Products & Subscriptions**: Support for both one-time purchases and subscriptions
|
|
35
|
+
- 🚀 **Performance Optimized**: Efficient caching and minimal re-renders
|
|
36
|
+
|
|
37
|
+
## 🚀 Quick Start
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install react-native-iap react-native-nitro-modules
|
|
41
|
+
# or
|
|
42
|
+
yarn add react-native-iap react-native-nitro-modules
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**[📖 See the complete installation guide and quick start tutorial →](https://react-native-iap.hyo.dev/docs/installation)**
|
|
46
|
+
|
|
47
|
+
## 🏗️ Architecture
|
|
48
|
+
|
|
49
|
+
React Native IAP is built with a modern architecture that emphasizes:
|
|
50
|
+
|
|
51
|
+
- **Nitro Modules**: High-performance native bridge with C++ core and platform-specific implementations
|
|
52
|
+
- **Type Safety**: Comprehensive TypeScript definitions for all APIs
|
|
53
|
+
- **Error Resilience**: Centralized error handling with meaningful error codes
|
|
54
|
+
- **Platform Abstraction**: Unified API that handles platform differences internally
|
|
55
|
+
- **Performance**: Optimized for minimal bundle size and runtime performance
|
|
56
|
+
|
|
57
|
+
## 📱 Platform Support
|
|
12
58
|
|
|
13
|
-
|
|
59
|
+
| Platform | Support | Notes |
|
|
60
|
+
| ----------------- | ------- | --------------------------------------- |
|
|
61
|
+
| iOS | ✅ | StoreKit 2 (requires iOS 15+) |
|
|
62
|
+
| Android | ✅ | Google Play Billing v8.0.0+ |
|
|
63
|
+
| Expo Go | ❌ | Not supported (requires native modules) |
|
|
64
|
+
| Expo Dev Client | ✅ | Full support |
|
|
65
|
+
| Bare React Native | ✅ | Full support |
|
|
14
66
|
|
|
15
|
-
|
|
67
|
+
## 📦 Installation & Configuration
|
|
16
68
|
|
|
17
|
-
###
|
|
69
|
+
### Prerequisites
|
|
18
70
|
|
|
19
|
-
|
|
20
|
-
- Full StoreKit 2 support for iOS
|
|
21
|
-
- Modern architecture using Expo Modules
|
|
22
|
-
- Works with both Expo and bare React Native projects
|
|
71
|
+
Before installing React Native IAP, make sure you have:
|
|
23
72
|
|
|
24
|
-
|
|
73
|
+
- React Native 0.64 or later, or Expo SDK 45 or later
|
|
74
|
+
- Node.js 16 or later
|
|
75
|
+
- iOS 15+ for iOS apps (StoreKit 2 requirement)
|
|
76
|
+
- Android API level 21+ for Android apps
|
|
25
77
|
|
|
26
|
-
|
|
27
|
-
- 💬 [Discussion #2754](https://github.com/hyochan/react-native-iap/discussions/2754)
|
|
28
|
-
- 🚀 [expo-iap repository](https://github.com/hyochan/expo-iap)
|
|
78
|
+
### Post Installation
|
|
29
79
|
|
|
30
|
-
|
|
80
|
+
#### Android Configuration
|
|
31
81
|
|
|
32
|
-
|
|
82
|
+
Add the following dependencies to your `android/app/build.gradle` file:
|
|
33
83
|
|
|
34
|
-
|
|
84
|
+
```gradle
|
|
85
|
+
dependencies {
|
|
86
|
+
// Google Play Billing Library
|
|
87
|
+
implementation "com.android.billingclient:billing-ktx:8.0.0"
|
|
35
88
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
89
|
+
// Google Play Services
|
|
90
|
+
implementation "com.google.android.gms:play-services-base:18.1.0"
|
|
91
|
+
}
|
|
92
|
+
```
|
|
40
93
|
|
|
41
|
-
**
|
|
94
|
+
**Kotlin Version Requirement:** This library requires Kotlin 2.0+. Configure your project's Kotlin version:
|
|
42
95
|
|
|
43
|
-
|
|
44
|
-
- Better performance and stability
|
|
45
|
-
- Continued updates and support
|
|
46
|
-
- Modern React Native architecture
|
|
96
|
+
In your root `android/build.gradle`:
|
|
47
97
|
|
|
48
|
-
|
|
98
|
+
```gradle
|
|
99
|
+
buildscript {
|
|
100
|
+
ext {
|
|
101
|
+
kotlinVersion = "2.1.20"
|
|
102
|
+
}
|
|
103
|
+
dependencies {
|
|
104
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
49
108
|
|
|
50
|
-
|
|
109
|
+
#### iOS Configuration
|
|
51
110
|
|
|
52
|
-
|
|
111
|
+
1. **Install pods**:
|
|
53
112
|
|
|
54
|
-
|
|
113
|
+
```bash
|
|
114
|
+
cd ios && pod install
|
|
115
|
+
```
|
|
55
116
|
|
|
56
|
-
|
|
117
|
+
2. **Add StoreKit capability** to your iOS app in Xcode:
|
|
118
|
+
- Open your project in Xcode
|
|
119
|
+
- Select your app target
|
|
120
|
+
- Go to "Signing & Capabilities"
|
|
121
|
+
- Click "+ Capability" and add "In-App Purchase"
|
|
57
122
|
|
|
58
|
-
|
|
123
|
+
#### Expo Configuration
|
|
124
|
+
|
|
125
|
+
For Expo projects, add the plugin to your `app.json` or `expo.json`:
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"expo": {
|
|
130
|
+
"plugins": [
|
|
131
|
+
"react-native-iap",
|
|
132
|
+
[
|
|
133
|
+
"expo-build-properties",
|
|
134
|
+
{
|
|
135
|
+
"android": {
|
|
136
|
+
"kotlinVersion": "2.1.20"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Note:** Expo projects require [development build (dev-client)](https://docs.expo.dev/develop/development-builds/introduction/) as this library contains native code.
|
|
146
|
+
|
|
147
|
+
### Store Configuration
|
|
148
|
+
|
|
149
|
+
React Native IAP is **OpenIAP compliant**. For detailed store configuration:
|
|
150
|
+
|
|
151
|
+
- **[iOS Setup →](https://www.openiap.dev/docs/ios-setup)** - App Store Connect configuration
|
|
152
|
+
- **[Android Setup →](https://www.openiap.dev/docs/android-setup)** - Google Play Console configuration
|
|
153
|
+
|
|
154
|
+
## 🎯 What's Next?
|
|
155
|
+
|
|
156
|
+
**[📖 Visit our comprehensive documentation site →](https://react-native-iap.hyo.dev)**
|
|
157
|
+
|
|
158
|
+
### Key Resources
|
|
159
|
+
|
|
160
|
+
- **[Installation & Quick Start](https://react-native-iap.hyo.dev/docs/installation)** - Get started in minutes
|
|
161
|
+
- **[API Reference](https://react-native-iap.hyo.dev/docs/api)** - Complete useIAP hook documentation
|
|
162
|
+
- **[Examples](https://react-native-iap.hyo.dev/docs/examples/basic-store)** - Production-ready implementations
|
|
163
|
+
- **[Error Handling](https://react-native-iap.hyo.dev/docs/api/error-codes)** - OpenIAP compliant error codes
|
|
164
|
+
- **[Troubleshooting](https://react-native-iap.hyo.dev/docs/guides/troubleshooting)** - Common issues and solutions
|
|
59
165
|
|
|
60
166
|
## Sponsors
|
|
61
167
|
|
|
62
|
-
|
|
168
|
+
💼 **[View Our Sponsors](https://openiap.dev/sponsors)**
|
|
169
|
+
|
|
170
|
+
### <p style="color: rgb(255, 182, 193);">Angel</p>
|
|
63
171
|
|
|
64
|
-
<a href="https://
|
|
65
|
-
<img width="
|
|
172
|
+
<a href="https://meta.com">
|
|
173
|
+
<img width="600" alt="courier_dot_com" src="https://static.xx.fbcdn.net/rsrc.php/y3/r/y6QsbGgc866.svg" />
|
|
66
174
|
</a>
|
|
67
175
|
|
|
68
|
-
## Past
|
|
176
|
+
## Past Supporters
|
|
69
177
|
|
|
70
|
-
<
|
|
178
|
+
<div style="display: flex; align-items:center; gap: 10px;">
|
|
179
|
+
<a href="https://namiml.com" style="opacity: 50%">
|
|
180
|
+
<img src="https://github.com/hyochan/react-native-iap/assets/27461460/89d71f61-bb73-400a-83bd-fe0f96eb726e" alt="Nami ML" width="140"/>
|
|
181
|
+
</a>
|
|
182
|
+
<a href="https://www.courier.com/?utm_source=react-native-iap&utm_campaign=osssponsors" style="opacity: 50%;">
|
|
183
|
+
<img width="80" alt="courier_dot_com" src="https://github.com/user-attachments/assets/319d8966-6839-498d-8ead-ce8cc72c3bca" />
|
|
184
|
+
</a>
|
|
185
|
+
</div>
|
|
71
186
|
|
|
72
|
-
Support this project by becoming a sponsor. Your logo will show up here with
|
|
73
|
-
a link to your website. [Buy me a coffee](https://www.buymeacoffee.com/hyochan) or
|
|
74
|
-
[Become a sponsor](https://opencollective.com/react-native-iap#sponsor).
|
|
75
|
-
<a href="https://opencollective.com/react-native-iap#sponsors" target="_blank"><img src="https://opencollective.com/react-native-iap/sponsors.svg?width=890" /></a>
|
|
187
|
+
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Buy me a coffee](https://www.buymeacoffee.com/hyochan).
|
|
76
188
|
|
|
77
|
-
|
|
189
|
+
---
|
|
78
190
|
|
|
79
|
-
|
|
80
|
-
<a href="https://opencollective.com/react-native-iap#backers" target="_blank"><img src="https://opencollective.com/react-native-iap/backers.svg?width=890" /></a>
|
|
191
|
+
### OpenCollective Sponsorship
|
|
81
192
|
|
|
82
|
-
|
|
193
|
+
We also manage sponsorships through OpenCollective, which operates separately from our main sponsor program.
|
|
83
194
|
|
|
84
|
-
|
|
85
|
-
Thank you to all the people who helped to maintain and upgrade this project!
|
|
195
|
+
**Sponsors:** <a href="https://opencollective.com/react-native-iap#sponsors" target="_blank"><img src="https://opencollective.com/react-native-iap/sponsors.svg?width=890" /></a>
|
|
86
196
|
|
|
87
|
-
<a href="
|
|
197
|
+
**Backers:** <a href="https://opencollective.com/react-native-iap#backers" target="_blank"><img src="https://opencollective.com/react-native-iap/backers.svg?width=890" /></a>
|
|
88
198
|
|
|
89
|
-
|
|
199
|
+
[Become a sponsor](https://opencollective.com/react-native-iap#sponsor) | [Become a backer](https://opencollective.com/react-native-iap#backer)
|
|
200
|
+
|
|
201
|
+
## Contributing
|
|
90
202
|
|
|
91
|
-
[
|
|
203
|
+
See our [Contributing Guide](./CONTRIBUTING.md) for development setup and guidelines.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
project(NitroIap)
|
|
2
|
+
cmake_minimum_required(VERSION 3.9.0)
|
|
3
|
+
|
|
4
|
+
set (PACKAGE_NAME NitroIap)
|
|
5
|
+
set (CMAKE_VERBOSE_MAKEFILE ON)
|
|
6
|
+
set (CMAKE_CXX_STANDARD 20)
|
|
7
|
+
|
|
8
|
+
# Enable Raw Props parsing in react-native (for Nitro Views)
|
|
9
|
+
add_compile_options(-DRN_SERIALIZABLE_STATE=1)
|
|
10
|
+
|
|
11
|
+
# Define C++ library and add all sources
|
|
12
|
+
add_library(${PACKAGE_NAME} SHARED
|
|
13
|
+
src/main/cpp/cpp-adapter.cpp
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
# Add Nitrogen specs :)
|
|
17
|
+
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroIap+autolinking.cmake)
|
|
18
|
+
|
|
19
|
+
# Set up local includes
|
|
20
|
+
include_directories(
|
|
21
|
+
"src/main/cpp"
|
|
22
|
+
"../cpp"
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
find_library(LOG_LIB log)
|
|
26
|
+
|
|
27
|
+
# Link all libraries together
|
|
28
|
+
target_link_libraries(
|
|
29
|
+
${PACKAGE_NAME}
|
|
30
|
+
${LOG_LIB}
|
|
31
|
+
android # <-- Android core
|
|
32
|
+
)
|
package/android/build.gradle
CHANGED
|
@@ -1,196 +1,165 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
-
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
-
def kotlinVersion = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["RNIap_kotlinVersion"]
|
|
4
|
-
|
|
5
2
|
repositories {
|
|
6
3
|
google()
|
|
7
4
|
mavenCentral()
|
|
8
5
|
}
|
|
9
6
|
|
|
10
7
|
dependencies {
|
|
11
|
-
classpath "com.android.tools.build:gradle:
|
|
12
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin
|
|
8
|
+
classpath "com.android.tools.build:gradle:8.12.1"
|
|
9
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.20"
|
|
13
10
|
}
|
|
14
11
|
}
|
|
15
12
|
|
|
13
|
+
def reactNativeArchitectures() {
|
|
14
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
15
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
16
|
+
}
|
|
17
|
+
|
|
16
18
|
def isNewArchitectureEnabled() {
|
|
17
|
-
return rootProject.hasProperty("newArchEnabled") &&
|
|
19
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
apply plugin: "com.android.library"
|
|
21
|
-
apply plugin:
|
|
23
|
+
apply plugin: 'org.jetbrains.kotlin.android'
|
|
24
|
+
|
|
25
|
+
// Get kotlinVersion from root project or use default
|
|
26
|
+
def kotlinVersion = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : '2.0.21'
|
|
22
27
|
|
|
23
|
-
if
|
|
24
|
-
|
|
28
|
+
// Only apply Nitro autolinking if the file exists
|
|
29
|
+
def nitroAutolinkingFile = file('../nitrogen/generated/android/NitroIap+autolinking.gradle')
|
|
30
|
+
if (nitroAutolinkingFile.exists()) {
|
|
31
|
+
apply from: nitroAutolinkingFile
|
|
25
32
|
}
|
|
26
33
|
|
|
34
|
+
apply from: "./fix-prefab.gradle"
|
|
35
|
+
|
|
36
|
+
// DO NOT apply Facebook React plugin for library modules
|
|
37
|
+
// This should only be applied to application modules
|
|
38
|
+
// if (isNewArchitectureEnabled()) {
|
|
39
|
+
// apply plugin: "com.facebook.react"
|
|
40
|
+
// }
|
|
41
|
+
|
|
27
42
|
def getExtOrDefault(name) {
|
|
28
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["
|
|
43
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["NitroIap_" + name]
|
|
29
44
|
}
|
|
30
45
|
|
|
31
46
|
def getExtOrIntegerDefault(name) {
|
|
32
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["
|
|
47
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["NitroIap_" + name]).toInteger()
|
|
33
48
|
}
|
|
34
49
|
|
|
35
50
|
android {
|
|
51
|
+
namespace "com.margelo.nitro.iap"
|
|
52
|
+
|
|
53
|
+
ndkVersion getExtOrDefault("ndkVersion")
|
|
36
54
|
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
37
55
|
|
|
38
56
|
defaultConfig {
|
|
39
57
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
40
58
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
41
59
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
42
|
-
buildConfigField "boolean", "IS_AMAZON_DRM_ENABLED", getExtOrDefault("isAmazonDrmEnabled")
|
|
43
|
-
}
|
|
44
60
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
61
|
+
externalNativeBuild {
|
|
62
|
+
cmake {
|
|
63
|
+
cppFlags "-frtti -fexceptions -Wall -Wextra -fstack-protector-all"
|
|
64
|
+
arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
|
|
65
|
+
abiFilters (*reactNativeArchitectures())
|
|
66
|
+
|
|
67
|
+
buildTypes {
|
|
68
|
+
debug {
|
|
69
|
+
cppFlags "-O1 -g"
|
|
70
|
+
}
|
|
71
|
+
release {
|
|
72
|
+
cppFlags "-O2"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
48
76
|
}
|
|
49
77
|
}
|
|
50
78
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
79
|
+
externalNativeBuild {
|
|
80
|
+
cmake {
|
|
81
|
+
path "CMakeLists.txt"
|
|
82
|
+
}
|
|
54
83
|
}
|
|
55
84
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
85
|
+
packagingOptions {
|
|
86
|
+
excludes = [
|
|
87
|
+
"META-INF",
|
|
88
|
+
"META-INF/**",
|
|
89
|
+
"**/libc++_shared.so",
|
|
90
|
+
"**/libfbjni.so",
|
|
91
|
+
"**/libjsi.so",
|
|
92
|
+
"**/libfolly_json.so",
|
|
93
|
+
"**/libfolly_runtime.so",
|
|
94
|
+
"**/libglog.so",
|
|
95
|
+
"**/libhermes.so",
|
|
96
|
+
"**/libhermes-executor-debug.so",
|
|
97
|
+
"**/libhermes_executor.so",
|
|
98
|
+
"**/libreactnative.so",
|
|
99
|
+
"**/libreactnativejni.so",
|
|
100
|
+
"**/libturbomodulejsijni.so",
|
|
101
|
+
"**/libreact_nativemodule_core.so",
|
|
102
|
+
"**/libjscexecutor.so"
|
|
103
|
+
]
|
|
59
104
|
}
|
|
60
105
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
dimension "store"
|
|
66
|
-
}
|
|
106
|
+
buildFeatures {
|
|
107
|
+
buildConfig true
|
|
108
|
+
prefab true
|
|
109
|
+
}
|
|
67
110
|
|
|
68
|
-
|
|
69
|
-
|
|
111
|
+
buildTypes {
|
|
112
|
+
release {
|
|
113
|
+
minifyEnabled false
|
|
70
114
|
}
|
|
71
115
|
}
|
|
116
|
+
|
|
117
|
+
compileOptions {
|
|
118
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
119
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Configure Kotlin compiler to match Java compatibility
|
|
123
|
+
kotlinOptions {
|
|
124
|
+
jvmTarget = "17"
|
|
125
|
+
freeCompilerArgs += ["-Xskip-metadata-version-check"]
|
|
126
|
+
}
|
|
72
127
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
jvmArgs '-noverify'
|
|
76
|
-
}
|
|
77
|
-
unitTests.returnDefaultValues = true
|
|
128
|
+
lintOptions {
|
|
129
|
+
disable "GradleCompatible"
|
|
78
130
|
}
|
|
131
|
+
|
|
132
|
+
// Removed sourceSets configuration for codegen as it's not needed for library modules
|
|
79
133
|
}
|
|
80
134
|
|
|
81
135
|
repositories {
|
|
82
136
|
mavenCentral()
|
|
83
137
|
google()
|
|
84
|
-
|
|
85
|
-
def found = false
|
|
86
|
-
def defaultDir = null
|
|
87
|
-
def androidSourcesName = "React Native sources"
|
|
88
|
-
|
|
89
|
-
if (rootProject.ext.has("reactNativeAndroidRoot")) {
|
|
90
|
-
defaultDir = rootProject.ext.get("reactNativeAndroidRoot")
|
|
91
|
-
} else {
|
|
92
|
-
defaultDir = new File(
|
|
93
|
-
projectDir,
|
|
94
|
-
"/../../../node_modules/react-native/android"
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (defaultDir.exists()) {
|
|
99
|
-
maven {
|
|
100
|
-
url defaultDir.toString()
|
|
101
|
-
name androidSourcesName
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
|
|
105
|
-
found = true
|
|
106
|
-
} else {
|
|
107
|
-
def parentDir = rootProject.projectDir
|
|
108
|
-
|
|
109
|
-
1.upto(5, {
|
|
110
|
-
if (found) return true
|
|
111
|
-
parentDir = parentDir.parentFile
|
|
112
|
-
|
|
113
|
-
def androidSourcesDir = new File(
|
|
114
|
-
parentDir,
|
|
115
|
-
"node_modules/react-native"
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
def androidPrebuiltBinaryDir = new File(
|
|
119
|
-
parentDir,
|
|
120
|
-
"node_modules/react-native/android"
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
if (androidPrebuiltBinaryDir.exists()) {
|
|
124
|
-
maven {
|
|
125
|
-
url androidPrebuiltBinaryDir.toString()
|
|
126
|
-
name androidSourcesName
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
|
|
130
|
-
found = true
|
|
131
|
-
} else if (androidSourcesDir.exists()) {
|
|
132
|
-
maven {
|
|
133
|
-
url androidSourcesDir.toString()
|
|
134
|
-
name androidSourcesName
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
|
|
138
|
-
found = true
|
|
139
|
-
}
|
|
140
|
-
})
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (!found) {
|
|
144
|
-
throw new GradleException(
|
|
145
|
-
"${project.name}: unable to locate React Native android sources. " +
|
|
146
|
-
"Ensure you have you installed React Native as a dependency in your project and try again."
|
|
147
|
-
)
|
|
148
|
-
}
|
|
149
138
|
}
|
|
150
139
|
|
|
151
|
-
def kotlinVersion = getExtOrDefault("kotlinVersion")
|
|
152
|
-
def playServicesVersion = getExtOrDefault("playServicesVersion")
|
|
153
|
-
def supportLibVersion = getExtOrDefault("supportLibVersion")
|
|
154
|
-
def androidXVersion = getExtOrDefault("androidXVersion")
|
|
155
|
-
def androidXAnnotation = getExtOrDefault("androidXAnnotation")
|
|
156
|
-
def androidXBrowser = getExtOrDefault("androidXBrowser")
|
|
157
|
-
def amazonSdkVersion = getExtOrDefault("amazonSdkVersion")
|
|
158
|
-
def playBillingSdkVersion = getExtOrDefault("playBillingSdkVersion")
|
|
159
140
|
|
|
160
141
|
dependencies {
|
|
142
|
+
// For < 0.71, this will be from the local maven repo
|
|
143
|
+
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
144
|
+
//noinspection GradleDynamicVersion
|
|
161
145
|
implementation "com.facebook.react:react-native:+"
|
|
162
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
|
|
163
|
-
|
|
164
|
-
testImplementation "junit:junit:4.13.2"
|
|
165
|
-
testImplementation "io.mockk:mockk:1.13.5"
|
|
166
|
-
|
|
167
|
-
playImplementation "com.android.billingclient:billing-ktx:$playBillingSdkVersion"
|
|
168
|
-
playImplementation "com.google.android.gms:play-services-base:$playServicesVersion"
|
|
169
|
-
|
|
170
|
-
amazonImplementation "com.amazon.device:amazon-appstore-sdk:$amazonSdkVersion"
|
|
171
146
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
implementation "
|
|
175
|
-
} else {
|
|
176
|
-
def defaultAndroidXVersion = "1.2.0"
|
|
177
|
-
|
|
178
|
-
if (androidXVersion == null) {
|
|
179
|
-
androidXVersion = defaultAndroidXVersion
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
def annotationVersion = androidXAnnotation ? androidXAnnotation : androidXVersion
|
|
183
|
-
def browserVersion = androidXBrowser ? androidXBrowser : androidXVersion
|
|
184
|
-
|
|
185
|
-
implementation "androidx.annotation:annotation:$annotationVersion"
|
|
186
|
-
implementation "androidx.browser:browser:$browserVersion"
|
|
147
|
+
// Add a dependency on NitroModules (only if available)
|
|
148
|
+
if (findProject(':react-native-nitro-modules') != null) {
|
|
149
|
+
implementation project(":react-native-nitro-modules")
|
|
187
150
|
}
|
|
151
|
+
|
|
152
|
+
// Google Play Billing Library
|
|
153
|
+
implementation 'com.android.billingclient:billing-ktx:8.0.0'
|
|
154
|
+
|
|
155
|
+
// Google Play Services
|
|
156
|
+
implementation 'com.google.android.gms:play-services-base:18.5.0'
|
|
157
|
+
|
|
158
|
+
// Kotlin coroutines
|
|
159
|
+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
|
|
188
160
|
}
|
|
189
161
|
|
|
190
|
-
|
|
191
|
-
react
|
|
192
|
-
jsRootDir = file("../src/")
|
|
193
|
-
libraryName = "RNIap"
|
|
194
|
-
codegenJavaPackageName = "com.reactnativeiap"
|
|
195
|
-
}
|
|
162
|
+
configurations.all {
|
|
163
|
+
exclude group: 'com.facebook.react', module: 'react-native-safe-area-context'
|
|
196
164
|
}
|
|
165
|
+
|