diff --git a/.github/workflows/ci-example-android.yml b/.github/workflows/ci-example-android.yml index 1507bd7ee..fafe1314e 100644 --- a/.github/workflows/ci-example-android.yml +++ b/.github/workflows/ci-example-android.yml @@ -25,6 +25,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: "14.x" + - name: Setup Node.js uses: actions/setup-node@v3 with: @@ -40,12 +45,6 @@ jobs: - name: Setup kernel for react native, increase watchers run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p - - name: Set up JDK 11.0.3 - uses: actions/setup-java@v3 - with: - distribution: 'zulu' - java-version: 11.0.3 - - name: Grant execute permission for gradlew in example app run: chmod +x ./gradlew working-directory: IapExample/android diff --git a/android/gradle.properties b/android/gradle.properties index 93d6b229b..b8db3823f 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -5,7 +5,7 @@ RNIap_compileSdkVersion=31 RNIap_buildToolsVersion=30.0.2 RNIap_ndkversion=21.4.7075529 RNIap_playServicesVersion=18.1.0 -RNIap_amazonSdkVersion=3.0.3 +RNIap_amazonSdkVersion=3.0.4 RNIap_playBillingSdkVersion=6.0.1 android.useAndroidX=true diff --git a/android/src/amazon/java/com/dooboolab/rniap/RNIapAmazonListener.kt b/android/src/amazon/java/com/dooboolab/rniap/RNIapAmazonListener.kt index e1bb889fb..a782b5dfe 100644 --- a/android/src/amazon/java/com/dooboolab/rniap/RNIapAmazonListener.kt +++ b/android/src/amazon/java/com/dooboolab/rniap/RNIapAmazonListener.kt @@ -255,6 +255,23 @@ class RNIapAmazonListener( null, ) } + PurchaseResponse.RequestStatus.PENDING -> { + val error = Arguments.createMap() + val debugMessage = "Purchase is pending. Please wait for the transaction to complete." + val errorCode = PromiseUtils.E_PENDING + error.putInt("responseCode", 0) + error.putString("code", errorCode) + error.putString("debugMessage", debugMessage) + error.putString("message", debugMessage) + eventSender?.sendEvent("purchase-error", error) + PromiseUtils + .rejectPromisesForKey( + RNIapAmazonModule.PROMISE_BUY_ITEM, + errorCode, + debugMessage, + null, + ) + } PurchaseResponse.RequestStatus.NOT_SUPPORTED -> { val error = Arguments.createMap() val debugMessage = "This feature is not available on your device." diff --git a/android/src/main/java/com/dooboolab/rniap/PromiseUtils.kt b/android/src/main/java/com/dooboolab/rniap/PromiseUtils.kt index d60390541..853dac253 100644 --- a/android/src/main/java/com/dooboolab/rniap/PromiseUtils.kt +++ b/android/src/main/java/com/dooboolab/rniap/PromiseUtils.kt @@ -40,6 +40,7 @@ object PromiseUtils { const val E_UNKNOWN = "E_UNKNOWN" const val E_NOT_PREPARED = "E_NOT_PREPARED" const val E_ALREADY_PREPARED = "E_ALREADY_PREPARED" + const val E_PENDING = "E_PENDING" const val E_NOT_ENDED = "E_NOT_ENDED" const val E_USER_CANCELLED = "E_USER_CANCELLED" const val E_ITEM_UNAVAILABLE = "E_ITEM_UNAVAILABLE"