From ca05dcc22d80a10a198966b30b97d68c25804174 Mon Sep 17 00:00:00 2001 From: deakjahn Date: Fri, 28 Apr 2023 09:53:50 +0200 Subject: [PATCH 1/2] Fix #418. --- .../AndroidInappPurchasePlugin.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/android/src/main/kotlin/com/dooboolab/flutterinapppurchase/AndroidInappPurchasePlugin.kt b/android/src/main/kotlin/com/dooboolab/flutterinapppurchase/AndroidInappPurchasePlugin.kt index bdd71936..2dca5028 100644 --- a/android/src/main/kotlin/com/dooboolab/flutterinapppurchase/AndroidInappPurchasePlugin.kt +++ b/android/src/main/kotlin/com/dooboolab/flutterinapppurchase/AndroidInappPurchasePlugin.kt @@ -511,15 +511,14 @@ class AndroidInappPurchasePlugin internal constructor() : MethodCallHandler, if (offerTokenIndex != null) { offerToken = selectedProductDetails.subscriptionOfferDetails?.get(offerTokenIndex)?.offerToken } - if (offerToken == null) { + if (offerToken == null && selectedProductDetails.subscriptionOfferDetails != null) { offerToken = selectedProductDetails.subscriptionOfferDetails!![0].offerToken } - val productDetailsParamsList = - listOf(ProductDetailsParams.newBuilder() - .setProductDetails(selectedProductDetails) - .setOfferToken(offerToken) - .build()) + val details = ProductDetailsParams.newBuilder().setProductDetails(selectedProductDetails) + if (offerToken != null) + details.setOfferToken(offerToken) + val productDetailsParamsList = listOf(details.build()) builder.setProductDetailsParamsList(productDetailsParamsList) val params = SubscriptionUpdateParams.newBuilder() From e389110a2f1d972384cb7a822287f180379359a2 Mon Sep 17 00:00:00 2001 From: deakjahn Date: Tue, 2 May 2023 18:10:47 +0200 Subject: [PATCH 2/2] Extra introductoryPricePaymentModeIOS in toString() --- lib/modules.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/modules.dart b/lib/modules.dart index a577a082..5096c968 100644 --- a/lib/modules.dart +++ b/lib/modules.dart @@ -117,7 +117,6 @@ class IAPItem { 'title: $title, ' 'description: $description, ' 'introductoryPrice: $introductoryPrice, ' - 'introductoryPricePaymentModeIOS: $introductoryPrice, ' 'subscriptionPeriodNumberIOS: $subscriptionPeriodNumberIOS, ' 'subscriptionPeriodUnitIOS: $subscriptionPeriodUnitIOS, ' 'introductoryPricePaymentModeIOS: $introductoryPricePaymentModeIOS, '