diff --git a/.github/workflows/ci-example-android.yml b/.github/workflows/ci-example-android.yml index fafe1314e..259a66f90 100644 --- a/.github/workflows/ci-example-android.yml +++ b/.github/workflows/ci-example-android.yml @@ -27,8 +27,8 @@ jobs: - uses: actions/setup-java@v3 with: - distribution: 'adopt' - java-version: "14.x" + distribution: 'zulu' + java-version: "17.x" - name: Setup Node.js uses: actions/setup-node@v3 diff --git a/.github/workflows/ci-example-ios.yml b/.github/workflows/ci-example-ios.yml index 60f91f446..3fbe73394 100644 --- a/.github/workflows/ci-example-ios.yml +++ b/.github/workflows/ci-example-ios.yml @@ -52,6 +52,9 @@ jobs: bundler-cache: true ruby-version: '2.7' + - name: Install SwiftLint + run: brew install swiftlint + - name: SwiftLint run: swiftlint lint --fix --format --path ios/*.swift --config .swiftlint.yml diff --git a/IapExample/Gemfile.lock b/IapExample/Gemfile.lock index 5c50bdc2a..54285cb51 100644 --- a/IapExample/Gemfile.lock +++ b/IapExample/Gemfile.lock @@ -72,8 +72,10 @@ GEM nap (1.1.0) netrc (0.11.0) public_suffix (4.0.7) - rexml (3.2.6) + rexml (3.2.8) + strscan (>= 3.0.9) ruby-macho (2.5.1) + strscan (3.1.0) typhoeus (1.4.1) ethon (>= 0.9.0) tzinfo (2.0.6) diff --git a/README.md b/README.md index 9e10b9941..127b5da97 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,14 @@ --- +## Announcement +Announcing the Migration of react-native-iap to an Expo Module for Improved Maintenance and Compatibility in [discussion #2754](https://github.com/dooboolab-community/react-native-iap/discussions/2754). + ## Documentation Read the [documentation](https://react-native-iap.dooboolab.com). See the [troubleshooting](https://react-native-iap.dooboolab.com/docs/guides/troubleshooting#common-issues) for the common issues to avoid. -## Announcement +## Logs - Version `12.0.0`: Implements Amazon 3.x SDK including the new DRM verification. @@ -55,11 +58,9 @@ Follow [this guide](./IapExample/README.md) to get the example running. | | -###
Silver Tier
+## Past Sponsors -| [Revenuecat](https://www.revenuecat.com) | -|:--:| -| | + Support this project by becoming a sponsor. Your logo will show up here with diff --git a/android/gradle.properties b/android/gradle.properties index b8db3823f..b2d076b75 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,12 +1,12 @@ -RNIap_kotlinVersion=1.7.21 +RNIap_kotlinVersion=1.8.0 RNIap_minSdkVersion=21 -RNIap_targetSdkVersion=31 -RNIap_compileSdkVersion=31 -RNIap_buildToolsVersion=30.0.2 -RNIap_ndkversion=21.4.7075529 +RNIap_targetSdkVersion=33 +RNIap_compileSdkVersion=33 +RNIap_buildToolsVersion=33.0.0 +RNIap_ndkversion=23.1.7779620 RNIap_playServicesVersion=18.1.0 RNIap_amazonSdkVersion=3.0.4 -RNIap_playBillingSdkVersion=6.0.1 +RNIap_playBillingSdkVersion=6.1.0 android.useAndroidX=true android.enableJetifier=true diff --git a/android/src/play/java/com/dooboolab/rniap/RNIapModule.kt b/android/src/play/java/com/dooboolab/rniap/RNIapModule.kt index 2d1a3b4fa..862068a6b 100644 --- a/android/src/play/java/com/dooboolab/rniap/RNIapModule.kt +++ b/android/src/play/java/com/dooboolab/rniap/RNIapModule.kt @@ -504,19 +504,14 @@ class RNIapModule( if (obfuscatedProfileId != null) { builder.setObfuscatedProfileId(obfuscatedProfileId) } - if (prorationMode != -1) { - if (prorationMode - == BillingFlowParams.ProrationMode.IMMEDIATE_AND_CHARGE_PRORATED_PRICE - ) { - subscriptionUpdateParamsBuilder.setReplaceProrationMode( - BillingFlowParams.ProrationMode.IMMEDIATE_AND_CHARGE_PRORATED_PRICE, + when (prorationMode) { + BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.CHARGE_PRORATED_PRICE -> { + subscriptionUpdateParamsBuilder.setSubscriptionReplacementMode( + BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.CHARGE_PRORATED_PRICE, ) if (type != BillingClient.ProductType.SUBS) { val debugMessage = - ( - "IMMEDIATE_AND_CHARGE_PRORATED_PRICE for proration mode only works in" + - " subscription purchase." - ) + "IMMEDIATE_AND_CHARGE_PRORATED_PRICE for proration mode only works in subscription purchase." val error = Arguments.createMap() error.putString("debugMessage", debugMessage) error.putString("code", PROMISE_BUY_ITEM) @@ -526,31 +521,30 @@ class RNIapModule( promise.safeReject(PROMISE_BUY_ITEM, debugMessage) return@ensureConnection } - } else if (prorationMode - == BillingFlowParams.ProrationMode.IMMEDIATE_WITHOUT_PRORATION - ) { - subscriptionUpdateParamsBuilder.setReplaceProrationMode( - BillingFlowParams.ProrationMode.IMMEDIATE_WITHOUT_PRORATION, + } + BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.WITHOUT_PRORATION -> { + subscriptionUpdateParamsBuilder.setSubscriptionReplacementMode( + BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.WITHOUT_PRORATION, ) - } else if (prorationMode == BillingFlowParams.ProrationMode.DEFERRED) { - subscriptionUpdateParamsBuilder.setReplaceProrationMode( - BillingFlowParams.ProrationMode.DEFERRED, + } + BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.DEFERRED -> { + subscriptionUpdateParamsBuilder.setSubscriptionReplacementMode( + BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.DEFERRED, ) - } else if (prorationMode - == BillingFlowParams.ProrationMode.IMMEDIATE_WITH_TIME_PRORATION - ) { - subscriptionUpdateParamsBuilder.setReplaceProrationMode( - BillingFlowParams.ProrationMode.IMMEDIATE_WITHOUT_PRORATION, + } + BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.WITH_TIME_PRORATION -> { + subscriptionUpdateParamsBuilder.setSubscriptionReplacementMode( + BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.WITH_TIME_PRORATION, ) - } else if (prorationMode - == BillingFlowParams.ProrationMode.IMMEDIATE_AND_CHARGE_FULL_PRICE - ) { - subscriptionUpdateParamsBuilder.setReplaceProrationMode( - BillingFlowParams.ProrationMode.IMMEDIATE_AND_CHARGE_FULL_PRICE, + } + BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.CHARGE_FULL_PRICE -> { + subscriptionUpdateParamsBuilder.setSubscriptionReplacementMode( + BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.CHARGE_FULL_PRICE, ) - } else { - subscriptionUpdateParamsBuilder.setReplaceProrationMode( - BillingFlowParams.ProrationMode.UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY, + } + else -> { + subscriptionUpdateParamsBuilder.setSubscriptionReplacementMode( + BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.UNKNOWN_REPLACEMENT_MODE, ) } } diff --git a/docs/docs/guides/troubleshooting.mdx b/docs/docs/guides/troubleshooting.mdx index 720d2b677..7c878934d 100644 --- a/docs/docs/guides/troubleshooting.mdx +++ b/docs/docs/guides/troubleshooting.mdx @@ -10,13 +10,16 @@ import AdFitTopFixed from "@site/src/uis/AdFitTopFixed"; # Troubleshooting +## Recommendations + +- Before continuing any coding, ensure that you have successfully completed all forms related to agreements, bank accounts, or tax information (any bureaucratic processes associated with the app store you are using). + ## Common issues Most of the issues encountered by users are caused by: - A device simulator. Use a real device for testing! - An incorrect usage of the library. Read the [documentation](https://react-native-iap.dooboolab.com). -- For `Android`, a hold in your payment profile on Google Play Console. Check for any warnings. ## `getProducts` returns an empty array diff --git a/docs/docs/support-us.mdx b/docs/docs/support-us.mdx index 551f42b2a..091899c13 100644 --- a/docs/docs/support-us.mdx +++ b/docs/docs/support-us.mdx @@ -13,7 +13,7 @@ import AdFitTopFixed from "@site/src/uis/AdFitTopFixed"; maintain this repository to support devs to monetize around the world. Since `IAP` itself is not perfect on each platform, we desperately need -this project to be maintained. If you'd like to help us, please contact the [maintainer: dooboolab@gmail.com](dooboolab@gmail.com). +this project to be maintained. If you'd like to help us, please contact the [maintainer: dooboolab@gmail.com](mailto:dooboolab@gmail.com). ## Our Sponsors @@ -24,10 +24,8 @@ this project to be maintained. If you'd like to help us, please contact the [mai | | -### Silver Tier +## Past Sponsors -| [Revenuecat](https://www.revenuecat.com) | -|:--:| -| | + After 6 years of maintenance, we finally have an official sponsor. I am deeply grateful. 🙇🏻♂️ diff --git a/ios/RNIapIosSk2.swift b/ios/RNIapIosSk2.swift index 6cb644f33..8c9b73219 100644 --- a/ios/RNIapIosSk2.swift +++ b/ios/RNIapIosSk2.swift @@ -597,7 +597,7 @@ class RNIapIosSk2iOS15: Sk2Delegate { func addTransaction(transaction: Transaction) { purchasedItems.append( transaction) if alsoPublishToEventListener { - self.sendEvent?("purchase-update", serialize(transaction)) + self.sendEvent?("purchase-updated", serialize(transaction)) } } func addError( error: Error, errorDict: [String: String]) { diff --git a/package.json b/package.json index 046a2d04c..10dd5a37a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-iap", - "version": "12.13.0", + "version": "12.13.2", "description": "React Native In App Purchase Module.", "repository": "https://github.com/dooboolab-community/react-native-iap", "author": "hyochan