From aec08c8e9c3ef5dbcad4873e57e2fb852b8ecee3 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Thu, 15 Jan 2026 20:04:45 -0800 Subject: [PATCH 1/5] [in_app_purchase_android] Update Play Billing library to 8.0.0 --- .../in_app_purchase_android/CHANGELOG.md | 9 + .../in_app_purchase_android/README.md | 5 +- .../android/build.gradle | 2 +- .../plugins/inapppurchase/Messages.java | 215 ++++++++++++++---- .../inapppurchase/MethodCallHandlerImpl.java | 40 +--- .../plugins/inapppurchase/Translator.java | 39 ++++ .../inapppurchase/MethodCallHandlerTest.java | 66 ++---- .../plugins/inapppurchase/TranslatorTest.java | 18 ++ .../in_app_purchase_test.dart | 12 - .../billing_client_wrapper.dart | 23 -- .../billing_response_wrapper.dart | 19 +- .../product_details_wrapper.dart | 47 +++- .../lib/src/messages.g.dart | 98 ++++---- .../lib/src/pigeon_converters.dart | 15 ++ .../migration_guide.md | 24 ++ .../pigeons/messages.dart | 20 +- .../in_app_purchase_android/pubspec.yaml | 2 +- .../billing_client_wrapper_test.dart | 67 +++--- .../product_details_wrapper_test.dart | 16 ++ ...in_app_purchase_android_platform_test.dart | 9 + .../test/test_conversion_utils.dart | 1 + 21 files changed, 503 insertions(+), 244 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md index 5769150bf7fb..2c7f2d085ce7 100644 --- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md @@ -1,3 +1,12 @@ +## 0.5.0 + +* Updates Google Play Billing Library from 7.1.1 to 8.0.0. +* **BREAKING CHANGES**: + * Removes `queryPurchaseHistory` and its wrapper `queryPurchaseHistoryAsync`. Use `queryPurchases` instead. +* Adds support for `subResponseCode` in `BillingResultWrapper`. +* Adds support for `oneTimePurchaseOfferDetailsList` in `ProductDetailsWrapper`. +* Adds support for `unfetchedProductList` in `ProductDetailsResponseWrapper` to handle product IDs that could not be fetched. + ## 0.4.0+8 * Bumps com.android.tools.build:gradle from 8.12.1 to 8.13.1. diff --git a/packages/in_app_purchase/in_app_purchase_android/README.md b/packages/in_app_purchase/in_app_purchase_android/README.md index be9f0f507259..45286f90b573 100644 --- a/packages/in_app_purchase/in_app_purchase_android/README.md +++ b/packages/in_app_purchase/in_app_purchase_android/README.md @@ -19,8 +19,9 @@ Using the Alternative billing only feature requires Google Play app configuratio [Google Play documentation for Alternative billing](https://developer.android.com/google/play/billing/alternative) -## Migrating to 0.3.0 -To migrate to version 0.3.0 from 0.2.x, have a look at the [migration guide](migration_guide.md). +## Migrating to 0.5.0 +To migrate to version 0.5.0 from 0.4.x or 0.3.0 from 0.2.x, have a look at the +[migration guide](migration_guide.md). [1]: https://pub.dev/packages/in_app_purchase [2]: https://flutter.dev/to/endorsed-federated-plugin diff --git a/packages/in_app_purchase/in_app_purchase_android/android/build.gradle b/packages/in_app_purchase/in_app_purchase_android/android/build.gradle index d74db0e7eba0..198af0f23499 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/build.gradle +++ b/packages/in_app_purchase/in_app_purchase_android/android/build.gradle @@ -60,7 +60,7 @@ android { dependencies { implementation("androidx.annotation:annotation:1.9.1") - implementation("com.android.billingclient:billing:7.1.1") + implementation("com.android.billingclient:billing:8.0.0") testImplementation("junit:junit:4.13.2") testImplementation("org.json:json:20250517") testImplementation("org.mockito:mockito-core:5.21.0") diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Messages.java b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Messages.java index fa1135fed036..cbd5a669faf8 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Messages.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Messages.java @@ -402,6 +402,19 @@ public void setDebugMessage(@NonNull String setterArg) { this.debugMessage = setterArg; } + private @NonNull Long subResponseCode; + + public @NonNull Long getSubResponseCode() { + return subResponseCode; + } + + public void setSubResponseCode(@NonNull Long setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"subResponseCode\" is null."); + } + this.subResponseCode = setterArg; + } + /** Constructor is non-public to enforce null safety; use Builder. */ PlatformBillingResult() {} @@ -414,12 +427,14 @@ public boolean equals(Object o) { return false; } PlatformBillingResult that = (PlatformBillingResult) o; - return responseCode.equals(that.responseCode) && debugMessage.equals(that.debugMessage); + return responseCode.equals(that.responseCode) + && debugMessage.equals(that.debugMessage) + && subResponseCode.equals(that.subResponseCode); } @Override public int hashCode() { - return Objects.hash(responseCode, debugMessage); + return Objects.hash(responseCode, debugMessage, subResponseCode); } public static final class Builder { @@ -440,19 +455,29 @@ public static final class Builder { return this; } + private @Nullable Long subResponseCode; + + @CanIgnoreReturnValue + public @NonNull Builder setSubResponseCode(@NonNull Long setterArg) { + this.subResponseCode = setterArg; + return this; + } + public @NonNull PlatformBillingResult build() { PlatformBillingResult pigeonReturn = new PlatformBillingResult(); pigeonReturn.setResponseCode(responseCode); pigeonReturn.setDebugMessage(debugMessage); + pigeonReturn.setSubResponseCode(subResponseCode); return pigeonReturn; } } @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); + ArrayList toListResult = new ArrayList<>(3); toListResult.add(responseCode); toListResult.add(debugMessage); + toListResult.add(subResponseCode); return toListResult; } @@ -462,6 +487,8 @@ ArrayList toList() { pigeonResult.setResponseCode((PlatformBillingResponse) responseCode); Object debugMessage = pigeonVar_list.get(1); pigeonResult.setDebugMessage((String) debugMessage); + Object subResponseCode = pigeonVar_list.get(2); + pigeonResult.setSubResponseCode((Long) subResponseCode); return pigeonResult; } } @@ -673,6 +700,18 @@ public void setOneTimePurchaseOfferDetails( this.oneTimePurchaseOfferDetails = setterArg; } + private @Nullable List oneTimePurchaseOfferDetailsList; + + public @Nullable List + getOneTimePurchaseOfferDetailsList() { + return oneTimePurchaseOfferDetailsList; + } + + public void setOneTimePurchaseOfferDetailsList( + @Nullable List setterArg) { + this.oneTimePurchaseOfferDetailsList = setterArg; + } + private @Nullable List subscriptionOfferDetails; public @Nullable List getSubscriptionOfferDetails() { @@ -702,6 +741,7 @@ public boolean equals(Object o) { && productType.equals(that.productType) && title.equals(that.title) && Objects.equals(oneTimePurchaseOfferDetails, that.oneTimePurchaseOfferDetails) + && Objects.equals(oneTimePurchaseOfferDetailsList, that.oneTimePurchaseOfferDetailsList) && Objects.equals(subscriptionOfferDetails, that.subscriptionOfferDetails); } @@ -714,6 +754,7 @@ public int hashCode() { productType, title, oneTimePurchaseOfferDetails, + oneTimePurchaseOfferDetailsList, subscriptionOfferDetails); } @@ -768,6 +809,15 @@ public static final class Builder { return this; } + private @Nullable List oneTimePurchaseOfferDetailsList; + + @CanIgnoreReturnValue + public @NonNull Builder setOneTimePurchaseOfferDetailsList( + @Nullable List setterArg) { + this.oneTimePurchaseOfferDetailsList = setterArg; + return this; + } + private @Nullable List subscriptionOfferDetails; @CanIgnoreReturnValue @@ -785,6 +835,7 @@ public static final class Builder { pigeonReturn.setProductType(productType); pigeonReturn.setTitle(title); pigeonReturn.setOneTimePurchaseOfferDetails(oneTimePurchaseOfferDetails); + pigeonReturn.setOneTimePurchaseOfferDetailsList(oneTimePurchaseOfferDetailsList); pigeonReturn.setSubscriptionOfferDetails(subscriptionOfferDetails); return pigeonReturn; } @@ -792,13 +843,14 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList<>(7); + ArrayList toListResult = new ArrayList<>(8); toListResult.add(description); toListResult.add(name); toListResult.add(productId); toListResult.add(productType); toListResult.add(title); toListResult.add(oneTimePurchaseOfferDetails); + toListResult.add(oneTimePurchaseOfferDetailsList); toListResult.add(subscriptionOfferDetails); return toListResult; } @@ -818,7 +870,10 @@ ArrayList toList() { Object oneTimePurchaseOfferDetails = pigeonVar_list.get(5); pigeonResult.setOneTimePurchaseOfferDetails( (PlatformOneTimePurchaseOfferDetails) oneTimePurchaseOfferDetails); - Object subscriptionOfferDetails = pigeonVar_list.get(6); + Object oneTimePurchaseOfferDetailsList = pigeonVar_list.get(6); + pigeonResult.setOneTimePurchaseOfferDetailsList( + (List) oneTimePurchaseOfferDetailsList); + Object subscriptionOfferDetails = pigeonVar_list.get(7); pigeonResult.setSubscriptionOfferDetails( (List) subscriptionOfferDetails); return pigeonResult; @@ -858,6 +913,19 @@ public void setProductDetails(@NonNull List setterArg) { this.productDetails = setterArg; } + private @NonNull List unfetchedProductList; + + public @NonNull List getUnfetchedProductList() { + return unfetchedProductList; + } + + public void setUnfetchedProductList(@NonNull List setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"unfetchedProductList\" is null."); + } + this.unfetchedProductList = setterArg; + } + /** Constructor is non-public to enforce null safety; use Builder. */ PlatformProductDetailsResponse() {} @@ -870,12 +938,14 @@ public boolean equals(Object o) { return false; } PlatformProductDetailsResponse that = (PlatformProductDetailsResponse) o; - return billingResult.equals(that.billingResult) && productDetails.equals(that.productDetails); + return billingResult.equals(that.billingResult) + && productDetails.equals(that.productDetails) + && unfetchedProductList.equals(that.unfetchedProductList); } @Override public int hashCode() { - return Objects.hash(billingResult, productDetails); + return Objects.hash(billingResult, productDetails, unfetchedProductList); } public static final class Builder { @@ -896,19 +966,30 @@ public static final class Builder { return this; } + private @Nullable List unfetchedProductList; + + @CanIgnoreReturnValue + public @NonNull Builder setUnfetchedProductList( + @NonNull List setterArg) { + this.unfetchedProductList = setterArg; + return this; + } + public @NonNull PlatformProductDetailsResponse build() { PlatformProductDetailsResponse pigeonReturn = new PlatformProductDetailsResponse(); pigeonReturn.setBillingResult(billingResult); pigeonReturn.setProductDetails(productDetails); + pigeonReturn.setUnfetchedProductList(unfetchedProductList); return pigeonReturn; } } @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList<>(2); + ArrayList toListResult = new ArrayList<>(3); toListResult.add(billingResult); toListResult.add(productDetails); + toListResult.add(unfetchedProductList); return toListResult; } @@ -919,6 +1000,8 @@ ArrayList toList() { pigeonResult.setBillingResult((PlatformBillingResult) billingResult); Object productDetails = pigeonVar_list.get(1); pigeonResult.setProductDetails((List) productDetails); + Object unfetchedProductList = pigeonVar_list.get(2); + pigeonResult.setUnfetchedProductList((List) unfetchedProductList); return pigeonResult; } } @@ -3106,6 +3189,78 @@ ArrayList toList() { } } + /** + * Pigeon version of Java + * [UnfetchedProduct](https://developer.android.com/reference/com/android/billingclient/api/QueryProductDetailsParams.Product). + * + *

Generated class from Pigeon that represents data sent in messages. + */ + public static final class PlatformUnfetchedProduct { + private @NonNull String productId; + + public @NonNull String getProductId() { + return productId; + } + + public void setProductId(@NonNull String setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"productId\" is null."); + } + this.productId = setterArg; + } + + /** Constructor is non-public to enforce null safety; use Builder. */ + PlatformUnfetchedProduct() {} + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PlatformUnfetchedProduct that = (PlatformUnfetchedProduct) o; + return productId.equals(that.productId); + } + + @Override + public int hashCode() { + return Objects.hash(productId); + } + + public static final class Builder { + + private @Nullable String productId; + + @CanIgnoreReturnValue + public @NonNull Builder setProductId(@NonNull String setterArg) { + this.productId = setterArg; + return this; + } + + public @NonNull PlatformUnfetchedProduct build() { + PlatformUnfetchedProduct pigeonReturn = new PlatformUnfetchedProduct(); + pigeonReturn.setProductId(productId); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList<>(1); + toListResult.add(productId); + return toListResult; + } + + static @NonNull PlatformUnfetchedProduct fromList(@NonNull ArrayList pigeonVar_list) { + PlatformUnfetchedProduct pigeonResult = new PlatformUnfetchedProduct(); + Object productId = pigeonVar_list.get(0); + pigeonResult.setProductId((String) productId); + return pigeonResult; + } + } + private static class PigeonCodec extends StandardMessageCodec { public static final PigeonCodec INSTANCE = new PigeonCodec(); @@ -3201,6 +3356,8 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { return PlatformInstallmentPlanDetails.fromList((ArrayList) readValue(buffer)); case (byte) 155: return PlatformPendingPurchasesParams.fromList((ArrayList) readValue(buffer)); + case (byte) 156: + return PlatformUnfetchedProduct.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); } @@ -3290,6 +3447,9 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { } else if (value instanceof PlatformPendingPurchasesParams) { stream.write(155); writeValue(stream, ((PlatformPendingPurchasesParams) value).toList()); + } else if (value instanceof PlatformUnfetchedProduct) { + stream.write(156); + writeValue(stream, ((PlatformUnfetchedProduct) value).toList()); } else { super.writeValue(stream, value); } @@ -3353,13 +3513,6 @@ void acknowledgePurchase( void queryPurchasesAsync( @NonNull PlatformProductType productType, @NonNull Result result); - /** - * Wraps BillingClient#queryPurchaseHistoryAsync(QueryPurchaseHistoryParams, - * PurchaseHistoryResponseListener). - */ - void queryPurchaseHistoryAsync( - @NonNull PlatformProductType productType, - @NonNull Result result); /** * Wraps BillingClient#queryProductDetailsAsync(QueryProductDetailsParams, * ProductDetailsResponseListener). @@ -3630,38 +3783,6 @@ public void error(Throwable error) { channel.setMessageHandler(null); } } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync" - + messageChannelSuffix, - getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList<>(); - ArrayList args = (ArrayList) message; - PlatformProductType productTypeArg = (PlatformProductType) args.get(0); - Result resultCallback = - new Result() { - public void success(PlatformPurchaseHistoryResponse result) { - wrapped.add(0, result); - reply.reply(wrapped); - } - - public void error(Throwable error) { - ArrayList wrappedError = wrapError(error); - reply.reply(wrappedError); - } - }; - - api.queryPurchaseHistoryAsync(productTypeArg, resultCallback); - }); - } else { - channel.setMessageHandler(null); - } - } { BasicMessageChannel channel = new BasicMessageChannel<>( diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java index d496fb57b323..42f2f7d604e1 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java @@ -8,8 +8,8 @@ import static io.flutter.plugins.inapppurchase.Translator.fromBillingConfig; import static io.flutter.plugins.inapppurchase.Translator.fromBillingResult; import static io.flutter.plugins.inapppurchase.Translator.fromProductDetailsList; -import static io.flutter.plugins.inapppurchase.Translator.fromPurchaseHistoryRecordList; import static io.flutter.plugins.inapppurchase.Translator.fromPurchasesList; +import static io.flutter.plugins.inapppurchase.Translator.fromUnfetchedProductList; import static io.flutter.plugins.inapppurchase.Translator.toBillingClientFeature; import static io.flutter.plugins.inapppurchase.Translator.toProductList; import static io.flutter.plugins.inapppurchase.Translator.toProductTypeString; @@ -33,7 +33,6 @@ import com.android.billingclient.api.GetBillingConfigParams; import com.android.billingclient.api.ProductDetails; import com.android.billingclient.api.QueryProductDetailsParams; -import com.android.billingclient.api.QueryPurchaseHistoryParams; import com.android.billingclient.api.QueryPurchasesParams; import io.flutter.plugins.inapppurchase.Messages.FlutterError; import io.flutter.plugins.inapppurchase.Messages.InAppPurchaseApi; @@ -44,7 +43,6 @@ import io.flutter.plugins.inapppurchase.Messages.PlatformBillingResult; import io.flutter.plugins.inapppurchase.Messages.PlatformProductDetailsResponse; import io.flutter.plugins.inapppurchase.Messages.PlatformProductType; -import io.flutter.plugins.inapppurchase.Messages.PlatformPurchaseHistoryResponse; import io.flutter.plugins.inapppurchase.Messages.PlatformPurchasesResponse; import io.flutter.plugins.inapppurchase.Messages.PlatformQueryProduct; import io.flutter.plugins.inapppurchase.Messages.PlatformReplacementMode; @@ -228,12 +226,15 @@ public void queryProductDetailsAsync( QueryProductDetailsParams.newBuilder().setProductList(toProductList(products)).build(); billingClient.queryProductDetailsAsync( params, - (billingResult, productDetailsList) -> { - updateCachedProducts(productDetailsList); + (billingResult, productDetailsResult) -> { + updateCachedProducts(productDetailsResult.getProductDetailsList()); final PlatformProductDetailsResponse.Builder responseBuilder = new PlatformProductDetailsResponse.Builder() .setBillingResult(fromBillingResult(billingResult)) - .setProductDetails(fromProductDetailsList(productDetailsList)); + .setProductDetails( + fromProductDetailsList(productDetailsResult.getProductDetailsList())) + .setUnfetchedProductList( + fromUnfetchedProductList(productDetailsResult.getUnfetchedProductList())); result.success(responseBuilder.build()); }); } catch (RuntimeException e) { @@ -396,33 +397,6 @@ public void queryPurchasesAsync( } } - @Override - @Deprecated - public void queryPurchaseHistoryAsync( - @NonNull PlatformProductType productType, - @NonNull Result result) { - if (billingClient == null) { - result.error(getNullBillingClientError()); - return; - } - - try { - billingClient.queryPurchaseHistoryAsync( - QueryPurchaseHistoryParams.newBuilder() - .setProductType(toProductTypeString(productType)) - .build(), - (billingResult, purchasesList) -> { - PlatformPurchaseHistoryResponse.Builder builder = - new PlatformPurchaseHistoryResponse.Builder() - .setBillingResult(fromBillingResult(billingResult)) - .setPurchases(fromPurchaseHistoryRecordList(purchasesList)); - result.success(builder.build()); - }); - } catch (RuntimeException e) { - result.error(new FlutterError("error", e.getMessage(), Log.getStackTraceString(e))); - } - } - @Override public void startConnection( @NonNull Long handle, diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Translator.java b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Translator.java index a982964764dc..2d1a9f571316 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Translator.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Translator.java @@ -17,6 +17,7 @@ import com.android.billingclient.api.Purchase; import com.android.billingclient.api.PurchaseHistoryRecord; import com.android.billingclient.api.QueryProductDetailsParams; +import com.android.billingclient.api.UnfetchedProduct; import com.android.billingclient.api.UserChoiceDetails; import io.flutter.plugins.inapppurchase.Messages.FlutterError; import io.flutter.plugins.inapppurchase.Messages.PlatformAccountIdentifiers; @@ -37,6 +38,7 @@ import io.flutter.plugins.inapppurchase.Messages.PlatformRecurrenceMode; import io.flutter.plugins.inapppurchase.Messages.PlatformReplacementMode; import io.flutter.plugins.inapppurchase.Messages.PlatformSubscriptionOfferDetails; +import io.flutter.plugins.inapppurchase.Messages.PlatformUnfetchedProduct; import io.flutter.plugins.inapppurchase.Messages.PlatformUserChoiceDetails; import io.flutter.plugins.inapppurchase.Messages.PlatformUserChoiceProduct; import java.util.ArrayList; @@ -59,6 +61,8 @@ .setName(detail.getName()) .setOneTimePurchaseOfferDetails( fromOneTimePurchaseOfferDetails(detail.getOneTimePurchaseOfferDetails())) + .setOneTimePurchaseOfferDetailsList( + fromOneTimePurchaseOfferDetailsList(detail.getOneTimePurchaseOfferDetailsList())) .setSubscriptionOfferDetails( fromSubscriptionOfferDetailsList(detail.getSubscriptionOfferDetails())) .build(); @@ -116,6 +120,21 @@ static PlatformProductType toPlatformProductType(@NonNull String typeString) { return output; } + static @Nullable List fromOneTimePurchaseOfferDetailsList( + @Nullable List oneTimePurchaseOfferDetailsList) { + if (oneTimePurchaseOfferDetailsList == null) { + return null; + } + + ArrayList serialized = new ArrayList<>(); + for (ProductDetails.OneTimePurchaseOfferDetails oneTimePurchaseOfferDetails : + oneTimePurchaseOfferDetailsList) { + serialized.add(fromOneTimePurchaseOfferDetails(oneTimePurchaseOfferDetails)); + } + + return serialized; + } + static @Nullable PlatformOneTimePurchaseOfferDetails fromOneTimePurchaseOfferDetails( @Nullable ProductDetails.OneTimePurchaseOfferDetails oneTimePurchaseOfferDetails) { if (oneTimePurchaseOfferDetails == null) { @@ -302,6 +321,26 @@ static PlatformPurchaseState toPlatformPurchaseState(int state) { return new PlatformBillingResult.Builder() .setResponseCode(fromBillingResponseCode(billingResult.getResponseCode())) .setDebugMessage(billingResult.getDebugMessage()) + .setSubResponseCode((long) billingResult.getOnPurchasesUpdatedSubResponseCode()) + .build(); + } + + static @NonNull List fromUnfetchedProductList( + @Nullable List unfetchedProductList) { + if (unfetchedProductList == null) { + return Collections.emptyList(); + } + List serialized = new ArrayList<>(); + for (UnfetchedProduct unfetchedProduct : unfetchedProductList) { + serialized.add(fromUnfetchedProduct(unfetchedProduct)); + } + return serialized; + } + + static @NonNull PlatformUnfetchedProduct fromUnfetchedProduct( + @NonNull UnfetchedProduct unfetchedProduct) { + return new PlatformUnfetchedProduct.Builder() + .setProductId(unfetchedProduct.getProductId()) .build(); } diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/MethodCallHandlerTest.java b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/MethodCallHandlerTest.java index d4cfeda77d0d..c4e84209526d 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/MethodCallHandlerTest.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/MethodCallHandlerTest.java @@ -49,10 +49,9 @@ import com.android.billingclient.api.ProductDetailsResponseListener; import com.android.billingclient.api.Purchase; import com.android.billingclient.api.PurchaseHistoryRecord; -import com.android.billingclient.api.PurchaseHistoryResponseListener; import com.android.billingclient.api.PurchasesResponseListener; import com.android.billingclient.api.QueryProductDetailsParams; -import com.android.billingclient.api.QueryPurchaseHistoryParams; +import com.android.billingclient.api.QueryProductDetailsResult; import com.android.billingclient.api.QueryPurchasesParams; import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; import io.flutter.plugins.inapppurchase.Messages.FlutterError; @@ -65,7 +64,6 @@ import io.flutter.plugins.inapppurchase.Messages.PlatformBillingResult; import io.flutter.plugins.inapppurchase.Messages.PlatformProductDetailsResponse; import io.flutter.plugins.inapppurchase.Messages.PlatformProductType; -import io.flutter.plugins.inapppurchase.Messages.PlatformPurchaseHistoryResponse; import io.flutter.plugins.inapppurchase.Messages.PlatformPurchasesResponse; import io.flutter.plugins.inapppurchase.Messages.PlatformQueryProduct; import io.flutter.plugins.inapppurchase.Messages.PlatformReplacementMode; @@ -99,7 +97,7 @@ public class MethodCallHandlerTest { @Spy Messages.Result platformBillingConfigResult; @Spy Messages.Result platformBillingResult; @Spy Messages.Result platformProductDetailsResult; - @Spy Messages.Result platformPurchaseHistoryResult; + @Spy Messages.Result platformPurchasesResult; @Mock Activity activity; @@ -577,13 +575,20 @@ public void queryProductDetailsAsync() { // Assert that we handed result BillingClient's response List productDetailsResponse = singletonList(buildProductDetails("foo")); BillingResult billingResult = buildBillingResult(); - listenerCaptor.getValue().onProductDetailsResponse(billingResult, productDetailsResponse); + + QueryProductDetailsResult mockProductDetailsResult = mock(QueryProductDetailsResult.class); + when(mockProductDetailsResult.getProductDetailsList()).thenReturn(productDetailsResponse); + when(mockProductDetailsResult.getUnfetchedProductList()) + .thenReturn(java.util.Collections.emptyList()); + + listenerCaptor.getValue().onProductDetailsResponse(billingResult, mockProductDetailsResult); ArgumentCaptor resultCaptor = ArgumentCaptor.forClass(PlatformProductDetailsResponse.class); verify(platformProductDetailsResult).success(resultCaptor.capture()); PlatformProductDetailsResponse resultData = resultCaptor.getValue(); assertResultsMatch(resultData.getBillingResult(), billingResult); assertDetailListsMatch(productDetailsResponse, resultData.getProductDetails()); + assertTrue(resultData.getUnfetchedProductList().isEmpty()); } @Test @@ -976,51 +981,6 @@ public void queryPurchases_returns_success() { assertTrue(purchasesResponse.getPurchases().isEmpty()); } - @Test - @SuppressWarnings(value = "deprecation") - public void queryPurchaseHistoryAsync() { - // Set up an established billing client and all our mocked responses - establishConnectedBillingClient(); - BillingResult billingResult = buildBillingResult(); - final String purchaseToken = "foo"; - List purchasesList = - singletonList(buildPurchaseHistoryRecord(purchaseToken)); - ArgumentCaptor listenerCaptor = - ArgumentCaptor.forClass(PurchaseHistoryResponseListener.class); - - methodChannelHandler.queryPurchaseHistoryAsync( - PlatformProductType.INAPP, platformPurchaseHistoryResult); - - // Verify we pass the data to result - verify(mockBillingClient) - .queryPurchaseHistoryAsync(any(QueryPurchaseHistoryParams.class), listenerCaptor.capture()); - listenerCaptor.getValue().onPurchaseHistoryResponse(billingResult, purchasesList); - ArgumentCaptor resultCaptor = - ArgumentCaptor.forClass(PlatformPurchaseHistoryResponse.class); - verify(platformPurchaseHistoryResult).success(resultCaptor.capture()); - PlatformPurchaseHistoryResponse result = resultCaptor.getValue(); - assertResultsMatch(result.getBillingResult(), billingResult); - assertEquals(1, result.getPurchases().size()); - assertEquals(purchaseToken, result.getPurchases().get(0).getPurchaseToken()); - } - - @Test - @SuppressWarnings(value = "deprecation") - public void queryPurchaseHistoryAsync_clientDisconnected() { - methodChannelHandler.endConnection(); - - methodChannelHandler.queryPurchaseHistoryAsync( - PlatformProductType.INAPP, platformPurchaseHistoryResult); - - // Assert that the async call returns an error result. - verify(platformPurchaseHistoryResult, never()).success(any()); - ArgumentCaptor errorCaptor = ArgumentCaptor.forClass(FlutterError.class); - verify(platformPurchaseHistoryResult, times(1)).error(errorCaptor.capture()); - assertEquals("UNAVAILABLE", errorCaptor.getValue().code); - assertTrue( - Objects.requireNonNull(errorCaptor.getValue().getMessage()).contains("BillingClient")); - } - @Test public void onPurchasesUpdatedListener() { PluginPurchaseListener listener = new PluginPurchaseListener(mockCallbackApi); @@ -1177,7 +1137,11 @@ private void queryForProducts(List productIdList) { productIdList.stream().map(this::buildProductDetails).collect(toList()); BillingResult billingResult = buildBillingResult(); - listenerCaptor.getValue().onProductDetailsResponse(billingResult, productDetailsResponse); + QueryProductDetailsResult mockProductDetailsResult = mock(QueryProductDetailsResult.class); + when(mockProductDetailsResult.getProductDetailsList()).thenReturn(productDetailsResponse); + when(mockProductDetailsResult.getUnfetchedProductList()) + .thenReturn(java.util.Collections.emptyList()); + listenerCaptor.getValue().onProductDetailsResponse(billingResult, mockProductDetailsResult); } private List buildProductList( diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/TranslatorTest.java b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/TranslatorTest.java index b8c7fb4e8ccb..5b327a35dbcc 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/TranslatorTest.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/TranslatorTest.java @@ -177,6 +177,9 @@ public void fromBillingResult_debugMessageNull() { assertEquals(Messages.PlatformBillingResponse.OK, platformResult.getResponseCode()); assertEquals(platformResult.getDebugMessage(), newBillingResult.getDebugMessage()); + assertEquals( + (long) newBillingResult.getOnPurchasesUpdatedSubResponseCode(), + (long) platformResult.getSubResponseCode()); } @Test @@ -206,6 +209,21 @@ private void assertSerialized( assertSerialized(expectedOneTimePurchaseOfferDetails, oneTimePurchaseOfferDetails); } + List expectedOfferList = + expected.getOneTimePurchaseOfferDetailsList(); + List serializedOfferList = + serialized.getOneTimePurchaseOfferDetailsList(); + + if (expectedOfferList == null) { + assertNull(serializedOfferList); + } else { + assertNotNull(serializedOfferList); + assertEquals(expectedOfferList.size(), serializedOfferList.size()); + for (int i = 0; i < expectedOfferList.size(); i++) { + assertSerialized(expectedOfferList.get(i), serializedOfferList.get(i)); + } + } + List expectedSubscriptionOfferDetailsList = expected.getSubscriptionOfferDetails(); List subscriptionOfferDetailsList = diff --git a/packages/in_app_purchase/in_app_purchase_android/example/integration_test/in_app_purchase_test.dart b/packages/in_app_purchase/in_app_purchase_android/example/integration_test/in_app_purchase_test.dart index b06a166dce11..e6be023edddb 100644 --- a/packages/in_app_purchase/in_app_purchase_android/example/integration_test/in_app_purchase_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/example/integration_test/in_app_purchase_test.dart @@ -111,18 +111,6 @@ void main() { } }); - testWidgets('BillingClient.queryPurchaseHistory', ( - WidgetTester tester, - ) async { - try { - // Intentional use of a deprecated method to make sure it still works. - // ignore: deprecated_member_use - await billingClient.queryPurchaseHistory(ProductType.inapp); - } on MissingPluginException { - fail('Method channel is not setup correctly'); - } - }); - testWidgets('BillingClient.queryPurchases', (WidgetTester tester) async { try { await billingClient.queryPurchases(ProductType.inapp); diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_wrapper.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_wrapper.dart index b3df0cf619b9..c49e67e9496a 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_wrapper.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_wrapper.dart @@ -249,29 +249,6 @@ class BillingClient { ); } - /// Fetches purchase history for the given [ProductType]. - /// - /// Unlike [queryPurchases], this makes a network request via Play and returns - /// the most recent purchase for each [ProductDetailsWrapper] of the given - /// [ProductType] even if the item is no longer owned. - /// - /// All purchase information should also be verified manually, with your - /// server if at all possible. See ["Verify a - /// purchase"](https://developer.android.com/google/play/billing/billing_library_overview#Verify). - /// - /// This wraps - /// [`BillingClient#queryPurchaseHistoryAsync(QueryPurchaseHistoryParams, PurchaseHistoryResponseListener)`](https://developer.android.com/reference/com/android/billingclient/api/BillingClient#queryPurchaseHistoryAsync(com.android.billingclient.api.QueryPurchaseHistoryParams,%20com.android.billingclient.api.PurchaseHistoryResponseListener)). - @Deprecated('Use queryPurchases') - Future queryPurchaseHistory( - ProductType productType, - ) async { - return purchaseHistoryResultFromPlatform( - await _hostApi.queryPurchaseHistoryAsync( - platformProductTypeFromWrapper(productType), - ), - ); - } - /// Consumes a given in-app product. /// /// Consuming can only be done on an item that's owned, and as a result of consumption, the user will no longer own it. diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_response_wrapper.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_response_wrapper.dart index 8f971b2cb405..22b83f37fe80 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_response_wrapper.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_response_wrapper.dart @@ -17,12 +17,26 @@ const String kInvalidBillingResultErrorMessage = @immutable class BillingResultWrapper implements HasBillingResponse { /// Constructs the object with [responseCode] and [debugMessage]. - const BillingResultWrapper({required this.responseCode, this.debugMessage}); + const BillingResultWrapper({ + required this.responseCode, + this.subResponseCode = 0, + this.debugMessage, + }); /// Response code returned in the Play Billing API calls. @override final BillingResponse responseCode; + /// Sub-response code returned in the Play Billing API calls. + /// + /// Defaults to 0 which is returned when no other sub-response code is applicable. + /// + /// Possible values: + /// * `0`: `NO_APPLICABLE_SUB_RESPONSE_CODE` + /// * `1`: `PAYMENT_DECLINED_DUE_TO_INSUFFICIENT_FUNDS` + /// * `2`: `USER_INELIGIBLE` + final int subResponseCode; + /// Debug message returned in the Play Billing API calls. /// /// Defaults to `null`. @@ -39,9 +53,10 @@ class BillingResultWrapper implements HasBillingResponse { return other is BillingResultWrapper && other.responseCode == responseCode && + other.subResponseCode == subResponseCode && other.debugMessage == debugMessage; } @override - int get hashCode => Object.hash(responseCode, debugMessage); + int get hashCode => Object.hash(responseCode, subResponseCode, debugMessage); } diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/product_details_wrapper.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/product_details_wrapper.dart index cf700162b237..ce8241113121 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/product_details_wrapper.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/product_details_wrapper.dart @@ -17,6 +17,7 @@ class ProductDetailsWrapper { required this.description, required this.name, this.oneTimePurchaseOfferDetails, + this.oneTimePurchaseOfferDetailsList, required this.productId, required this.productType, this.subscriptionOfferDetails, @@ -38,6 +39,13 @@ class ProductDetailsWrapper { /// null for [ProductType.subs]. final OneTimePurchaseOfferDetailsWrapper? oneTimePurchaseOfferDetails; + /// The list of offer details for a one-time purchase product. + /// + /// [oneTimePurchaseOfferDetailsList] is only set for [ProductType.inapp]. + /// Returns null for [ProductType.subs]. + final List? + oneTimePurchaseOfferDetailsList; + /// The product's id. final String productId; @@ -66,6 +74,10 @@ class ProductDetailsWrapper { other.description == description && other.name == name && other.oneTimePurchaseOfferDetails == oneTimePurchaseOfferDetails && + listEquals( + other.oneTimePurchaseOfferDetailsList, + oneTimePurchaseOfferDetailsList, + ) && other.productId == productId && other.productType == productType && listEquals(other.subscriptionOfferDetails, subscriptionOfferDetails) && @@ -78,6 +90,7 @@ class ProductDetailsWrapper { description.hashCode, name.hashCode, oneTimePurchaseOfferDetails.hashCode, + oneTimePurchaseOfferDetailsList.hashCode, productId.hashCode, productType.hashCode, subscriptionOfferDetails.hashCode, @@ -95,6 +108,7 @@ class ProductDetailsResponseWrapper implements HasBillingResponse { const ProductDetailsResponseWrapper({ required this.billingResult, required this.productDetailsList, + this.unfetchedProductList = const [], }); /// The final result of the [BillingClient.queryProductDetails] call. @@ -103,6 +117,9 @@ class ProductDetailsResponseWrapper implements HasBillingResponse { /// A list of [ProductDetailsWrapper] matching the query to [BillingClient.queryProductDetails]. final List productDetailsList; + /// A list of [UnfetchedProductWrapper] that could not be fetched by [BillingClient.queryProductDetails]. + final List unfetchedProductList; + @override BillingResponse get responseCode => billingResult.responseCode; @@ -114,11 +131,37 @@ class ProductDetailsResponseWrapper implements HasBillingResponse { return other is ProductDetailsResponseWrapper && other.billingResult == billingResult && - other.productDetailsList == productDetailsList; + listEquals(other.productDetailsList, productDetailsList) && + listEquals(other.unfetchedProductList, unfetchedProductList); + } + + @override + int get hashCode => + Object.hash(billingResult, productDetailsList, unfetchedProductList); +} + +/// Dart wrapper around [`com.android.billingclient.api.QueryProductDetailsParams.Product`](https://developer.android.com/reference/com/android/billingclient/api/QueryProductDetailsParams.Product). +/// +/// Contains the details of a product that could not be fetched by the Google Play Billing Library. +@immutable +class UnfetchedProductWrapper { + /// Creates an [UnfetchedProductWrapper]. + const UnfetchedProductWrapper({required this.productId}); + + /// The product ID that could not be fetched. + final String productId; + + @override + bool operator ==(Object other) { + if (other.runtimeType != runtimeType) { + return false; + } + + return other is UnfetchedProductWrapper && other.productId == productId; } @override - int get hashCode => Object.hash(billingResult, productDetailsList); + int get hashCode => productId.hashCode; } /// Recurrence mode of the pricing phase. diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/messages.g.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/messages.g.dart index cbcdb28231df..9aff97c98fdb 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/messages.g.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/messages.g.dart @@ -202,14 +202,17 @@ class PlatformBillingResult { PlatformBillingResult({ required this.responseCode, required this.debugMessage, + this.subResponseCode = 0, }); PlatformBillingResponse responseCode; String debugMessage; + int subResponseCode; + List _toList() { - return [responseCode, debugMessage]; + return [responseCode, debugMessage, subResponseCode]; } Object encode() { @@ -221,6 +224,7 @@ class PlatformBillingResult { return PlatformBillingResult( responseCode: result[0]! as PlatformBillingResponse, debugMessage: result[1]! as String, + subResponseCode: result[2]! as int, ); } @@ -299,6 +303,7 @@ class PlatformProductDetails { required this.productType, required this.title, this.oneTimePurchaseOfferDetails, + this.oneTimePurchaseOfferDetailsList, this.subscriptionOfferDetails, }); @@ -314,6 +319,8 @@ class PlatformProductDetails { PlatformOneTimePurchaseOfferDetails? oneTimePurchaseOfferDetails; + List? oneTimePurchaseOfferDetailsList; + List? subscriptionOfferDetails; List _toList() { @@ -324,6 +331,7 @@ class PlatformProductDetails { productType, title, oneTimePurchaseOfferDetails, + oneTimePurchaseOfferDetailsList, subscriptionOfferDetails, ]; } @@ -342,7 +350,9 @@ class PlatformProductDetails { title: result[4]! as String, oneTimePurchaseOfferDetails: result[5] as PlatformOneTimePurchaseOfferDetails?, - subscriptionOfferDetails: (result[6] as List?) + oneTimePurchaseOfferDetailsList: (result[6] as List?) + ?.cast(), + subscriptionOfferDetails: (result[7] as List?) ?.cast(), ); } @@ -370,14 +380,17 @@ class PlatformProductDetailsResponse { PlatformProductDetailsResponse({ required this.billingResult, required this.productDetails, + required this.unfetchedProductList, }); PlatformBillingResult billingResult; List productDetails; + List unfetchedProductList; + List _toList() { - return [billingResult, productDetails]; + return [billingResult, productDetails, unfetchedProductList]; } Object encode() { @@ -390,6 +403,8 @@ class PlatformProductDetailsResponse { billingResult: result[0]! as PlatformBillingResult, productDetails: (result[1] as List?)! .cast(), + unfetchedProductList: (result[2] as List?)! + .cast(), ); } @@ -1230,6 +1245,43 @@ class PlatformPendingPurchasesParams { int get hashCode => Object.hashAll(_toList()); } +/// Pigeon version of Java [UnfetchedProduct](https://developer.android.com/reference/com/android/billingclient/api/QueryProductDetailsParams.Product). +class PlatformUnfetchedProduct { + PlatformUnfetchedProduct({required this.productId}); + + String productId; + + List _toList() { + return [productId]; + } + + Object encode() { + return _toList(); + } + + static PlatformUnfetchedProduct decode(Object result) { + result as List; + return PlatformUnfetchedProduct(productId: result[0]! as String); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! PlatformUnfetchedProduct || + other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); +} + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -1319,6 +1371,9 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is PlatformPendingPurchasesParams) { buffer.putUint8(155); writeValue(buffer, value.encode()); + } else if (value is PlatformUnfetchedProduct) { + buffer.putUint8(156); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -1392,6 +1447,8 @@ class _PigeonCodec extends StandardMessageCodec { return PlatformInstallmentPlanDetails.decode(readValue(buffer)!); case 155: return PlatformPendingPurchasesParams.decode(readValue(buffer)!); + case 156: + return PlatformUnfetchedProduct.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -1678,41 +1735,6 @@ class InAppPurchaseApi { } } - /// Wraps BillingClient#queryPurchaseHistoryAsync(QueryPurchaseHistoryParams, PurchaseHistoryResponseListener). - Future queryPurchaseHistoryAsync( - PlatformProductType productType, - ) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send( - [productType], - ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as PlatformPurchaseHistoryResponse?)!; - } - } - /// Wraps BillingClient#queryProductDetailsAsync(QueryProductDetailsParams, ProductDetailsResponseListener). Future queryProductDetailsAsync( List products, diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/pigeon_converters.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/pigeon_converters.dart index c3586df9c6a7..64aa8fac4102 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/pigeon_converters.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/pigeon_converters.dart @@ -25,6 +25,7 @@ PlatformBillingChoiceMode platformBillingChoiceMode(BillingChoiceMode mode) { BillingResultWrapper resultWrapperFromPlatform(PlatformBillingResult result) { return BillingResultWrapper( responseCode: billingResponseFromPlatform(result.responseCode), + subResponseCode: result.subResponseCode, debugMessage: result.debugMessage, ); } @@ -38,6 +39,9 @@ ProductDetailsResponseWrapper productDetailsResponseWrapperFromPlatform( productDetailsList: response.productDetails .map(productDetailsWrapperFromPlatform) .toList(), + unfetchedProductList: response.unfetchedProductList + .map(unfetchedProductWrapperFromPlatform) + .toList(), ); } @@ -54,12 +58,23 @@ ProductDetailsWrapper productDetailsWrapperFromPlatform( oneTimePurchaseOfferDetails: oneTimePurchaseOfferDetailsWrapperFromPlatform( product.oneTimePurchaseOfferDetails, ), + oneTimePurchaseOfferDetailsList: product.oneTimePurchaseOfferDetailsList + ?.map(oneTimePurchaseOfferDetailsWrapperFromPlatform) + .whereType() + .toList(), subscriptionOfferDetails: product.subscriptionOfferDetails ?.map(subscriptionOfferDetailsWrapperFromPlatform) .toList(), ); } +/// Creates a [UnfetchedProductWrapper] from the Pigeon equivalent. +UnfetchedProductWrapper unfetchedProductWrapperFromPlatform( + PlatformUnfetchedProduct product, +) { + return UnfetchedProductWrapper(productId: product.productId); +} + /// Creates a [OneTimePurchaseOfferDetailsWrapper] from the Pigeon equivalent. OneTimePurchaseOfferDetailsWrapper? oneTimePurchaseOfferDetailsWrapperFromPlatform( diff --git a/packages/in_app_purchase/in_app_purchase_android/migration_guide.md b/packages/in_app_purchase/in_app_purchase_android/migration_guide.md index 5d0ef0a7d917..ac6907474107 100644 --- a/packages/in_app_purchase/in_app_purchase_android/migration_guide.md +++ b/packages/in_app_purchase/in_app_purchase_android/migration_guide.md @@ -1,4 +1,28 @@ +# Migration Guide from 0.4.x to 0.5.0 + +Version 0.5.0 updates the Android embedding to use Google Play Billing Library 8.0.0. This update includes breaking changes unrelated to the Dart API surface, but specific methods in `BillingClientWrapper` have been removed to align with the native library. + +## Removal of `queryPurchaseHistory` + +The `queryPurchaseHistory` method in `BillingClientWrapper` has been removed because the underlying +native method `queryPurchaseHistoryAsync` was removed in Google Play Billing Library 7.0.0. + +Instead, use `queryPurchases` (which calls `queryPurchasesAsync` natively) to fetch active purchases. +This is now the recommended way to check for existing purchases. + +`queryPurchaseHistory` previously allowed checking for canceled, refunded, or voided purchases. +With its removal, this information is no longer available through the Billing Client. +The [Google Play Developer API](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.products/get) +can be used to verify the state of past purchases. + +### Enhancements + +* `BillingResultWrapper` and `PlatformBillingResult` now include a `subResponseCode` field. +* `ProductDetailsResponseWrapper` and `PlatformProductDetailsResponse` now include an +`unfetchedProductList` to identify products that could not be retrieved. +* `ProductDetailsWrapper` now supports `oneTimePurchaseOfferDetailsList` for products with multiple buy options. + # Migration Guide from 0.2.x to 0.3.0 Starting November 2023, Android Billing Client V4 is no longer supported, diff --git a/packages/in_app_purchase/in_app_purchase_android/pigeons/messages.dart b/packages/in_app_purchase/in_app_purchase_android/pigeons/messages.dart index 90f987cc8dfc..b510d8e26422 100644 --- a/packages/in_app_purchase/in_app_purchase_android/pigeons/messages.dart +++ b/packages/in_app_purchase/in_app_purchase_android/pigeons/messages.dart @@ -37,9 +37,11 @@ class PlatformBillingResult { PlatformBillingResult({ required this.responseCode, required this.debugMessage, + this.subResponseCode = 0, }); final PlatformBillingResponse responseCode; final String debugMessage; + final int subResponseCode; } /// Pigeon version of Java BillingClient.BillingResponseCode. @@ -81,6 +83,7 @@ class PlatformProductDetails { required this.productType, required this.title, required this.oneTimePurchaseOfferDetails, + required this.oneTimePurchaseOfferDetailsList, required this.subscriptionOfferDetails, }); @@ -90,6 +93,8 @@ class PlatformProductDetails { final PlatformProductType productType; final String title; final PlatformOneTimePurchaseOfferDetails? oneTimePurchaseOfferDetails; + final List? + oneTimePurchaseOfferDetailsList; final List? subscriptionOfferDetails; } @@ -99,10 +104,12 @@ class PlatformProductDetailsResponse { PlatformProductDetailsResponse({ required this.billingResult, required this.productDetails, + required this.unfetchedProductList, }); final PlatformBillingResult billingResult; final List productDetails; + final List unfetchedProductList; } /// Pigeon version of AlternativeBillingOnlyReportingDetailsWrapper, which @@ -344,6 +351,13 @@ class PlatformPendingPurchasesParams { final bool enablePrepaidPlans; } +/// Pigeon version of Java [UnfetchedProduct](https://developer.android.com/reference/com/android/billingclient/api/QueryProductDetailsParams.Product). +class PlatformUnfetchedProduct { + PlatformUnfetchedProduct({required this.productId}); + + final String productId; +} + /// Pigeon version of Java BillingClient.ProductType. enum PlatformProductType { inapp, subs } @@ -416,12 +430,6 @@ abstract class InAppPurchaseApi { PlatformProductType productType, ); - /// Wraps BillingClient#queryPurchaseHistoryAsync(QueryPurchaseHistoryParams, PurchaseHistoryResponseListener). - @async - PlatformPurchaseHistoryResponse queryPurchaseHistoryAsync( - PlatformProductType productType, - ); - /// Wraps BillingClient#queryProductDetailsAsync(QueryProductDetailsParams, ProductDetailsResponseListener). @async PlatformProductDetailsResponse queryProductDetailsAsync( diff --git a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml index 06a91eb3cfaa..2d68aec736e4 100644 --- a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml @@ -3,7 +3,7 @@ description: An implementation for the Android platform of the Flutter `in_app_p repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 0.4.0+8 +version: 0.5.0 environment: sdk: ^3.9.0 diff --git a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.dart index 2959ea704712..b9099a02179c 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.dart @@ -195,6 +195,7 @@ void main() { debugMessage: debugMessage, ), productDetails: [], + unfetchedProductList: [], ), ); @@ -228,6 +229,7 @@ void main() { productDetails: [ convertToPigeonProductDetails(dummyOneTimeProductDetails), ], + unfetchedProductList: [], ), ); @@ -248,6 +250,35 @@ void main() { expect(response.billingResult, equals(billingResult)); expect(response.productDetailsList, contains(dummyOneTimeProductDetails)); }); + + test('returns unfetchedProductList', () async { + const debugMessage = 'dummy message'; + when(mockApi.queryProductDetailsAsync(any)).thenAnswer( + (_) async => PlatformProductDetailsResponse( + billingResult: PlatformBillingResult( + responseCode: PlatformBillingResponse.ok, + debugMessage: debugMessage, + ), + productDetails: [], + unfetchedProductList: [ + PlatformUnfetchedProduct(productId: 'unfetched'), + ], + ), + ); + + final ProductDetailsResponseWrapper response = await billingClient + .queryProductDetails( + productList: [ + const ProductWrapper( + productId: 'unfetched', + productType: ProductType.inapp, + ), + ], + ); + + expect(response.unfetchedProductList, hasLength(1)); + expect(response.unfetchedProductList[0].productId, 'unfetched'); + }); }); group('launchBillingFlow', () { @@ -256,6 +287,7 @@ void main() { const BillingResponse responseCode = BillingResponse.ok; const expectedBillingResult = BillingResultWrapper( responseCode: responseCode, + subResponseCode: 123, debugMessage: debugMessage, ); when( @@ -525,32 +557,6 @@ void main() { }); }); - group('queryPurchaseHistory', () { - test('handles empty purchases', () async { - const BillingResponse expectedCode = BillingResponse.userCanceled; - const debugMessage = 'dummy message'; - const expectedBillingResult = BillingResultWrapper( - responseCode: expectedCode, - debugMessage: debugMessage, - ); - when(mockApi.queryPurchaseHistoryAsync(any)).thenAnswer( - (_) async => PlatformPurchaseHistoryResponse( - billingResult: PlatformBillingResult( - responseCode: PlatformBillingResponse.userCanceled, - debugMessage: debugMessage, - ), - purchases: [], - ), - ); - - final PurchasesHistoryResult response = await billingClient - .queryPurchaseHistory(ProductType.inapp); - - expect(response.billingResult, equals(expectedBillingResult)); - expect(response.purchaseHistoryRecordList, isEmpty); - }); - }); - group('consume purchases', () { test('consume purchase async success', () async { const token = 'dummy token'; @@ -684,6 +690,15 @@ void main() { expect(result, expected); }); }); + + test('UnfetchedProductWrapper equality', () { + const product1 = UnfetchedProductWrapper(productId: 'id'); + const product2 = UnfetchedProductWrapper(productId: 'id'); + const product3 = UnfetchedProductWrapper(productId: 'other'); + + expect(product1, product2); + expect(product1, isNot(product3)); + }); } PlatformBillingConfigResponse platformBillingConfigFromWrapper( diff --git a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/product_details_wrapper_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/product_details_wrapper_test.dart index a2277eaff969..8023514abb74 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/product_details_wrapper_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/product_details_wrapper_test.dart @@ -51,6 +51,13 @@ void main() { priceAmountMicros: 10, priceCurrencyCode: 'priceCurrencyCode', ), + oneTimePurchaseOfferDetailsList: [ + OneTimePurchaseOfferDetailsWrapper( + formattedPrice: 'formattedPrice', + priceAmountMicros: 10, + priceCurrencyCode: 'priceCurrencyCode', + ), + ], subscriptionOfferDetails: [ SubscriptionOfferDetailsWrapper( basePlanId: 'basePlanId', @@ -84,6 +91,13 @@ void main() { priceAmountMicros: 10, priceCurrencyCode: 'priceCurrencyCode', ), + oneTimePurchaseOfferDetailsList: [ + OneTimePurchaseOfferDetailsWrapper( + formattedPrice: 'formattedPrice', + priceAmountMicros: 10, + priceCurrencyCode: 'priceCurrencyCode', + ), + ], subscriptionOfferDetails: [ SubscriptionOfferDetailsWrapper( basePlanId: 'basePlanId', @@ -115,10 +129,12 @@ void main() { test('operator == of BillingResultWrapper works fine', () { const firstBillingResultInstance = BillingResultWrapper( responseCode: BillingResponse.ok, + subResponseCode: 123, debugMessage: 'debugMessage', ); const secondBillingResultInstance = BillingResultWrapper( responseCode: BillingResponse.ok, + subResponseCode: 123, debugMessage: 'debugMessage', ); expect(firstBillingResultInstance == secondBillingResultInstance, isTrue); diff --git a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart index c29edc9e861e..e3b87aa20e3e 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart @@ -47,6 +47,10 @@ const ProductDetailsWrapper dummySubscriptionProductDetails = ], ); +final PlatformUnfetchedProduct dummyUnfetchedProduct = PlatformUnfetchedProduct( + productId: 'unfetched', +); + void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -149,6 +153,7 @@ void main() { debugMessage: debugMessage, ), productDetails: [], + unfetchedProductList: [], ), ); @@ -169,6 +174,9 @@ void main() { productDetails: [ convertToPigeonProductDetails(dummyOneTimeProductDetails), ], + unfetchedProductList: [ + dummyUnfetchedProduct, + ], ), ); // Since queryProductDetails makes 2 platform method calls (one for each ProductType), the result will contain 2 dummyWrapper instead @@ -202,6 +210,7 @@ void main() { productDetails: [ convertToPigeonProductDetails(dummyOneTimeProductDetails), ], + unfetchedProductList: [], ), ); // Since queryProductDetails makes 2 platform method calls (one for each ProductType), the result will contain 2 dummyWrapper instead diff --git a/packages/in_app_purchase/in_app_purchase_android/test/test_conversion_utils.dart b/packages/in_app_purchase/in_app_purchase_android/test/test_conversion_utils.dart index b80ab3574580..2493939abc19 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/test_conversion_utils.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/test_conversion_utils.dart @@ -15,6 +15,7 @@ PlatformBillingResult convertToPigeonResult(BillingResultWrapper targetResult) { return PlatformBillingResult( responseCode: billingResponseFromWrapper(targetResult.responseCode), debugMessage: targetResult.debugMessage!, + subResponseCode: targetResult.subResponseCode, ); } From e86d4d76053e01e4def7154d2618366a7d645aea Mon Sep 17 00:00:00 2001 From: Gray Mackall <34871572+gmackall@users.noreply.github.com> Date: Thu, 21 May 2026 12:14:01 -0700 Subject: [PATCH 2/5] change language slightly --- .../in_app_purchase/in_app_purchase_android/migration_guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/in_app_purchase/in_app_purchase_android/migration_guide.md b/packages/in_app_purchase/in_app_purchase_android/migration_guide.md index a65d4a7d50b8..38dda3f94538 100644 --- a/packages/in_app_purchase/in_app_purchase_android/migration_guide.md +++ b/packages/in_app_purchase/in_app_purchase_android/migration_guide.md @@ -1,7 +1,7 @@ # Migration Guide from 0.4.x to 0.5.0 -Version 0.5.0 updates the Android embedding to use Google Play Billing Library 8.0.0. This update includes breaking changes unrelated to the Dart API surface, but specific methods in `BillingClientWrapper` have been removed to align with the native library. +Version 0.5.0 updates to use Google Play Billing Library 8.0.0. This update includes breaking changes unrelated to the Dart API surface, but specific methods in `BillingClientWrapper` have been removed to align with the native library. ## Removal of `queryPurchaseHistory` From 2707aa61d4b77c186ffb45746c535824ce2cece6 Mon Sep 17 00:00:00 2001 From: Gray Mackall <34871572+gmackall@users.noreply.github.com> Date: Thu, 21 May 2026 12:23:39 -0700 Subject: [PATCH 3/5] format --- .../inapppurchase/MethodCallHandlerImpl.java | 18 +- .../flutter/plugins/inapppurchase/Messages.kt | 1016 ++++++++++------- .../plugins/inapppurchase/Translator.kt | 20 +- .../inapppurchase/MethodCallHandlerTest.java | 32 +- .../lib/src/messages.g.dart | 712 +++++++----- 5 files changed, 1054 insertions(+), 744 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java index 84cfd804d4e6..3e665871b45a 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java @@ -224,15 +224,15 @@ public void queryProductDetailsAsync( QueryProductDetailsParams.newBuilder().setProductList(toProductList(products)).build(); billingClient.queryProductDetailsAsync( params, - (billingResult, productDetailsResult) -> { - updateCachedProducts(productDetailsResult.getProductDetailsList()); - PlatformProductDetailsResponse response = - new PlatformProductDetailsResponse( - fromBillingResult(billingResult), - fromProductDetailsList(productDetailsResult.getProductDetailsList()), - fromUnfetchedProductList(productDetailsResult.getUnfetchedProductList())); - ResultCompat.success(response, callback); - }); + (billingResult, productDetailsResult) -> { + updateCachedProducts(productDetailsResult.getProductDetailsList()); + PlatformProductDetailsResponse response = + new PlatformProductDetailsResponse( + fromBillingResult(billingResult), + fromProductDetailsList(productDetailsResult.getProductDetailsList()), + fromUnfetchedProductList(productDetailsResult.getUnfetchedProductList())); + ResultCompat.success(response, callback); + }); } catch (RuntimeException e) { ResultUtilsKt.completeWithError( callback, new FlutterError("error", e.getMessage(), Log.getStackTraceString(e))); diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/kotlin/io/flutter/plugins/inapppurchase/Messages.kt b/packages/in_app_purchase/in_app_purchase_android/android/src/main/kotlin/io/flutter/plugins/inapppurchase/Messages.kt index 9d3336633a0a..9454d588eb28 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/kotlin/io/flutter/plugins/inapppurchase/Messages.kt +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/kotlin/io/flutter/plugins/inapppurchase/Messages.kt @@ -10,16 +10,17 @@ package io.flutter.plugins.inapppurchase import android.util.Log import io.flutter.plugin.common.BasicMessageChannel import io.flutter.plugin.common.BinaryMessenger -import io.flutter.plugin.common.EventChannel import io.flutter.plugin.common.MessageCodec -import io.flutter.plugin.common.StandardMethodCodec import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer + private object MessagesPigeonUtils { fun createConnectionError(channelName: String): FlutterError { - return FlutterError("channel-error", "Unable to establish connection on channel: '$channelName'.", "") } + return FlutterError( + "channel-error", "Unable to establish connection on channel: '$channelName'.", "") + } fun wrapResult(result: Any?): List { return listOf(result) @@ -27,19 +28,15 @@ private object MessagesPigeonUtils { fun wrapError(exception: Throwable): List { return if (exception is FlutterError) { - listOf( - exception.code, - exception.message, - exception.details - ) + listOf(exception.code, exception.message, exception.details) } else { listOf( - exception.javaClass.simpleName, - exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) - ) + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) } } + fun doubleEquals(a: Double, b: Double): Boolean { // Normalize -0.0 to 0.0 and handle NaN equality. return (if (a == 0.0) 0.0 else a) == (if (b == 0.0) 0.0 else b) || (a.isNaN() && b.isNaN()) @@ -183,19 +180,19 @@ private object MessagesPigeonUtils { else -> value.hashCode() } } - } /** * Error class for passing custom error details to Flutter via a thrown PlatformException. + * * @property code The error code. * @property message The error message. * @property details The error details. Must be a datatype supported by the api codec. */ -class FlutterError ( - val code: String, - override val message: String? = null, - val details: Any? = null +class FlutterError( + val code: String, + override val message: String? = null, + val details: Any? = null ) : RuntimeException() /** Pigeon version of Java BillingClient.BillingResponseCode. */ @@ -317,11 +314,7 @@ enum class PlatformRecurrenceMode(val raw: Int) { * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformQueryProduct ( - val productId: String, - val productType: PlatformProductType -) - { +data class PlatformQueryProduct(val productId: String, val productType: PlatformProductType) { companion object { fun fromList(pigeonVar_list: List): PlatformQueryProduct { val productId = pigeonVar_list[0] as String @@ -329,12 +322,14 @@ data class PlatformQueryProduct ( return PlatformQueryProduct(productId, productType) } } + fun toList(): List { return listOf( - productId, - productType, + productId, + productType, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -343,7 +338,8 @@ data class PlatformQueryProduct ( return true } val other = other as PlatformQueryProduct - return MessagesPigeonUtils.deepEquals(this.productId, other.productId) && MessagesPigeonUtils.deepEquals(this.productType, other.productType) + return MessagesPigeonUtils.deepEquals(this.productId, other.productId) && + MessagesPigeonUtils.deepEquals(this.productType, other.productType) } override fun hashCode(): Int { @@ -359,11 +355,10 @@ data class PlatformQueryProduct ( * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformAccountIdentifiers ( - val obfuscatedAccountId: String? = null, - val obfuscatedProfileId: String? = null -) - { +data class PlatformAccountIdentifiers( + val obfuscatedAccountId: String? = null, + val obfuscatedProfileId: String? = null +) { companion object { fun fromList(pigeonVar_list: List): PlatformAccountIdentifiers { val obfuscatedAccountId = pigeonVar_list[0] as String? @@ -371,12 +366,14 @@ data class PlatformAccountIdentifiers ( return PlatformAccountIdentifiers(obfuscatedAccountId, obfuscatedProfileId) } } + fun toList(): List { return listOf( - obfuscatedAccountId, - obfuscatedProfileId, + obfuscatedAccountId, + obfuscatedProfileId, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -385,7 +382,8 @@ data class PlatformAccountIdentifiers ( return true } val other = other as PlatformAccountIdentifiers - return MessagesPigeonUtils.deepEquals(this.obfuscatedAccountId, other.obfuscatedAccountId) && MessagesPigeonUtils.deepEquals(this.obfuscatedProfileId, other.obfuscatedProfileId) + return MessagesPigeonUtils.deepEquals(this.obfuscatedAccountId, other.obfuscatedAccountId) && + MessagesPigeonUtils.deepEquals(this.obfuscatedProfileId, other.obfuscatedProfileId) } override fun hashCode(): Int { @@ -401,12 +399,11 @@ data class PlatformAccountIdentifiers ( * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformBillingResult ( - val responseCode: PlatformBillingResponse, - val debugMessage: String, - val subResponseCode: Long -) - { +data class PlatformBillingResult( + val responseCode: PlatformBillingResponse, + val debugMessage: String, + val subResponseCode: Long +) { companion object { fun fromList(pigeonVar_list: List): PlatformBillingResult { val responseCode = pigeonVar_list[0] as PlatformBillingResponse @@ -415,13 +412,15 @@ data class PlatformBillingResult ( return PlatformBillingResult(responseCode, debugMessage, subResponseCode) } } + fun toList(): List { return listOf( - responseCode, - debugMessage, - subResponseCode, + responseCode, + debugMessage, + subResponseCode, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -430,7 +429,9 @@ data class PlatformBillingResult ( return true } val other = other as PlatformBillingResult - return MessagesPigeonUtils.deepEquals(this.responseCode, other.responseCode) && MessagesPigeonUtils.deepEquals(this.debugMessage, other.debugMessage) && MessagesPigeonUtils.deepEquals(this.subResponseCode, other.subResponseCode) + return MessagesPigeonUtils.deepEquals(this.responseCode, other.responseCode) && + MessagesPigeonUtils.deepEquals(this.debugMessage, other.debugMessage) && + MessagesPigeonUtils.deepEquals(this.subResponseCode, other.subResponseCode) } override fun hashCode(): Int { @@ -447,27 +448,29 @@ data class PlatformBillingResult ( * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformOneTimePurchaseOfferDetails ( - val priceAmountMicros: Long, - val formattedPrice: String, - val priceCurrencyCode: String -) - { +data class PlatformOneTimePurchaseOfferDetails( + val priceAmountMicros: Long, + val formattedPrice: String, + val priceCurrencyCode: String +) { companion object { fun fromList(pigeonVar_list: List): PlatformOneTimePurchaseOfferDetails { val priceAmountMicros = pigeonVar_list[0] as Long val formattedPrice = pigeonVar_list[1] as String val priceCurrencyCode = pigeonVar_list[2] as String - return PlatformOneTimePurchaseOfferDetails(priceAmountMicros, formattedPrice, priceCurrencyCode) + return PlatformOneTimePurchaseOfferDetails( + priceAmountMicros, formattedPrice, priceCurrencyCode) } } + fun toList(): List { return listOf( - priceAmountMicros, - formattedPrice, - priceCurrencyCode, + priceAmountMicros, + formattedPrice, + priceCurrencyCode, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -476,7 +479,9 @@ data class PlatformOneTimePurchaseOfferDetails ( return true } val other = other as PlatformOneTimePurchaseOfferDetails - return MessagesPigeonUtils.deepEquals(this.priceAmountMicros, other.priceAmountMicros) && MessagesPigeonUtils.deepEquals(this.formattedPrice, other.formattedPrice) && MessagesPigeonUtils.deepEquals(this.priceCurrencyCode, other.priceCurrencyCode) + return MessagesPigeonUtils.deepEquals(this.priceAmountMicros, other.priceAmountMicros) && + MessagesPigeonUtils.deepEquals(this.formattedPrice, other.formattedPrice) && + MessagesPigeonUtils.deepEquals(this.priceCurrencyCode, other.priceCurrencyCode) } override fun hashCode(): Int { @@ -493,17 +498,16 @@ data class PlatformOneTimePurchaseOfferDetails ( * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformProductDetails ( - val description: String, - val name: String, - val productId: String, - val productType: PlatformProductType, - val title: String, - val oneTimePurchaseOfferDetails: PlatformOneTimePurchaseOfferDetails? = null, - val oneTimePurchaseOfferDetailsList: List? = null, - val subscriptionOfferDetails: List? = null -) - { +data class PlatformProductDetails( + val description: String, + val name: String, + val productId: String, + val productType: PlatformProductType, + val title: String, + val oneTimePurchaseOfferDetails: PlatformOneTimePurchaseOfferDetails? = null, + val oneTimePurchaseOfferDetailsList: List? = null, + val subscriptionOfferDetails: List? = null +) { companion object { fun fromList(pigeonVar_list: List): PlatformProductDetails { val description = pigeonVar_list[0] as String @@ -512,23 +516,34 @@ data class PlatformProductDetails ( val productType = pigeonVar_list[3] as PlatformProductType val title = pigeonVar_list[4] as String val oneTimePurchaseOfferDetails = pigeonVar_list[5] as PlatformOneTimePurchaseOfferDetails? - val oneTimePurchaseOfferDetailsList = pigeonVar_list[6] as List? + val oneTimePurchaseOfferDetailsList = + pigeonVar_list[6] as List? val subscriptionOfferDetails = pigeonVar_list[7] as List? - return PlatformProductDetails(description, name, productId, productType, title, oneTimePurchaseOfferDetails, oneTimePurchaseOfferDetailsList, subscriptionOfferDetails) + return PlatformProductDetails( + description, + name, + productId, + productType, + title, + oneTimePurchaseOfferDetails, + oneTimePurchaseOfferDetailsList, + subscriptionOfferDetails) } } + fun toList(): List { return listOf( - description, - name, - productId, - productType, - title, - oneTimePurchaseOfferDetails, - oneTimePurchaseOfferDetailsList, - subscriptionOfferDetails, + description, + name, + productId, + productType, + title, + oneTimePurchaseOfferDetails, + oneTimePurchaseOfferDetailsList, + subscriptionOfferDetails, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -537,7 +552,17 @@ data class PlatformProductDetails ( return true } val other = other as PlatformProductDetails - return MessagesPigeonUtils.deepEquals(this.description, other.description) && MessagesPigeonUtils.deepEquals(this.name, other.name) && MessagesPigeonUtils.deepEquals(this.productId, other.productId) && MessagesPigeonUtils.deepEquals(this.productType, other.productType) && MessagesPigeonUtils.deepEquals(this.title, other.title) && MessagesPigeonUtils.deepEquals(this.oneTimePurchaseOfferDetails, other.oneTimePurchaseOfferDetails) && MessagesPigeonUtils.deepEquals(this.oneTimePurchaseOfferDetailsList, other.oneTimePurchaseOfferDetailsList) && MessagesPigeonUtils.deepEquals(this.subscriptionOfferDetails, other.subscriptionOfferDetails) + return MessagesPigeonUtils.deepEquals(this.description, other.description) && + MessagesPigeonUtils.deepEquals(this.name, other.name) && + MessagesPigeonUtils.deepEquals(this.productId, other.productId) && + MessagesPigeonUtils.deepEquals(this.productType, other.productType) && + MessagesPigeonUtils.deepEquals(this.title, other.title) && + MessagesPigeonUtils.deepEquals( + this.oneTimePurchaseOfferDetails, other.oneTimePurchaseOfferDetails) && + MessagesPigeonUtils.deepEquals( + this.oneTimePurchaseOfferDetailsList, other.oneTimePurchaseOfferDetailsList) && + MessagesPigeonUtils.deepEquals( + this.subscriptionOfferDetails, other.subscriptionOfferDetails) } override fun hashCode(): Int { @@ -555,17 +580,16 @@ data class PlatformProductDetails ( } /** - * Pigeon version of ProductDetailsResponseWrapper, which contains the - * components of the Java ProductDetailsResponseListener callback. + * Pigeon version of ProductDetailsResponseWrapper, which contains the components of the Java + * ProductDetailsResponseListener callback. * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformProductDetailsResponse ( - val billingResult: PlatformBillingResult, - val productDetails: List, - val unfetchedProductList: List -) - { +data class PlatformProductDetailsResponse( + val billingResult: PlatformBillingResult, + val productDetails: List, + val unfetchedProductList: List +) { companion object { fun fromList(pigeonVar_list: List): PlatformProductDetailsResponse { val billingResult = pigeonVar_list[0] as PlatformBillingResult @@ -574,13 +598,15 @@ data class PlatformProductDetailsResponse ( return PlatformProductDetailsResponse(billingResult, productDetails, unfetchedProductList) } } + fun toList(): List { return listOf( - billingResult, - productDetails, - unfetchedProductList, + billingResult, + productDetails, + unfetchedProductList, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -589,7 +615,9 @@ data class PlatformProductDetailsResponse ( return true } val other = other as PlatformProductDetailsResponse - return MessagesPigeonUtils.deepEquals(this.billingResult, other.billingResult) && MessagesPigeonUtils.deepEquals(this.productDetails, other.productDetails) && MessagesPigeonUtils.deepEquals(this.unfetchedProductList, other.unfetchedProductList) + return MessagesPigeonUtils.deepEquals(this.billingResult, other.billingResult) && + MessagesPigeonUtils.deepEquals(this.productDetails, other.productDetails) && + MessagesPigeonUtils.deepEquals(this.unfetchedProductList, other.unfetchedProductList) } override fun hashCode(): Int { @@ -602,30 +630,33 @@ data class PlatformProductDetailsResponse ( } /** - * Pigeon version of AlternativeBillingOnlyReportingDetailsWrapper, which - * contains the components of the Java - * AlternativeBillingOnlyReportingDetailsListener callback. + * Pigeon version of AlternativeBillingOnlyReportingDetailsWrapper, which contains the components of + * the Java AlternativeBillingOnlyReportingDetailsListener callback. * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformAlternativeBillingOnlyReportingDetailsResponse ( - val billingResult: PlatformBillingResult, - val externalTransactionToken: String -) - { +data class PlatformAlternativeBillingOnlyReportingDetailsResponse( + val billingResult: PlatformBillingResult, + val externalTransactionToken: String +) { companion object { - fun fromList(pigeonVar_list: List): PlatformAlternativeBillingOnlyReportingDetailsResponse { + fun fromList( + pigeonVar_list: List + ): PlatformAlternativeBillingOnlyReportingDetailsResponse { val billingResult = pigeonVar_list[0] as PlatformBillingResult val externalTransactionToken = pigeonVar_list[1] as String - return PlatformAlternativeBillingOnlyReportingDetailsResponse(billingResult, externalTransactionToken) + return PlatformAlternativeBillingOnlyReportingDetailsResponse( + billingResult, externalTransactionToken) } } + fun toList(): List { return listOf( - billingResult, - externalTransactionToken, + billingResult, + externalTransactionToken, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -634,7 +665,9 @@ data class PlatformAlternativeBillingOnlyReportingDetailsResponse ( return true } val other = other as PlatformAlternativeBillingOnlyReportingDetailsResponse - return MessagesPigeonUtils.deepEquals(this.billingResult, other.billingResult) && MessagesPigeonUtils.deepEquals(this.externalTransactionToken, other.externalTransactionToken) + return MessagesPigeonUtils.deepEquals(this.billingResult, other.billingResult) && + MessagesPigeonUtils.deepEquals( + this.externalTransactionToken, other.externalTransactionToken) } override fun hashCode(): Int { @@ -646,16 +679,15 @@ data class PlatformAlternativeBillingOnlyReportingDetailsResponse ( } /** - * Pigeon version of BillingConfigWrapper, which contains the components of the - * Java BillingConfigResponseListener callback. + * Pigeon version of BillingConfigWrapper, which contains the components of the Java + * BillingConfigResponseListener callback. * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformBillingConfigResponse ( - val billingResult: PlatformBillingResult, - val countryCode: String -) - { +data class PlatformBillingConfigResponse( + val billingResult: PlatformBillingResult, + val countryCode: String +) { companion object { fun fromList(pigeonVar_list: List): PlatformBillingConfigResponse { val billingResult = pigeonVar_list[0] as PlatformBillingResult @@ -663,12 +695,14 @@ data class PlatformBillingConfigResponse ( return PlatformBillingConfigResponse(billingResult, countryCode) } } + fun toList(): List { return listOf( - billingResult, - countryCode, + billingResult, + countryCode, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -677,7 +711,8 @@ data class PlatformBillingConfigResponse ( return true } val other = other as PlatformBillingConfigResponse - return MessagesPigeonUtils.deepEquals(this.billingResult, other.billingResult) && MessagesPigeonUtils.deepEquals(this.countryCode, other.countryCode) + return MessagesPigeonUtils.deepEquals(this.billingResult, other.billingResult) && + MessagesPigeonUtils.deepEquals(this.countryCode, other.countryCode) } override fun hashCode(): Int { @@ -693,16 +728,15 @@ data class PlatformBillingConfigResponse ( * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformBillingFlowParams ( - val product: String, - val replacementMode: PlatformReplacementMode, - val offerToken: String? = null, - val accountId: String? = null, - val obfuscatedProfileId: String? = null, - val oldProduct: String? = null, - val purchaseToken: String? = null -) - { +data class PlatformBillingFlowParams( + val product: String, + val replacementMode: PlatformReplacementMode, + val offerToken: String? = null, + val accountId: String? = null, + val obfuscatedProfileId: String? = null, + val oldProduct: String? = null, + val purchaseToken: String? = null +) { companion object { fun fromList(pigeonVar_list: List): PlatformBillingFlowParams { val product = pigeonVar_list[0] as String @@ -712,20 +746,29 @@ data class PlatformBillingFlowParams ( val obfuscatedProfileId = pigeonVar_list[4] as String? val oldProduct = pigeonVar_list[5] as String? val purchaseToken = pigeonVar_list[6] as String? - return PlatformBillingFlowParams(product, replacementMode, offerToken, accountId, obfuscatedProfileId, oldProduct, purchaseToken) + return PlatformBillingFlowParams( + product, + replacementMode, + offerToken, + accountId, + obfuscatedProfileId, + oldProduct, + purchaseToken) } } + fun toList(): List { return listOf( - product, - replacementMode, - offerToken, - accountId, - obfuscatedProfileId, - oldProduct, - purchaseToken, + product, + replacementMode, + offerToken, + accountId, + obfuscatedProfileId, + oldProduct, + purchaseToken, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -734,7 +777,13 @@ data class PlatformBillingFlowParams ( return true } val other = other as PlatformBillingFlowParams - return MessagesPigeonUtils.deepEquals(this.product, other.product) && MessagesPigeonUtils.deepEquals(this.replacementMode, other.replacementMode) && MessagesPigeonUtils.deepEquals(this.offerToken, other.offerToken) && MessagesPigeonUtils.deepEquals(this.accountId, other.accountId) && MessagesPigeonUtils.deepEquals(this.obfuscatedProfileId, other.obfuscatedProfileId) && MessagesPigeonUtils.deepEquals(this.oldProduct, other.oldProduct) && MessagesPigeonUtils.deepEquals(this.purchaseToken, other.purchaseToken) + return MessagesPigeonUtils.deepEquals(this.product, other.product) && + MessagesPigeonUtils.deepEquals(this.replacementMode, other.replacementMode) && + MessagesPigeonUtils.deepEquals(this.offerToken, other.offerToken) && + MessagesPigeonUtils.deepEquals(this.accountId, other.accountId) && + MessagesPigeonUtils.deepEquals(this.obfuscatedProfileId, other.obfuscatedProfileId) && + MessagesPigeonUtils.deepEquals(this.oldProduct, other.oldProduct) && + MessagesPigeonUtils.deepEquals(this.purchaseToken, other.purchaseToken) } override fun hashCode(): Int { @@ -755,15 +804,14 @@ data class PlatformBillingFlowParams ( * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformPricingPhase ( - val billingCycleCount: Long, - val recurrenceMode: PlatformRecurrenceMode, - val priceAmountMicros: Long, - val billingPeriod: String, - val formattedPrice: String, - val priceCurrencyCode: String -) - { +data class PlatformPricingPhase( + val billingCycleCount: Long, + val recurrenceMode: PlatformRecurrenceMode, + val priceAmountMicros: Long, + val billingPeriod: String, + val formattedPrice: String, + val priceCurrencyCode: String +) { companion object { fun fromList(pigeonVar_list: List): PlatformPricingPhase { val billingCycleCount = pigeonVar_list[0] as Long @@ -772,19 +820,27 @@ data class PlatformPricingPhase ( val billingPeriod = pigeonVar_list[3] as String val formattedPrice = pigeonVar_list[4] as String val priceCurrencyCode = pigeonVar_list[5] as String - return PlatformPricingPhase(billingCycleCount, recurrenceMode, priceAmountMicros, billingPeriod, formattedPrice, priceCurrencyCode) + return PlatformPricingPhase( + billingCycleCount, + recurrenceMode, + priceAmountMicros, + billingPeriod, + formattedPrice, + priceCurrencyCode) } } + fun toList(): List { return listOf( - billingCycleCount, - recurrenceMode, - priceAmountMicros, - billingPeriod, - formattedPrice, - priceCurrencyCode, + billingCycleCount, + recurrenceMode, + priceAmountMicros, + billingPeriod, + formattedPrice, + priceCurrencyCode, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -793,7 +849,12 @@ data class PlatformPricingPhase ( return true } val other = other as PlatformPricingPhase - return MessagesPigeonUtils.deepEquals(this.billingCycleCount, other.billingCycleCount) && MessagesPigeonUtils.deepEquals(this.recurrenceMode, other.recurrenceMode) && MessagesPigeonUtils.deepEquals(this.priceAmountMicros, other.priceAmountMicros) && MessagesPigeonUtils.deepEquals(this.billingPeriod, other.billingPeriod) && MessagesPigeonUtils.deepEquals(this.formattedPrice, other.formattedPrice) && MessagesPigeonUtils.deepEquals(this.priceCurrencyCode, other.priceCurrencyCode) + return MessagesPigeonUtils.deepEquals(this.billingCycleCount, other.billingCycleCount) && + MessagesPigeonUtils.deepEquals(this.recurrenceMode, other.recurrenceMode) && + MessagesPigeonUtils.deepEquals(this.priceAmountMicros, other.priceAmountMicros) && + MessagesPigeonUtils.deepEquals(this.billingPeriod, other.billingPeriod) && + MessagesPigeonUtils.deepEquals(this.formattedPrice, other.formattedPrice) && + MessagesPigeonUtils.deepEquals(this.priceCurrencyCode, other.priceCurrencyCode) } override fun hashCode(): Int { @@ -815,23 +876,22 @@ data class PlatformPricingPhase ( * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformPurchase ( - val orderId: String? = null, - val packageName: String, - val purchaseTime: Long, - val purchaseToken: String, - val signature: String, - val products: List, - val isAutoRenewing: Boolean, - val originalJson: String, - val developerPayload: String, - val isAcknowledged: Boolean, - val quantity: Long, - val purchaseState: PlatformPurchaseState, - val accountIdentifiers: PlatformAccountIdentifiers? = null, - val pendingPurchaseUpdate: PlatformPendingPurchaseUpdate? = null -) - { +data class PlatformPurchase( + val orderId: String? = null, + val packageName: String, + val purchaseTime: Long, + val purchaseToken: String, + val signature: String, + val products: List, + val isAutoRenewing: Boolean, + val originalJson: String, + val developerPayload: String, + val isAcknowledged: Boolean, + val quantity: Long, + val purchaseState: PlatformPurchaseState, + val accountIdentifiers: PlatformAccountIdentifiers? = null, + val pendingPurchaseUpdate: PlatformPendingPurchaseUpdate? = null +) { companion object { fun fromList(pigeonVar_list: List): PlatformPurchase { val orderId = pigeonVar_list[0] as String? @@ -848,27 +908,43 @@ data class PlatformPurchase ( val purchaseState = pigeonVar_list[11] as PlatformPurchaseState val accountIdentifiers = pigeonVar_list[12] as PlatformAccountIdentifiers? val pendingPurchaseUpdate = pigeonVar_list[13] as PlatformPendingPurchaseUpdate? - return PlatformPurchase(orderId, packageName, purchaseTime, purchaseToken, signature, products, isAutoRenewing, originalJson, developerPayload, isAcknowledged, quantity, purchaseState, accountIdentifiers, pendingPurchaseUpdate) + return PlatformPurchase( + orderId, + packageName, + purchaseTime, + purchaseToken, + signature, + products, + isAutoRenewing, + originalJson, + developerPayload, + isAcknowledged, + quantity, + purchaseState, + accountIdentifiers, + pendingPurchaseUpdate) } } + fun toList(): List { return listOf( - orderId, - packageName, - purchaseTime, - purchaseToken, - signature, - products, - isAutoRenewing, - originalJson, - developerPayload, - isAcknowledged, - quantity, - purchaseState, - accountIdentifiers, - pendingPurchaseUpdate, + orderId, + packageName, + purchaseTime, + purchaseToken, + signature, + products, + isAutoRenewing, + originalJson, + developerPayload, + isAcknowledged, + quantity, + purchaseState, + accountIdentifiers, + pendingPurchaseUpdate, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -877,7 +953,20 @@ data class PlatformPurchase ( return true } val other = other as PlatformPurchase - return MessagesPigeonUtils.deepEquals(this.orderId, other.orderId) && MessagesPigeonUtils.deepEquals(this.packageName, other.packageName) && MessagesPigeonUtils.deepEquals(this.purchaseTime, other.purchaseTime) && MessagesPigeonUtils.deepEquals(this.purchaseToken, other.purchaseToken) && MessagesPigeonUtils.deepEquals(this.signature, other.signature) && MessagesPigeonUtils.deepEquals(this.products, other.products) && MessagesPigeonUtils.deepEquals(this.isAutoRenewing, other.isAutoRenewing) && MessagesPigeonUtils.deepEquals(this.originalJson, other.originalJson) && MessagesPigeonUtils.deepEquals(this.developerPayload, other.developerPayload) && MessagesPigeonUtils.deepEquals(this.isAcknowledged, other.isAcknowledged) && MessagesPigeonUtils.deepEquals(this.quantity, other.quantity) && MessagesPigeonUtils.deepEquals(this.purchaseState, other.purchaseState) && MessagesPigeonUtils.deepEquals(this.accountIdentifiers, other.accountIdentifiers) && MessagesPigeonUtils.deepEquals(this.pendingPurchaseUpdate, other.pendingPurchaseUpdate) + return MessagesPigeonUtils.deepEquals(this.orderId, other.orderId) && + MessagesPigeonUtils.deepEquals(this.packageName, other.packageName) && + MessagesPigeonUtils.deepEquals(this.purchaseTime, other.purchaseTime) && + MessagesPigeonUtils.deepEquals(this.purchaseToken, other.purchaseToken) && + MessagesPigeonUtils.deepEquals(this.signature, other.signature) && + MessagesPigeonUtils.deepEquals(this.products, other.products) && + MessagesPigeonUtils.deepEquals(this.isAutoRenewing, other.isAutoRenewing) && + MessagesPigeonUtils.deepEquals(this.originalJson, other.originalJson) && + MessagesPigeonUtils.deepEquals(this.developerPayload, other.developerPayload) && + MessagesPigeonUtils.deepEquals(this.isAcknowledged, other.isAcknowledged) && + MessagesPigeonUtils.deepEquals(this.quantity, other.quantity) && + MessagesPigeonUtils.deepEquals(this.purchaseState, other.purchaseState) && + MessagesPigeonUtils.deepEquals(this.accountIdentifiers, other.accountIdentifiers) && + MessagesPigeonUtils.deepEquals(this.pendingPurchaseUpdate, other.pendingPurchaseUpdate) } override fun hashCode(): Int { @@ -907,11 +996,7 @@ data class PlatformPurchase ( * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformPendingPurchaseUpdate ( - val products: List, - val purchaseToken: String -) - { +data class PlatformPendingPurchaseUpdate(val products: List, val purchaseToken: String) { companion object { fun fromList(pigeonVar_list: List): PlatformPendingPurchaseUpdate { val products = pigeonVar_list[0] as List @@ -919,12 +1004,14 @@ data class PlatformPendingPurchaseUpdate ( return PlatformPendingPurchaseUpdate(products, purchaseToken) } } + fun toList(): List { return listOf( - products, - purchaseToken, + products, + purchaseToken, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -933,7 +1020,8 @@ data class PlatformPendingPurchaseUpdate ( return true } val other = other as PlatformPendingPurchaseUpdate - return MessagesPigeonUtils.deepEquals(this.products, other.products) && MessagesPigeonUtils.deepEquals(this.purchaseToken, other.purchaseToken) + return MessagesPigeonUtils.deepEquals(this.products, other.products) && + MessagesPigeonUtils.deepEquals(this.purchaseToken, other.purchaseToken) } override fun hashCode(): Int { @@ -951,16 +1039,15 @@ data class PlatformPendingPurchaseUpdate ( * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformPurchaseHistoryRecord ( - val quantity: Long, - val purchaseTime: Long, - val developerPayload: String? = null, - val originalJson: String, - val purchaseToken: String, - val signature: String, - val products: List -) - { +data class PlatformPurchaseHistoryRecord( + val quantity: Long, + val purchaseTime: Long, + val developerPayload: String? = null, + val originalJson: String, + val purchaseToken: String, + val signature: String, + val products: List +) { companion object { fun fromList(pigeonVar_list: List): PlatformPurchaseHistoryRecord { val quantity = pigeonVar_list[0] as Long @@ -970,20 +1057,29 @@ data class PlatformPurchaseHistoryRecord ( val purchaseToken = pigeonVar_list[4] as String val signature = pigeonVar_list[5] as String val products = pigeonVar_list[6] as List - return PlatformPurchaseHistoryRecord(quantity, purchaseTime, developerPayload, originalJson, purchaseToken, signature, products) + return PlatformPurchaseHistoryRecord( + quantity, + purchaseTime, + developerPayload, + originalJson, + purchaseToken, + signature, + products) } } + fun toList(): List { return listOf( - quantity, - purchaseTime, - developerPayload, - originalJson, - purchaseToken, - signature, - products, + quantity, + purchaseTime, + developerPayload, + originalJson, + purchaseToken, + signature, + products, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -992,7 +1088,13 @@ data class PlatformPurchaseHistoryRecord ( return true } val other = other as PlatformPurchaseHistoryRecord - return MessagesPigeonUtils.deepEquals(this.quantity, other.quantity) && MessagesPigeonUtils.deepEquals(this.purchaseTime, other.purchaseTime) && MessagesPigeonUtils.deepEquals(this.developerPayload, other.developerPayload) && MessagesPigeonUtils.deepEquals(this.originalJson, other.originalJson) && MessagesPigeonUtils.deepEquals(this.purchaseToken, other.purchaseToken) && MessagesPigeonUtils.deepEquals(this.signature, other.signature) && MessagesPigeonUtils.deepEquals(this.products, other.products) + return MessagesPigeonUtils.deepEquals(this.quantity, other.quantity) && + MessagesPigeonUtils.deepEquals(this.purchaseTime, other.purchaseTime) && + MessagesPigeonUtils.deepEquals(this.developerPayload, other.developerPayload) && + MessagesPigeonUtils.deepEquals(this.originalJson, other.originalJson) && + MessagesPigeonUtils.deepEquals(this.purchaseToken, other.purchaseToken) && + MessagesPigeonUtils.deepEquals(this.signature, other.signature) && + MessagesPigeonUtils.deepEquals(this.products, other.products) } override fun hashCode(): Int { @@ -1009,16 +1111,15 @@ data class PlatformPurchaseHistoryRecord ( } /** - * Pigeon version of PurchasesHistoryResult, which contains the components of - * the Java PurchaseHistoryResponseListener callback. + * Pigeon version of PurchasesHistoryResult, which contains the components of the Java + * PurchaseHistoryResponseListener callback. * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformPurchaseHistoryResponse ( - val billingResult: PlatformBillingResult, - val purchases: List -) - { +data class PlatformPurchaseHistoryResponse( + val billingResult: PlatformBillingResult, + val purchases: List +) { companion object { fun fromList(pigeonVar_list: List): PlatformPurchaseHistoryResponse { val billingResult = pigeonVar_list[0] as PlatformBillingResult @@ -1026,12 +1127,14 @@ data class PlatformPurchaseHistoryResponse ( return PlatformPurchaseHistoryResponse(billingResult, purchases) } } + fun toList(): List { return listOf( - billingResult, - purchases, + billingResult, + purchases, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -1040,7 +1143,8 @@ data class PlatformPurchaseHistoryResponse ( return true } val other = other as PlatformPurchaseHistoryResponse - return MessagesPigeonUtils.deepEquals(this.billingResult, other.billingResult) && MessagesPigeonUtils.deepEquals(this.purchases, other.purchases) + return MessagesPigeonUtils.deepEquals(this.billingResult, other.billingResult) && + MessagesPigeonUtils.deepEquals(this.purchases, other.purchases) } override fun hashCode(): Int { @@ -1052,16 +1156,15 @@ data class PlatformPurchaseHistoryResponse ( } /** - * Pigeon version of PurchasesResultWrapper, which contains the components of - * the Java PurchasesResponseListener callback. + * Pigeon version of PurchasesResultWrapper, which contains the components of the Java + * PurchasesResponseListener callback. * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformPurchasesResponse ( - val billingResult: PlatformBillingResult, - val purchases: List -) - { +data class PlatformPurchasesResponse( + val billingResult: PlatformBillingResult, + val purchases: List +) { companion object { fun fromList(pigeonVar_list: List): PlatformPurchasesResponse { val billingResult = pigeonVar_list[0] as PlatformBillingResult @@ -1069,12 +1172,14 @@ data class PlatformPurchasesResponse ( return PlatformPurchasesResponse(billingResult, purchases) } } + fun toList(): List { return listOf( - billingResult, - purchases, + billingResult, + purchases, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -1083,7 +1188,8 @@ data class PlatformPurchasesResponse ( return true } val other = other as PlatformPurchasesResponse - return MessagesPigeonUtils.deepEquals(this.billingResult, other.billingResult) && MessagesPigeonUtils.deepEquals(this.purchases, other.purchases) + return MessagesPigeonUtils.deepEquals(this.billingResult, other.billingResult) && + MessagesPigeonUtils.deepEquals(this.purchases, other.purchases) } override fun hashCode(): Int { @@ -1099,15 +1205,14 @@ data class PlatformPurchasesResponse ( * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformSubscriptionOfferDetails ( - val basePlanId: String, - val offerId: String? = null, - val offerToken: String, - val offerTags: List, - val pricingPhases: List, - val installmentPlanDetails: PlatformInstallmentPlanDetails? = null -) - { +data class PlatformSubscriptionOfferDetails( + val basePlanId: String, + val offerId: String? = null, + val offerToken: String, + val offerTags: List, + val pricingPhases: List, + val installmentPlanDetails: PlatformInstallmentPlanDetails? = null +) { companion object { fun fromList(pigeonVar_list: List): PlatformSubscriptionOfferDetails { val basePlanId = pigeonVar_list[0] as String @@ -1116,19 +1221,22 @@ data class PlatformSubscriptionOfferDetails ( val offerTags = pigeonVar_list[3] as List val pricingPhases = pigeonVar_list[4] as List val installmentPlanDetails = pigeonVar_list[5] as PlatformInstallmentPlanDetails? - return PlatformSubscriptionOfferDetails(basePlanId, offerId, offerToken, offerTags, pricingPhases, installmentPlanDetails) + return PlatformSubscriptionOfferDetails( + basePlanId, offerId, offerToken, offerTags, pricingPhases, installmentPlanDetails) } } + fun toList(): List { return listOf( - basePlanId, - offerId, - offerToken, - offerTags, - pricingPhases, - installmentPlanDetails, + basePlanId, + offerId, + offerToken, + offerTags, + pricingPhases, + installmentPlanDetails, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -1137,7 +1245,12 @@ data class PlatformSubscriptionOfferDetails ( return true } val other = other as PlatformSubscriptionOfferDetails - return MessagesPigeonUtils.deepEquals(this.basePlanId, other.basePlanId) && MessagesPigeonUtils.deepEquals(this.offerId, other.offerId) && MessagesPigeonUtils.deepEquals(this.offerToken, other.offerToken) && MessagesPigeonUtils.deepEquals(this.offerTags, other.offerTags) && MessagesPigeonUtils.deepEquals(this.pricingPhases, other.pricingPhases) && MessagesPigeonUtils.deepEquals(this.installmentPlanDetails, other.installmentPlanDetails) + return MessagesPigeonUtils.deepEquals(this.basePlanId, other.basePlanId) && + MessagesPigeonUtils.deepEquals(this.offerId, other.offerId) && + MessagesPigeonUtils.deepEquals(this.offerToken, other.offerToken) && + MessagesPigeonUtils.deepEquals(this.offerTags, other.offerTags) && + MessagesPigeonUtils.deepEquals(this.pricingPhases, other.pricingPhases) && + MessagesPigeonUtils.deepEquals(this.installmentPlanDetails, other.installmentPlanDetails) } override fun hashCode(): Int { @@ -1157,27 +1270,29 @@ data class PlatformSubscriptionOfferDetails ( * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformUserChoiceDetails ( - val originalExternalTransactionId: String? = null, - val externalTransactionToken: String, - val products: List -) - { +data class PlatformUserChoiceDetails( + val originalExternalTransactionId: String? = null, + val externalTransactionToken: String, + val products: List +) { companion object { fun fromList(pigeonVar_list: List): PlatformUserChoiceDetails { val originalExternalTransactionId = pigeonVar_list[0] as String? val externalTransactionToken = pigeonVar_list[1] as String val products = pigeonVar_list[2] as List - return PlatformUserChoiceDetails(originalExternalTransactionId, externalTransactionToken, products) + return PlatformUserChoiceDetails( + originalExternalTransactionId, externalTransactionToken, products) } } + fun toList(): List { return listOf( - originalExternalTransactionId, - externalTransactionToken, - products, + originalExternalTransactionId, + externalTransactionToken, + products, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -1186,7 +1301,11 @@ data class PlatformUserChoiceDetails ( return true } val other = other as PlatformUserChoiceDetails - return MessagesPigeonUtils.deepEquals(this.originalExternalTransactionId, other.originalExternalTransactionId) && MessagesPigeonUtils.deepEquals(this.externalTransactionToken, other.externalTransactionToken) && MessagesPigeonUtils.deepEquals(this.products, other.products) + return MessagesPigeonUtils.deepEquals( + this.originalExternalTransactionId, other.originalExternalTransactionId) && + MessagesPigeonUtils.deepEquals( + this.externalTransactionToken, other.externalTransactionToken) && + MessagesPigeonUtils.deepEquals(this.products, other.products) } override fun hashCode(): Int { @@ -1203,12 +1322,11 @@ data class PlatformUserChoiceDetails ( * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformUserChoiceProduct ( - val id: String, - val offerToken: String? = null, - val type: PlatformProductType -) - { +data class PlatformUserChoiceProduct( + val id: String, + val offerToken: String? = null, + val type: PlatformProductType +) { companion object { fun fromList(pigeonVar_list: List): PlatformUserChoiceProduct { val id = pigeonVar_list[0] as String @@ -1217,13 +1335,15 @@ data class PlatformUserChoiceProduct ( return PlatformUserChoiceProduct(id, offerToken, type) } } + fun toList(): List { return listOf( - id, - offerToken, - type, + id, + offerToken, + type, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -1232,7 +1352,9 @@ data class PlatformUserChoiceProduct ( return true } val other = other as PlatformUserChoiceProduct - return MessagesPigeonUtils.deepEquals(this.id, other.id) && MessagesPigeonUtils.deepEquals(this.offerToken, other.offerToken) && MessagesPigeonUtils.deepEquals(this.type, other.type) + return MessagesPigeonUtils.deepEquals(this.id, other.id) && + MessagesPigeonUtils.deepEquals(this.offerToken, other.offerToken) && + MessagesPigeonUtils.deepEquals(this.type, other.type) } override fun hashCode(): Int { @@ -1250,24 +1372,26 @@ data class PlatformUserChoiceProduct ( * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformInstallmentPlanDetails ( - val commitmentPaymentsCount: Long, - val subsequentCommitmentPaymentsCount: Long -) - { +data class PlatformInstallmentPlanDetails( + val commitmentPaymentsCount: Long, + val subsequentCommitmentPaymentsCount: Long +) { companion object { fun fromList(pigeonVar_list: List): PlatformInstallmentPlanDetails { val commitmentPaymentsCount = pigeonVar_list[0] as Long val subsequentCommitmentPaymentsCount = pigeonVar_list[1] as Long - return PlatformInstallmentPlanDetails(commitmentPaymentsCount, subsequentCommitmentPaymentsCount) + return PlatformInstallmentPlanDetails( + commitmentPaymentsCount, subsequentCommitmentPaymentsCount) } } + fun toList(): List { return listOf( - commitmentPaymentsCount, - subsequentCommitmentPaymentsCount, + commitmentPaymentsCount, + subsequentCommitmentPaymentsCount, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -1276,7 +1400,10 @@ data class PlatformInstallmentPlanDetails ( return true } val other = other as PlatformInstallmentPlanDetails - return MessagesPigeonUtils.deepEquals(this.commitmentPaymentsCount, other.commitmentPaymentsCount) && MessagesPigeonUtils.deepEquals(this.subsequentCommitmentPaymentsCount, other.subsequentCommitmentPaymentsCount) + return MessagesPigeonUtils.deepEquals( + this.commitmentPaymentsCount, other.commitmentPaymentsCount) && + MessagesPigeonUtils.deepEquals( + this.subsequentCommitmentPaymentsCount, other.subsequentCommitmentPaymentsCount) } override fun hashCode(): Int { @@ -1292,21 +1419,20 @@ data class PlatformInstallmentPlanDetails ( * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformPendingPurchasesParams ( - val enablePrepaidPlans: Boolean -) - { +data class PlatformPendingPurchasesParams(val enablePrepaidPlans: Boolean) { companion object { fun fromList(pigeonVar_list: List): PlatformPendingPurchasesParams { val enablePrepaidPlans = pigeonVar_list[0] as Boolean return PlatformPendingPurchasesParams(enablePrepaidPlans) } } + fun toList(): List { return listOf( - enablePrepaidPlans, + enablePrepaidPlans, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -1326,25 +1452,25 @@ data class PlatformPendingPurchasesParams ( } /** - * Pigeon version of Java [UnfetchedProduct](https://developer.android.com/reference/com/android/billingclient/api/QueryProductDetailsParams.Product). + * Pigeon version of Java + * [UnfetchedProduct](https://developer.android.com/reference/com/android/billingclient/api/QueryProductDetailsParams.Product). * * Generated class from Pigeon that represents data sent in messages. */ -data class PlatformUnfetchedProduct ( - val productId: String -) - { +data class PlatformUnfetchedProduct(val productId: String) { companion object { fun fromList(pigeonVar_list: List): PlatformUnfetchedProduct { val productId = pigeonVar_list[0] as String return PlatformUnfetchedProduct(productId) } } + fun toList(): List { return listOf( - productId, + productId, ) } + override fun equals(other: Any?): Boolean { if (other == null || other.javaClass != javaClass) { return false @@ -1362,58 +1488,39 @@ data class PlatformUnfetchedProduct ( return result } } + private open class MessagesPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 129.toByte() -> { - return (readValue(buffer) as Long?)?.let { - PlatformBillingResponse.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { PlatformBillingResponse.ofRaw(it.toInt()) } } 130.toByte() -> { - return (readValue(buffer) as Long?)?.let { - PlatformReplacementMode.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { PlatformReplacementMode.ofRaw(it.toInt()) } } 131.toByte() -> { - return (readValue(buffer) as Long?)?.let { - PlatformProductType.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { PlatformProductType.ofRaw(it.toInt()) } } 132.toByte() -> { - return (readValue(buffer) as Long?)?.let { - PlatformBillingChoiceMode.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { PlatformBillingChoiceMode.ofRaw(it.toInt()) } } 133.toByte() -> { - return (readValue(buffer) as Long?)?.let { - PlatformBillingClientFeature.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { PlatformBillingClientFeature.ofRaw(it.toInt()) } } 134.toByte() -> { - return (readValue(buffer) as Long?)?.let { - PlatformPurchaseState.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { PlatformPurchaseState.ofRaw(it.toInt()) } } 135.toByte() -> { - return (readValue(buffer) as Long?)?.let { - PlatformRecurrenceMode.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { PlatformRecurrenceMode.ofRaw(it.toInt()) } } 136.toByte() -> { - return (readValue(buffer) as? List)?.let { - PlatformQueryProduct.fromList(it) - } + return (readValue(buffer) as? List)?.let { PlatformQueryProduct.fromList(it) } } 137.toByte() -> { - return (readValue(buffer) as? List)?.let { - PlatformAccountIdentifiers.fromList(it) - } + return (readValue(buffer) as? List)?.let { PlatformAccountIdentifiers.fromList(it) } } 138.toByte() -> { - return (readValue(buffer) as? List)?.let { - PlatformBillingResult.fromList(it) - } + return (readValue(buffer) as? List)?.let { PlatformBillingResult.fromList(it) } } 139.toByte() -> { return (readValue(buffer) as? List)?.let { @@ -1421,9 +1528,7 @@ private open class MessagesPigeonCodec : StandardMessageCodec() { } } 140.toByte() -> { - return (readValue(buffer) as? List)?.let { - PlatformProductDetails.fromList(it) - } + return (readValue(buffer) as? List)?.let { PlatformProductDetails.fromList(it) } } 141.toByte() -> { return (readValue(buffer) as? List)?.let { @@ -1441,19 +1546,13 @@ private open class MessagesPigeonCodec : StandardMessageCodec() { } } 144.toByte() -> { - return (readValue(buffer) as? List)?.let { - PlatformBillingFlowParams.fromList(it) - } + return (readValue(buffer) as? List)?.let { PlatformBillingFlowParams.fromList(it) } } 145.toByte() -> { - return (readValue(buffer) as? List)?.let { - PlatformPricingPhase.fromList(it) - } + return (readValue(buffer) as? List)?.let { PlatformPricingPhase.fromList(it) } } 146.toByte() -> { - return (readValue(buffer) as? List)?.let { - PlatformPurchase.fromList(it) - } + return (readValue(buffer) as? List)?.let { PlatformPurchase.fromList(it) } } 147.toByte() -> { return (readValue(buffer) as? List)?.let { @@ -1471,9 +1570,7 @@ private open class MessagesPigeonCodec : StandardMessageCodec() { } } 150.toByte() -> { - return (readValue(buffer) as? List)?.let { - PlatformPurchasesResponse.fromList(it) - } + return (readValue(buffer) as? List)?.let { PlatformPurchasesResponse.fromList(it) } } 151.toByte() -> { return (readValue(buffer) as? List)?.let { @@ -1481,14 +1578,10 @@ private open class MessagesPigeonCodec : StandardMessageCodec() { } } 152.toByte() -> { - return (readValue(buffer) as? List)?.let { - PlatformUserChoiceDetails.fromList(it) - } + return (readValue(buffer) as? List)?.let { PlatformUserChoiceDetails.fromList(it) } } 153.toByte() -> { - return (readValue(buffer) as? List)?.let { - PlatformUserChoiceProduct.fromList(it) - } + return (readValue(buffer) as? List)?.let { PlatformUserChoiceProduct.fromList(it) } } 154.toByte() -> { return (readValue(buffer) as? List)?.let { @@ -1501,14 +1594,13 @@ private open class MessagesPigeonCodec : StandardMessageCodec() { } } 156.toByte() -> { - return (readValue(buffer) as? List)?.let { - PlatformUnfetchedProduct.fromList(it) - } + return (readValue(buffer) as? List)?.let { PlatformUnfetchedProduct.fromList(it) } } else -> super.readValueOfType(type, buffer) } } - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { when (value) { is PlatformBillingResponse -> { stream.write(129) @@ -1627,54 +1719,88 @@ private open class MessagesPigeonCodec : StandardMessageCodec() { } } - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface InAppPurchaseApi { /** Wraps BillingClient#isReady. */ fun isReady(): Boolean /** Wraps BillingClient#startConnection(BillingClientStateListener). */ - fun startConnection(callbackHandle: Long, billingMode: PlatformBillingChoiceMode, pendingPurchasesParams: PlatformPendingPurchasesParams, callback: (Result) -> Unit) + fun startConnection( + callbackHandle: Long, + billingMode: PlatformBillingChoiceMode, + pendingPurchasesParams: PlatformPendingPurchasesParams, + callback: (Result) -> Unit + ) /** Wraps BillingClient#endConnection(BillingClientStateListener). */ fun endConnection() - /** Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, BillingConfigResponseListener). */ + /** + * Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, + * BillingConfigResponseListener). + */ fun getBillingConfigAsync(callback: (Result) -> Unit) /** Wraps BillingClient#launchBillingFlow(Activity, BillingFlowParams). */ fun launchBillingFlow(params: PlatformBillingFlowParams): PlatformBillingResult - /** Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, AcknowledgePurchaseResponseListener). */ + /** + * Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, + * AcknowledgePurchaseResponseListener). + */ fun acknowledgePurchase(purchaseToken: String, callback: (Result) -> Unit) /** Wraps BillingClient#consumeAsync(ConsumeParams, ConsumeResponseListener). */ fun consumeAsync(purchaseToken: String, callback: (Result) -> Unit) /** Wraps BillingClient#queryPurchasesAsync(QueryPurchaseParams, PurchaseResponseListener). */ - fun queryPurchasesAsync(productType: PlatformProductType, callback: (Result) -> Unit) - /** Wraps BillingClient#queryProductDetailsAsync(QueryProductDetailsParams, ProductDetailsResponseListener). */ - fun queryProductDetailsAsync(products: List, callback: (Result) -> Unit) + fun queryPurchasesAsync( + productType: PlatformProductType, + callback: (Result) -> Unit + ) + /** + * Wraps BillingClient#queryProductDetailsAsync(QueryProductDetailsParams, + * ProductDetailsResponseListener). + */ + fun queryProductDetailsAsync( + products: List, + callback: (Result) -> Unit + ) /** Wraps BillingClient#isFeatureSupported(String). */ fun isFeatureSupported(feature: PlatformBillingClientFeature): Boolean /** Wraps BillingClient#isAlternativeBillingOnlyAvailableAsync(). */ fun isAlternativeBillingOnlyAvailableAsync(callback: (Result) -> Unit) /** Wraps BillingClient#showAlternativeBillingOnlyInformationDialog(). */ fun showAlternativeBillingOnlyInformationDialog(callback: (Result) -> Unit) - /** Wraps BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). */ - fun createAlternativeBillingOnlyReportingDetailsAsync(callback: (Result) -> Unit) + /** + * Wraps + * BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). + */ + fun createAlternativeBillingOnlyReportingDetailsAsync( + callback: (Result) -> Unit + ) companion object { /** The codec used by InAppPurchaseApi. */ - val codec: MessageCodec by lazy { - MessagesPigeonCodec() - } - /** Sets up an instance of `InAppPurchaseApi` to handle messages through the `binaryMessenger`. */ + val codec: MessageCodec by lazy { MessagesPigeonCodec() } + /** + * Sets up an instance of `InAppPurchaseApi` to handle messages through the `binaryMessenger`. + */ @JvmOverloads - fun setUp(binaryMessenger: BinaryMessenger, api: InAppPurchaseApi?, messageChannelSuffix: String = "") { - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + fun setUp( + binaryMessenger: BinaryMessenger, + api: InAppPurchaseApi?, + messageChannelSuffix: String = "" + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { _, reply -> - val wrapped: List = try { - listOf(api.isReady()) - } catch (exception: Throwable) { - MessagesPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.isReady()) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1682,14 +1808,19 @@ interface InAppPurchaseApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val callbackHandleArg = args[0] as Long val billingModeArg = args[1] as PlatformBillingChoiceMode val pendingPurchasesParamsArg = args[2] as PlatformPendingPurchasesParams - api.startConnection(callbackHandleArg, billingModeArg, pendingPurchasesParamsArg) { result: Result -> + api.startConnection(callbackHandleArg, billingModeArg, pendingPurchasesParamsArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(MessagesPigeonUtils.wrapError(error)) @@ -1704,15 +1835,20 @@ interface InAppPurchaseApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { _, reply -> - val wrapped: List = try { - api.endConnection() - listOf(null) - } catch (exception: Throwable) { - MessagesPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.endConnection() + listOf(null) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1720,10 +1856,14 @@ interface InAppPurchaseApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { _, reply -> - api.getBillingConfigAsync{ result: Result -> + api.getBillingConfigAsync { result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(MessagesPigeonUtils.wrapError(error)) @@ -1738,16 +1878,21 @@ interface InAppPurchaseApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val paramsArg = args[0] as PlatformBillingFlowParams - val wrapped: List = try { - listOf(api.launchBillingFlow(paramsArg)) - } catch (exception: Throwable) { - MessagesPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.launchBillingFlow(paramsArg)) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1755,7 +1900,11 @@ interface InAppPurchaseApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1775,7 +1924,11 @@ interface InAppPurchaseApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1795,7 +1948,11 @@ interface InAppPurchaseApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1815,12 +1972,17 @@ interface InAppPurchaseApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val productsArg = args[0] as List - api.queryProductDetailsAsync(productsArg) { result: Result -> + api.queryProductDetailsAsync(productsArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(MessagesPigeonUtils.wrapError(error)) @@ -1835,16 +1997,21 @@ interface InAppPurchaseApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val featureArg = args[0] as PlatformBillingClientFeature - val wrapped: List = try { - listOf(api.isFeatureSupported(featureArg)) - } catch (exception: Throwable) { - MessagesPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.isFeatureSupported(featureArg)) + } catch (exception: Throwable) { + MessagesPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1852,10 +2019,14 @@ interface InAppPurchaseApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { _, reply -> - api.isAlternativeBillingOnlyAvailableAsync{ result: Result -> + api.isAlternativeBillingOnlyAvailableAsync { result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(MessagesPigeonUtils.wrapError(error)) @@ -1870,10 +2041,15 @@ interface InAppPurchaseApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { _, reply -> - api.showAlternativeBillingOnlyInformationDialog{ result: Result -> + api.showAlternativeBillingOnlyInformationDialog { result: Result + -> val error = result.exceptionOrNull() if (error != null) { reply.reply(MessagesPigeonUtils.wrapError(error)) @@ -1888,10 +2064,15 @@ interface InAppPurchaseApi { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync$separatedMessageChannelSuffix", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync$separatedMessageChannelSuffix", + codec) if (api != null) { channel.setMessageHandler { _, reply -> - api.createAlternativeBillingOnlyReportingDetailsAsync{ result: Result -> + api.createAlternativeBillingOnlyReportingDetailsAsync { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(MessagesPigeonUtils.wrapError(error)) @@ -1909,18 +2090,20 @@ interface InAppPurchaseApi { } } /** Generated class from Pigeon that represents Flutter messages that can be called from Kotlin. */ -class InAppPurchaseCallbackApi(private val binaryMessenger: BinaryMessenger, private val messageChannelSuffix: String = "") { +class InAppPurchaseCallbackApi( + private val binaryMessenger: BinaryMessenger, + private val messageChannelSuffix: String = "" +) { companion object { /** The codec used by InAppPurchaseCallbackApi. */ - val codec: MessageCodec by lazy { - MessagesPigeonCodec() - } + val codec: MessageCodec by lazy { MessagesPigeonCodec() } } /** Called for `BillingClientStateListener#onBillingServiceDisconnected()`. */ - fun onBillingServiceDisconnected(callbackHandleArg: Long, callback: (Result) -> Unit) -{ - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" - val channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected$separatedMessageChannelSuffix" + fun onBillingServiceDisconnected(callbackHandleArg: Long, callback: (Result) -> Unit) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected$separatedMessageChannelSuffix" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(callbackHandleArg)) { if (it is List<*>) { @@ -1931,14 +2114,15 @@ class InAppPurchaseCallbackApi(private val binaryMessenger: BinaryMessenger, pri } } else { callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) - } + } } } /** Called for `PurchasesUpdatedListener#onPurchasesUpdated(BillingResult, List)`. */ - fun onPurchasesUpdated(updateArg: PlatformPurchasesResponse, callback: (Result) -> Unit) -{ - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" - val channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated$separatedMessageChannelSuffix" + fun onPurchasesUpdated(updateArg: PlatformPurchasesResponse, callback: (Result) -> Unit) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated$separatedMessageChannelSuffix" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(updateArg)) { if (it is List<*>) { @@ -1949,14 +2133,18 @@ class InAppPurchaseCallbackApi(private val binaryMessenger: BinaryMessenger, pri } } else { callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) - } + } } } /** Called for `UserChoiceBillingListener#userSelectedAlternativeBilling(UserChoiceDetails)`. */ - fun userSelectedalternativeBilling(detailsArg: PlatformUserChoiceDetails, callback: (Result) -> Unit) -{ - val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" - val channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling$separatedMessageChannelSuffix" + fun userSelectedalternativeBilling( + detailsArg: PlatformUserChoiceDetails, + callback: (Result) -> Unit + ) { + val separatedMessageChannelSuffix = + if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling$separatedMessageChannelSuffix" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(detailsArg)) { if (it is List<*>) { @@ -1967,7 +2155,7 @@ class InAppPurchaseCallbackApi(private val binaryMessenger: BinaryMessenger, pri } } else { callback(Result.failure(MessagesPigeonUtils.createConnectionError(channelName))) - } + } } } } diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/kotlin/io/flutter/plugins/inapppurchase/Translator.kt b/packages/in_app_purchase/in_app_purchase_android/android/src/main/kotlin/io/flutter/plugins/inapppurchase/Translator.kt index 8f9b5e757794..c793dee0e3a8 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/kotlin/io/flutter/plugins/inapppurchase/Translator.kt +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/kotlin/io/flutter/plugins/inapppurchase/Translator.kt @@ -27,7 +27,8 @@ fun fromProductDetail(detail: ProductDetails): PlatformProductDetails { title = detail.title, oneTimePurchaseOfferDetails = fromOneTimePurchaseOfferDetails(detail.oneTimePurchaseOfferDetails), - oneTimePurchaseOfferDetailsList = fromOneTimePurchaseOfferDetailsList(detail.oneTimePurchaseOfferDetailsList), + oneTimePurchaseOfferDetailsList = + fromOneTimePurchaseOfferDetailsList(detail.oneTimePurchaseOfferDetailsList), subscriptionOfferDetails = fromSubscriptionOfferDetailsList(detail.subscriptionOfferDetails)) } @@ -81,8 +82,8 @@ fun fromOneTimePurchaseOfferDetails( fun fromOneTimePurchaseOfferDetailsList( oneTimePurchaseOfferDetailsList: List? ): List? { - // Using mapNotNull ensures the resulting list doesn't contain nulls - return oneTimePurchaseOfferDetailsList?.mapNotNull { fromOneTimePurchaseOfferDetails(it) } + // Using mapNotNull ensures the resulting list doesn't contain nulls + return oneTimePurchaseOfferDetailsList?.mapNotNull { fromOneTimePurchaseOfferDetails(it) } } fun fromSubscriptionOfferDetailsList( @@ -216,15 +217,14 @@ fun fromPurchaseHistoryRecordList( } fun fromUnfetchedProductList( - unfetchedProductList: List? - ): List { - return unfetchedProductList?.map { fromUnfetchedProduct(it) } ?: emptyList() - } + unfetchedProductList: List? +): List { + return unfetchedProductList?.map { fromUnfetchedProduct(it) } ?: emptyList() +} fun fromUnfetchedProduct(unfetchedProduct: UnfetchedProduct): PlatformUnfetchedProduct { - return PlatformUnfetchedProduct(productId = unfetchedProduct.productId) - } - + return PlatformUnfetchedProduct(productId = unfetchedProduct.productId) +} fun fromBillingResult(billingResult: BillingResult): PlatformBillingResult { return PlatformBillingResult( diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/MethodCallHandlerTest.java b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/MethodCallHandlerTest.java index 6594702a9921..ce785007756b 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/MethodCallHandlerTest.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/MethodCallHandlerTest.java @@ -82,10 +82,10 @@ public class MethodCallHandlerTest { TestResult platformAlternativeBillingOnlyReportingDetailsResult = new TestResult<>(); - TestResult platformBillingConfigResult = new TestResult<>(); - TestResult platformBillingResult = new TestResult<>(); - TestResult platformProductDetailsResult = new TestResult<>(); - TestResult platformPurchasesResult = new TestResult<>(); + TestResult platformBillingConfigResult = new TestResult<>(); + TestResult platformBillingResult = new TestResult<>(); + TestResult platformProductDetailsResult = new TestResult<>(); + TestResult platformPurchasesResult = new TestResult<>(); @Mock Activity activity; @Mock Context context; @@ -539,18 +539,18 @@ public void queryProductDetailsAsync() { List productDetailsResponse = singletonList(buildProductDetails("foo")); BillingResult billingResult = buildBillingResult(); - QueryProductDetailsResult mockProductDetailsResult = mock(QueryProductDetailsResult.class); - when(mockProductDetailsResult.getProductDetailsList()).thenReturn(productDetailsResponse); - when(mockProductDetailsResult.getUnfetchedProductList()) - .thenReturn(java.util.Collections.emptyList()); - - listenerCaptor.getValue().onProductDetailsResponse(billingResult, mockProductDetailsResult); - - assertTrue(platformProductDetailsResult.called); - PlatformProductDetailsResponse resultData = platformProductDetailsResult.result.getOrNull(); - assertResultsMatch(resultData.getBillingResult(), billingResult); - assertDetailListsMatch(productDetailsResponse, resultData.getProductDetails()); - assertTrue(resultData.getUnfetchedProductList().isEmpty()); + QueryProductDetailsResult mockProductDetailsResult = mock(QueryProductDetailsResult.class); + when(mockProductDetailsResult.getProductDetailsList()).thenReturn(productDetailsResponse); + when(mockProductDetailsResult.getUnfetchedProductList()) + .thenReturn(java.util.Collections.emptyList()); + + listenerCaptor.getValue().onProductDetailsResponse(billingResult, mockProductDetailsResult); + + assertTrue(platformProductDetailsResult.called); + PlatformProductDetailsResponse resultData = platformProductDetailsResult.result.getOrNull(); + assertResultsMatch(resultData.getBillingResult(), billingResult); + assertDetailListsMatch(productDetailsResponse, resultData.getProductDetails()); + assertTrue(resultData.getUnfetchedProductList().isEmpty()); assertResultsMatch(resultData.getBillingResult(), billingResult); assertDetailListsMatch(productDetailsResponse, resultData.getProductDetails()); assertTrue(resultData.getUnfetchedProductList().isEmpty()); diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/messages.g.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/messages.g.dart index 8bd6cbed9fc0..21889b84ebb0 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/messages.g.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/messages.g.dart @@ -13,9 +13,9 @@ import 'package:flutter/services.dart'; import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; Object? _extractReplyValueOrThrow( - List? replyList, - String channelName, { - required bool isNullValid, + List? replyList, + String channelName, { + required bool isNullValid, }) { if (replyList == null) { throw PlatformException( @@ -37,8 +37,11 @@ Object? _extractReplyValueOrThrow( return replyList.firstOrNull; } - -List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({ + Object? result, + PlatformException? error, + bool empty = false, +}) { if (empty) { return []; } @@ -47,6 +50,7 @@ List wrapResponse({Object? result, PlatformException? error, bool empty } return [error.code, error.message, error.details]; } + bool _deepEquals(Object? a, Object? b) { if (identical(a, b)) { return true; @@ -59,8 +63,9 @@ bool _deepEquals(Object? a, Object? b) { } if (a is List && b is List) { return a.length == b.length && - a.indexed - .every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1])); + a.indexed.every( + ((int, dynamic) item) => _deepEquals(item.$2, b[item.$1]), + ); } if (a is Map && b is Map) { if (a.length != b.length) { @@ -109,7 +114,6 @@ int _deepHash(Object? value) { return value.hashCode; } - /// Pigeon version of Java BillingClient.BillingResponseCode. enum PlatformBillingResponse { serviceTimeout, @@ -137,10 +141,7 @@ enum PlatformReplacementMode { } /// Pigeon version of Java BillingClient.ProductType. -enum PlatformProductType { - inapp, - subs, -} +enum PlatformProductType { inapp, subs } /// Pigeon version of billing_client_wrapper.dart's BillingChoiceMode. enum PlatformBillingChoiceMode { @@ -148,8 +149,10 @@ enum PlatformBillingChoiceMode { /// /// Default state. playBillingOnly, + /// Billing through app provided flow. alternativeBillingOnly, + /// Users can choose Play billing or alternative billing. userChoiceBilling, } @@ -167,39 +170,26 @@ enum PlatformBillingClientFeature { } /// Pigeon version of Java Purchase.PurchaseState. -enum PlatformPurchaseState { - unspecified, - purchased, - pending, -} +enum PlatformPurchaseState { unspecified, purchased, pending } /// Pigeon version of Java ProductDetails.RecurrenceMode. -enum PlatformRecurrenceMode { - finiteRecurring, - infiniteRecurring, - nonRecurring, -} +enum PlatformRecurrenceMode { finiteRecurring, infiniteRecurring, nonRecurring } /// Pigeon version of Java QueryProductDetailsParams.Product. class PlatformQueryProduct { - PlatformQueryProduct({ - required this.productId, - required this.productType, - }); + PlatformQueryProduct({required this.productId, required this.productType}); String productId; PlatformProductType productType; List _toList() { - return [ - productId, - productType, - ]; + return [productId, productType]; } Object encode() { - return _toList(); } + return _toList(); + } static PlatformQueryProduct decode(Object result) { result as List; @@ -218,7 +208,8 @@ class PlatformQueryProduct { if (identical(this, other)) { return true; } - return _deepEquals(productId, other.productId) && _deepEquals(productType, other.productType); + return _deepEquals(productId, other.productId) && + _deepEquals(productType, other.productType); } @override @@ -238,14 +229,12 @@ class PlatformAccountIdentifiers { String? obfuscatedProfileId; List _toList() { - return [ - obfuscatedAccountId, - obfuscatedProfileId, - ]; + return [obfuscatedAccountId, obfuscatedProfileId]; } Object encode() { - return _toList(); } + return _toList(); + } static PlatformAccountIdentifiers decode(Object result) { result as List; @@ -258,13 +247,15 @@ class PlatformAccountIdentifiers { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformAccountIdentifiers || other.runtimeType != runtimeType) { + if (other is! PlatformAccountIdentifiers || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(obfuscatedAccountId, other.obfuscatedAccountId) && _deepEquals(obfuscatedProfileId, other.obfuscatedProfileId); + return _deepEquals(obfuscatedAccountId, other.obfuscatedAccountId) && + _deepEquals(obfuscatedProfileId, other.obfuscatedProfileId); } @override @@ -287,15 +278,12 @@ class PlatformBillingResult { int subResponseCode; List _toList() { - return [ - responseCode, - debugMessage, - subResponseCode, - ]; + return [responseCode, debugMessage, subResponseCode]; } Object encode() { - return _toList(); } + return _toList(); + } static PlatformBillingResult decode(Object result) { result as List; @@ -315,7 +303,9 @@ class PlatformBillingResult { if (identical(this, other)) { return true; } - return _deepEquals(responseCode, other.responseCode) && _deepEquals(debugMessage, other.debugMessage) && _deepEquals(subResponseCode, other.subResponseCode); + return _deepEquals(responseCode, other.responseCode) && + _deepEquals(debugMessage, other.debugMessage) && + _deepEquals(subResponseCode, other.subResponseCode); } @override @@ -338,15 +328,12 @@ class PlatformOneTimePurchaseOfferDetails { String priceCurrencyCode; List _toList() { - return [ - priceAmountMicros, - formattedPrice, - priceCurrencyCode, - ]; + return [priceAmountMicros, formattedPrice, priceCurrencyCode]; } Object encode() { - return _toList(); } + return _toList(); + } static PlatformOneTimePurchaseOfferDetails decode(Object result) { result as List; @@ -360,13 +347,16 @@ class PlatformOneTimePurchaseOfferDetails { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformOneTimePurchaseOfferDetails || other.runtimeType != runtimeType) { + if (other is! PlatformOneTimePurchaseOfferDetails || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(priceAmountMicros, other.priceAmountMicros) && _deepEquals(formattedPrice, other.formattedPrice) && _deepEquals(priceCurrencyCode, other.priceCurrencyCode); + return _deepEquals(priceAmountMicros, other.priceAmountMicros) && + _deepEquals(formattedPrice, other.formattedPrice) && + _deepEquals(priceCurrencyCode, other.priceCurrencyCode); } @override @@ -417,7 +407,8 @@ class PlatformProductDetails { } Object encode() { - return _toList(); } + return _toList(); + } static PlatformProductDetails decode(Object result) { result as List; @@ -427,9 +418,12 @@ class PlatformProductDetails { productId: result[2]! as String, productType: result[3]! as PlatformProductType, title: result[4]! as String, - oneTimePurchaseOfferDetails: result[5] as PlatformOneTimePurchaseOfferDetails?, - oneTimePurchaseOfferDetailsList: (result[6] as List?)?.cast(), - subscriptionOfferDetails: (result[7] as List?)?.cast(), + oneTimePurchaseOfferDetails: + result[5] as PlatformOneTimePurchaseOfferDetails?, + oneTimePurchaseOfferDetailsList: (result[6] as List?) + ?.cast(), + subscriptionOfferDetails: (result[7] as List?) + ?.cast(), ); } @@ -442,7 +436,20 @@ class PlatformProductDetails { if (identical(this, other)) { return true; } - return _deepEquals(description, other.description) && _deepEquals(name, other.name) && _deepEquals(productId, other.productId) && _deepEquals(productType, other.productType) && _deepEquals(title, other.title) && _deepEquals(oneTimePurchaseOfferDetails, other.oneTimePurchaseOfferDetails) && _deepEquals(oneTimePurchaseOfferDetailsList, other.oneTimePurchaseOfferDetailsList) && _deepEquals(subscriptionOfferDetails, other.subscriptionOfferDetails); + return _deepEquals(description, other.description) && + _deepEquals(name, other.name) && + _deepEquals(productId, other.productId) && + _deepEquals(productType, other.productType) && + _deepEquals(title, other.title) && + _deepEquals( + oneTimePurchaseOfferDetails, + other.oneTimePurchaseOfferDetails, + ) && + _deepEquals( + oneTimePurchaseOfferDetailsList, + other.oneTimePurchaseOfferDetailsList, + ) && + _deepEquals(subscriptionOfferDetails, other.subscriptionOfferDetails); } @override @@ -466,35 +473,37 @@ class PlatformProductDetailsResponse { List unfetchedProductList; List _toList() { - return [ - billingResult, - productDetails, - unfetchedProductList, - ]; + return [billingResult, productDetails, unfetchedProductList]; } Object encode() { - return _toList(); } + return _toList(); + } static PlatformProductDetailsResponse decode(Object result) { result as List; return PlatformProductDetailsResponse( billingResult: result[0]! as PlatformBillingResult, - productDetails: (result[1]! as List).cast(), - unfetchedProductList: (result[2]! as List).cast(), + productDetails: (result[1]! as List) + .cast(), + unfetchedProductList: (result[2]! as List) + .cast(), ); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformProductDetailsResponse || other.runtimeType != runtimeType) { + if (other is! PlatformProductDetailsResponse || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(billingResult, other.billingResult) && _deepEquals(productDetails, other.productDetails) && _deepEquals(unfetchedProductList, other.unfetchedProductList); + return _deepEquals(billingResult, other.billingResult) && + _deepEquals(productDetails, other.productDetails) && + _deepEquals(unfetchedProductList, other.unfetchedProductList); } @override @@ -516,16 +525,16 @@ class PlatformAlternativeBillingOnlyReportingDetailsResponse { String externalTransactionToken; List _toList() { - return [ - billingResult, - externalTransactionToken, - ]; + return [billingResult, externalTransactionToken]; } Object encode() { - return _toList(); } + return _toList(); + } - static PlatformAlternativeBillingOnlyReportingDetailsResponse decode(Object result) { + static PlatformAlternativeBillingOnlyReportingDetailsResponse decode( + Object result, + ) { result as List; return PlatformAlternativeBillingOnlyReportingDetailsResponse( billingResult: result[0]! as PlatformBillingResult, @@ -536,13 +545,15 @@ class PlatformAlternativeBillingOnlyReportingDetailsResponse { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformAlternativeBillingOnlyReportingDetailsResponse || other.runtimeType != runtimeType) { + if (other is! PlatformAlternativeBillingOnlyReportingDetailsResponse || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(billingResult, other.billingResult) && _deepEquals(externalTransactionToken, other.externalTransactionToken); + return _deepEquals(billingResult, other.billingResult) && + _deepEquals(externalTransactionToken, other.externalTransactionToken); } @override @@ -563,14 +574,12 @@ class PlatformBillingConfigResponse { String countryCode; List _toList() { - return [ - billingResult, - countryCode, - ]; + return [billingResult, countryCode]; } Object encode() { - return _toList(); } + return _toList(); + } static PlatformBillingConfigResponse decode(Object result) { result as List; @@ -583,13 +592,15 @@ class PlatformBillingConfigResponse { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformBillingConfigResponse || other.runtimeType != runtimeType) { + if (other is! PlatformBillingConfigResponse || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(billingResult, other.billingResult) && _deepEquals(countryCode, other.countryCode); + return _deepEquals(billingResult, other.billingResult) && + _deepEquals(countryCode, other.countryCode); } @override @@ -636,7 +647,8 @@ class PlatformBillingFlowParams { } Object encode() { - return _toList(); } + return _toList(); + } static PlatformBillingFlowParams decode(Object result) { result as List; @@ -654,13 +666,20 @@ class PlatformBillingFlowParams { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformBillingFlowParams || other.runtimeType != runtimeType) { + if (other is! PlatformBillingFlowParams || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(product, other.product) && _deepEquals(replacementMode, other.replacementMode) && _deepEquals(offerToken, other.offerToken) && _deepEquals(accountId, other.accountId) && _deepEquals(obfuscatedProfileId, other.obfuscatedProfileId) && _deepEquals(oldProduct, other.oldProduct) && _deepEquals(purchaseToken, other.purchaseToken); + return _deepEquals(product, other.product) && + _deepEquals(replacementMode, other.replacementMode) && + _deepEquals(offerToken, other.offerToken) && + _deepEquals(accountId, other.accountId) && + _deepEquals(obfuscatedProfileId, other.obfuscatedProfileId) && + _deepEquals(oldProduct, other.oldProduct) && + _deepEquals(purchaseToken, other.purchaseToken); } @override @@ -703,7 +722,8 @@ class PlatformPricingPhase { } Object encode() { - return _toList(); } + return _toList(); + } static PlatformPricingPhase decode(Object result) { result as List; @@ -726,7 +746,12 @@ class PlatformPricingPhase { if (identical(this, other)) { return true; } - return _deepEquals(billingCycleCount, other.billingCycleCount) && _deepEquals(recurrenceMode, other.recurrenceMode) && _deepEquals(priceAmountMicros, other.priceAmountMicros) && _deepEquals(billingPeriod, other.billingPeriod) && _deepEquals(formattedPrice, other.formattedPrice) && _deepEquals(priceCurrencyCode, other.priceCurrencyCode); + return _deepEquals(billingCycleCount, other.billingCycleCount) && + _deepEquals(recurrenceMode, other.recurrenceMode) && + _deepEquals(priceAmountMicros, other.priceAmountMicros) && + _deepEquals(billingPeriod, other.billingPeriod) && + _deepEquals(formattedPrice, other.formattedPrice) && + _deepEquals(priceCurrencyCode, other.priceCurrencyCode); } @override @@ -803,7 +828,8 @@ class PlatformPurchase { } Object encode() { - return _toList(); } + return _toList(); + } static PlatformPurchase decode(Object result) { result as List; @@ -834,7 +860,20 @@ class PlatformPurchase { if (identical(this, other)) { return true; } - return _deepEquals(orderId, other.orderId) && _deepEquals(packageName, other.packageName) && _deepEquals(purchaseTime, other.purchaseTime) && _deepEquals(purchaseToken, other.purchaseToken) && _deepEquals(signature, other.signature) && _deepEquals(products, other.products) && _deepEquals(isAutoRenewing, other.isAutoRenewing) && _deepEquals(originalJson, other.originalJson) && _deepEquals(developerPayload, other.developerPayload) && _deepEquals(isAcknowledged, other.isAcknowledged) && _deepEquals(quantity, other.quantity) && _deepEquals(purchaseState, other.purchaseState) && _deepEquals(accountIdentifiers, other.accountIdentifiers) && _deepEquals(pendingPurchaseUpdate, other.pendingPurchaseUpdate); + return _deepEquals(orderId, other.orderId) && + _deepEquals(packageName, other.packageName) && + _deepEquals(purchaseTime, other.purchaseTime) && + _deepEquals(purchaseToken, other.purchaseToken) && + _deepEquals(signature, other.signature) && + _deepEquals(products, other.products) && + _deepEquals(isAutoRenewing, other.isAutoRenewing) && + _deepEquals(originalJson, other.originalJson) && + _deepEquals(developerPayload, other.developerPayload) && + _deepEquals(isAcknowledged, other.isAcknowledged) && + _deepEquals(quantity, other.quantity) && + _deepEquals(purchaseState, other.purchaseState) && + _deepEquals(accountIdentifiers, other.accountIdentifiers) && + _deepEquals(pendingPurchaseUpdate, other.pendingPurchaseUpdate); } @override @@ -856,14 +895,12 @@ class PlatformPendingPurchaseUpdate { String purchaseToken; List _toList() { - return [ - products, - purchaseToken, - ]; + return [products, purchaseToken]; } Object encode() { - return _toList(); } + return _toList(); + } static PlatformPendingPurchaseUpdate decode(Object result) { result as List; @@ -876,13 +913,15 @@ class PlatformPendingPurchaseUpdate { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformPendingPurchaseUpdate || other.runtimeType != runtimeType) { + if (other is! PlatformPendingPurchaseUpdate || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(products, other.products) && _deepEquals(purchaseToken, other.purchaseToken); + return _deepEquals(products, other.products) && + _deepEquals(purchaseToken, other.purchaseToken); } @override @@ -931,7 +970,8 @@ class PlatformPurchaseHistoryRecord { } Object encode() { - return _toList(); } + return _toList(); + } static PlatformPurchaseHistoryRecord decode(Object result) { result as List; @@ -949,13 +989,20 @@ class PlatformPurchaseHistoryRecord { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformPurchaseHistoryRecord || other.runtimeType != runtimeType) { + if (other is! PlatformPurchaseHistoryRecord || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(quantity, other.quantity) && _deepEquals(purchaseTime, other.purchaseTime) && _deepEquals(developerPayload, other.developerPayload) && _deepEquals(originalJson, other.originalJson) && _deepEquals(purchaseToken, other.purchaseToken) && _deepEquals(signature, other.signature) && _deepEquals(products, other.products); + return _deepEquals(quantity, other.quantity) && + _deepEquals(purchaseTime, other.purchaseTime) && + _deepEquals(developerPayload, other.developerPayload) && + _deepEquals(originalJson, other.originalJson) && + _deepEquals(purchaseToken, other.purchaseToken) && + _deepEquals(signature, other.signature) && + _deepEquals(products, other.products); } @override @@ -976,33 +1023,34 @@ class PlatformPurchaseHistoryResponse { List purchases; List _toList() { - return [ - billingResult, - purchases, - ]; + return [billingResult, purchases]; } Object encode() { - return _toList(); } + return _toList(); + } static PlatformPurchaseHistoryResponse decode(Object result) { result as List; return PlatformPurchaseHistoryResponse( billingResult: result[0]! as PlatformBillingResult, - purchases: (result[1]! as List).cast(), + purchases: (result[1]! as List) + .cast(), ); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformPurchaseHistoryResponse || other.runtimeType != runtimeType) { + if (other is! PlatformPurchaseHistoryResponse || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(billingResult, other.billingResult) && _deepEquals(purchases, other.purchases); + return _deepEquals(billingResult, other.billingResult) && + _deepEquals(purchases, other.purchases); } @override @@ -1023,14 +1071,12 @@ class PlatformPurchasesResponse { List purchases; List _toList() { - return [ - billingResult, - purchases, - ]; + return [billingResult, purchases]; } Object encode() { - return _toList(); } + return _toList(); + } static PlatformPurchasesResponse decode(Object result) { result as List; @@ -1043,13 +1089,15 @@ class PlatformPurchasesResponse { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformPurchasesResponse || other.runtimeType != runtimeType) { + if (other is! PlatformPurchasesResponse || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(billingResult, other.billingResult) && _deepEquals(purchases, other.purchases); + return _deepEquals(billingResult, other.billingResult) && + _deepEquals(purchases, other.purchases); } @override @@ -1092,7 +1140,8 @@ class PlatformSubscriptionOfferDetails { } Object encode() { - return _toList(); } + return _toList(); + } static PlatformSubscriptionOfferDetails decode(Object result) { result as List; @@ -1109,13 +1158,19 @@ class PlatformSubscriptionOfferDetails { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformSubscriptionOfferDetails || other.runtimeType != runtimeType) { + if (other is! PlatformSubscriptionOfferDetails || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(basePlanId, other.basePlanId) && _deepEquals(offerId, other.offerId) && _deepEquals(offerToken, other.offerToken) && _deepEquals(offerTags, other.offerTags) && _deepEquals(pricingPhases, other.pricingPhases) && _deepEquals(installmentPlanDetails, other.installmentPlanDetails); + return _deepEquals(basePlanId, other.basePlanId) && + _deepEquals(offerId, other.offerId) && + _deepEquals(offerToken, other.offerToken) && + _deepEquals(offerTags, other.offerTags) && + _deepEquals(pricingPhases, other.pricingPhases) && + _deepEquals(installmentPlanDetails, other.installmentPlanDetails); } @override @@ -1146,7 +1201,8 @@ class PlatformUserChoiceDetails { } Object encode() { - return _toList(); } + return _toList(); + } static PlatformUserChoiceDetails decode(Object result) { result as List; @@ -1160,13 +1216,19 @@ class PlatformUserChoiceDetails { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformUserChoiceDetails || other.runtimeType != runtimeType) { + if (other is! PlatformUserChoiceDetails || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(originalExternalTransactionId, other.originalExternalTransactionId) && _deepEquals(externalTransactionToken, other.externalTransactionToken) && _deepEquals(products, other.products); + return _deepEquals( + originalExternalTransactionId, + other.originalExternalTransactionId, + ) && + _deepEquals(externalTransactionToken, other.externalTransactionToken) && + _deepEquals(products, other.products); } @override @@ -1189,15 +1251,12 @@ class PlatformUserChoiceProduct { PlatformProductType type; List _toList() { - return [ - id, - offerToken, - type, - ]; + return [id, offerToken, type]; } Object encode() { - return _toList(); } + return _toList(); + } static PlatformUserChoiceProduct decode(Object result) { result as List; @@ -1211,13 +1270,16 @@ class PlatformUserChoiceProduct { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformUserChoiceProduct || other.runtimeType != runtimeType) { + if (other is! PlatformUserChoiceProduct || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(id, other.id) && _deepEquals(offerToken, other.offerToken) && _deepEquals(type, other.type); + return _deepEquals(id, other.id) && + _deepEquals(offerToken, other.offerToken) && + _deepEquals(type, other.type); } @override @@ -1245,7 +1307,8 @@ class PlatformInstallmentPlanDetails { } Object encode() { - return _toList(); } + return _toList(); + } static PlatformInstallmentPlanDetails decode(Object result) { result as List; @@ -1258,13 +1321,21 @@ class PlatformInstallmentPlanDetails { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformInstallmentPlanDetails || other.runtimeType != runtimeType) { + if (other is! PlatformInstallmentPlanDetails || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { return true; } - return _deepEquals(commitmentPaymentsCount, other.commitmentPaymentsCount) && _deepEquals(subsequentCommitmentPaymentsCount, other.subsequentCommitmentPaymentsCount); + return _deepEquals( + commitmentPaymentsCount, + other.commitmentPaymentsCount, + ) && + _deepEquals( + subsequentCommitmentPaymentsCount, + other.subsequentCommitmentPaymentsCount, + ); } @override @@ -1274,20 +1345,17 @@ class PlatformInstallmentPlanDetails { /// Pigeon version of Java PendingPurchasesParams. class PlatformPendingPurchasesParams { - PlatformPendingPurchasesParams({ - required this.enablePrepaidPlans, - }); + PlatformPendingPurchasesParams({required this.enablePrepaidPlans}); bool enablePrepaidPlans; List _toList() { - return [ - enablePrepaidPlans, - ]; + return [enablePrepaidPlans]; } Object encode() { - return _toList(); } + return _toList(); + } static PlatformPendingPurchasesParams decode(Object result) { result as List; @@ -1299,7 +1367,8 @@ class PlatformPendingPurchasesParams { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformPendingPurchasesParams || other.runtimeType != runtimeType) { + if (other is! PlatformPendingPurchasesParams || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { @@ -1315,32 +1384,28 @@ class PlatformPendingPurchasesParams { /// Pigeon version of Java [UnfetchedProduct](https://developer.android.com/reference/com/android/billingclient/api/QueryProductDetailsParams.Product). class PlatformUnfetchedProduct { - PlatformUnfetchedProduct({ - required this.productId, - }); + PlatformUnfetchedProduct({required this.productId}); String productId; List _toList() { - return [ - productId, - ]; + return [productId]; } Object encode() { - return _toList(); } + return _toList(); + } static PlatformUnfetchedProduct decode(Object result) { result as List; - return PlatformUnfetchedProduct( - productId: result[0]! as String, - ); + return PlatformUnfetchedProduct(productId: result[0]! as String); } @override // ignore: avoid_equals_and_hash_code_on_mutable_classes bool operator ==(Object other) { - if (other is! PlatformUnfetchedProduct || other.runtimeType != runtimeType) { + if (other is! PlatformUnfetchedProduct || + other.runtimeType != runtimeType) { return false; } if (identical(this, other)) { @@ -1354,7 +1419,6 @@ class PlatformUnfetchedProduct { int get hashCode => _deepHash([runtimeType, ..._toList()]); } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -1362,88 +1426,89 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is PlatformBillingResponse) { + } else if (value is PlatformBillingResponse) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is PlatformReplacementMode) { + } else if (value is PlatformReplacementMode) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is PlatformProductType) { + } else if (value is PlatformProductType) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is PlatformBillingChoiceMode) { + } else if (value is PlatformBillingChoiceMode) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is PlatformBillingClientFeature) { + } else if (value is PlatformBillingClientFeature) { buffer.putUint8(133); writeValue(buffer, value.index); - } else if (value is PlatformPurchaseState) { + } else if (value is PlatformPurchaseState) { buffer.putUint8(134); writeValue(buffer, value.index); - } else if (value is PlatformRecurrenceMode) { + } else if (value is PlatformRecurrenceMode) { buffer.putUint8(135); writeValue(buffer, value.index); - } else if (value is PlatformQueryProduct) { + } else if (value is PlatformQueryProduct) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is PlatformAccountIdentifiers) { + } else if (value is PlatformAccountIdentifiers) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else if (value is PlatformBillingResult) { + } else if (value is PlatformBillingResult) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is PlatformOneTimePurchaseOfferDetails) { + } else if (value is PlatformOneTimePurchaseOfferDetails) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is PlatformProductDetails) { + } else if (value is PlatformProductDetails) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is PlatformProductDetailsResponse) { + } else if (value is PlatformProductDetailsResponse) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else if (value is PlatformAlternativeBillingOnlyReportingDetailsResponse) { + } else if (value + is PlatformAlternativeBillingOnlyReportingDetailsResponse) { buffer.putUint8(142); writeValue(buffer, value.encode()); - } else if (value is PlatformBillingConfigResponse) { + } else if (value is PlatformBillingConfigResponse) { buffer.putUint8(143); writeValue(buffer, value.encode()); - } else if (value is PlatformBillingFlowParams) { + } else if (value is PlatformBillingFlowParams) { buffer.putUint8(144); writeValue(buffer, value.encode()); - } else if (value is PlatformPricingPhase) { + } else if (value is PlatformPricingPhase) { buffer.putUint8(145); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchase) { + } else if (value is PlatformPurchase) { buffer.putUint8(146); writeValue(buffer, value.encode()); - } else if (value is PlatformPendingPurchaseUpdate) { + } else if (value is PlatformPendingPurchaseUpdate) { buffer.putUint8(147); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchaseHistoryRecord) { + } else if (value is PlatformPurchaseHistoryRecord) { buffer.putUint8(148); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchaseHistoryResponse) { + } else if (value is PlatformPurchaseHistoryResponse) { buffer.putUint8(149); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchasesResponse) { + } else if (value is PlatformPurchasesResponse) { buffer.putUint8(150); writeValue(buffer, value.encode()); - } else if (value is PlatformSubscriptionOfferDetails) { + } else if (value is PlatformSubscriptionOfferDetails) { buffer.putUint8(151); writeValue(buffer, value.encode()); - } else if (value is PlatformUserChoiceDetails) { + } else if (value is PlatformUserChoiceDetails) { buffer.putUint8(152); writeValue(buffer, value.encode()); - } else if (value is PlatformUserChoiceProduct) { + } else if (value is PlatformUserChoiceProduct) { buffer.putUint8(153); writeValue(buffer, value.encode()); - } else if (value is PlatformInstallmentPlanDetails) { + } else if (value is PlatformInstallmentPlanDetails) { buffer.putUint8(154); writeValue(buffer, value.encode()); - } else if (value is PlatformPendingPurchasesParams) { + } else if (value is PlatformPendingPurchasesParams) { buffer.putUint8(155); writeValue(buffer, value.encode()); - } else if (value is PlatformUnfetchedProduct) { + } else if (value is PlatformUnfetchedProduct) { buffer.putUint8(156); writeValue(buffer, value.encode()); } else { @@ -1468,7 +1533,9 @@ class _PigeonCodec extends StandardMessageCodec { return value == null ? null : PlatformBillingChoiceMode.values[value]; case 133: final value = readValue(buffer) as int?; - return value == null ? null : PlatformBillingClientFeature.values[value]; + return value == null + ? null + : PlatformBillingClientFeature.values[value]; case 134: final value = readValue(buffer) as int?; return value == null ? null : PlatformPurchaseState.values[value]; @@ -1488,7 +1555,9 @@ class _PigeonCodec extends StandardMessageCodec { case 141: return PlatformProductDetailsResponse.decode(readValue(buffer)!); case 142: - return PlatformAlternativeBillingOnlyReportingDetailsResponse.decode(readValue(buffer)!); + return PlatformAlternativeBillingOnlyReportingDetailsResponse.decode( + readValue(buffer)!, + ); case 143: return PlatformBillingConfigResponse.decode(readValue(buffer)!); case 144: @@ -1527,9 +1596,13 @@ class InAppPurchaseApi { /// Constructor for [InAppPurchaseApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - InAppPurchaseApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + InAppPurchaseApi({ + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -1538,7 +1611,8 @@ class InAppPurchaseApi { /// Wraps BillingClient#isReady. Future isReady() async { - final pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1548,37 +1622,43 @@ class InAppPurchaseApi { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); return pigeonVar_replyValue! as bool; } /// Wraps BillingClient#startConnection(BillingClientStateListener). - Future startConnection(int callbackHandle, PlatformBillingChoiceMode billingMode, PlatformPendingPurchasesParams pendingPurchasesParams) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection$pigeonVar_messageChannelSuffix'; + Future startConnection( + int callbackHandle, + PlatformBillingChoiceMode billingMode, + PlatformPendingPurchasesParams pendingPurchasesParams, + ) async { + final pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([callbackHandle, billingMode, pendingPurchasesParams]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [callbackHandle, billingMode, pendingPurchasesParams], + ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); return pigeonVar_replyValue! as PlatformBillingResult; } /// Wraps BillingClient#endConnection(BillingClientStateListener). Future endConnection() async { - final pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1588,16 +1668,16 @@ class InAppPurchaseApi { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: true, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, BillingConfigResponseListener). Future getBillingConfigAsync() async { - final pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1607,137 +1687,157 @@ class InAppPurchaseApi { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); return pigeonVar_replyValue! as PlatformBillingConfigResponse; } /// Wraps BillingClient#launchBillingFlow(Activity, BillingFlowParams). - Future launchBillingFlow(PlatformBillingFlowParams params) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow$pigeonVar_messageChannelSuffix'; + Future launchBillingFlow( + PlatformBillingFlowParams params, + ) async { + final pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([params]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [params], + ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); return pigeonVar_replyValue! as PlatformBillingResult; } /// Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, AcknowledgePurchaseResponseListener). - Future acknowledgePurchase(String purchaseToken) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase$pigeonVar_messageChannelSuffix'; + Future acknowledgePurchase( + String purchaseToken, + ) async { + final pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([purchaseToken]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [purchaseToken], + ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); return pigeonVar_replyValue! as PlatformBillingResult; } /// Wraps BillingClient#consumeAsync(ConsumeParams, ConsumeResponseListener). Future consumeAsync(String purchaseToken) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([purchaseToken]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [purchaseToken], + ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); return pigeonVar_replyValue! as PlatformBillingResult; } /// Wraps BillingClient#queryPurchasesAsync(QueryPurchaseParams, PurchaseResponseListener). - Future queryPurchasesAsync(PlatformProductType productType) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync$pigeonVar_messageChannelSuffix'; + Future queryPurchasesAsync( + PlatformProductType productType, + ) async { + final pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([productType]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [productType], + ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); return pigeonVar_replyValue! as PlatformPurchasesResponse; } /// Wraps BillingClient#queryProductDetailsAsync(QueryProductDetailsParams, ProductDetailsResponseListener). - Future queryProductDetailsAsync(List products) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync$pigeonVar_messageChannelSuffix'; + Future queryProductDetailsAsync( + List products, + ) async { + final pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([products]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [products], + ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); return pigeonVar_replyValue! as PlatformProductDetailsResponse; } /// Wraps BillingClient#isFeatureSupported(String). Future isFeatureSupported(PlatformBillingClientFeature feature) async { - final pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final Future pigeonVar_sendFuture = pigeonVar_channel.send([feature]); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [feature], + ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); return pigeonVar_replyValue! as bool; } /// Wraps BillingClient#isAlternativeBillingOnlyAvailableAsync(). Future isAlternativeBillingOnlyAvailableAsync() async { - final pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync$pigeonVar_messageChannelSuffix'; + final pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1747,17 +1847,18 @@ class InAppPurchaseApi { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); return pigeonVar_replyValue! as PlatformBillingResult; } /// Wraps BillingClient#showAlternativeBillingOnlyInformationDialog(). - Future showAlternativeBillingOnlyInformationDialog() async { - final pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog$pigeonVar_messageChannelSuffix'; + Future + showAlternativeBillingOnlyInformationDialog() async { + final pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1767,17 +1868,18 @@ class InAppPurchaseApi { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); return pigeonVar_replyValue! as PlatformBillingResult; } /// Wraps BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). - Future createAlternativeBillingOnlyReportingDetailsAsync() async { - final pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync$pigeonVar_messageChannelSuffix'; + Future + createAlternativeBillingOnlyReportingDetailsAsync() async { + final pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync$pigeonVar_messageChannelSuffix'; final pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, @@ -1787,12 +1889,12 @@ class InAppPurchaseApi { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( - pigeonVar_replyList, - pigeonVar_channelName, - isNullValid: false, - ) - ; - return pigeonVar_replyValue! as PlatformAlternativeBillingOnlyReportingDetailsResponse; + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + ); + return pigeonVar_replyValue! + as PlatformAlternativeBillingOnlyReportingDetailsResponse; } } @@ -1808,12 +1910,20 @@ abstract class InAppPurchaseCallbackApi { /// Called for `UserChoiceBillingListener#userSelectedAlternativeBilling(UserChoiceDetails)`. void userSelectedalternativeBilling(PlatformUserChoiceDetails details); - static void setUp(InAppPurchaseCallbackApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { - messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp( + InAppPurchaseCallbackApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty + ? '.$messageChannelSuffix' + : ''; { final pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected$messageChannelSuffix', pigeonChannelCodec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger, + ); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { @@ -1825,50 +1935,62 @@ abstract class InAppPurchaseCallbackApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString()), + ); } }); } } { final pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated$messageChannelSuffix', pigeonChannelCodec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger, + ); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { final List args = message! as List; - final PlatformPurchasesResponse arg_update = args[0]! as PlatformPurchasesResponse; + final PlatformPurchasesResponse arg_update = + args[0]! as PlatformPurchasesResponse; try { api.onPurchasesUpdated(arg_update); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString()), + ); } }); } } { final pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling$messageChannelSuffix', pigeonChannelCodec, - binaryMessenger: binaryMessenger); + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling$messageChannelSuffix', + pigeonChannelCodec, + binaryMessenger: binaryMessenger, + ); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { final List args = message! as List; - final PlatformUserChoiceDetails arg_details = args[0]! as PlatformUserChoiceDetails; + final PlatformUserChoiceDetails arg_details = + args[0]! as PlatformUserChoiceDetails; try { api.userSelectedalternativeBilling(arg_details); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString()), + ); } }); } From fea7ea176dc17238798bbe7a5926e8b0d0002315 Mon Sep 17 00:00:00 2001 From: Gray Mackall <34871572+gmackall@users.noreply.github.com> Date: Thu, 21 May 2026 14:12:49 -0700 Subject: [PATCH 4/5] fix test --- .../io/flutter/plugins/inapppurchase/TranslatorTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/TranslatorTest.java b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/TranslatorTest.java index 8dcb4a7da789..51dda74894ac 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/TranslatorTest.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/TranslatorTest.java @@ -187,8 +187,8 @@ public void fromBillingResult_debugMessageNull() { assertEquals(PlatformBillingResponse.OK, platformResult.getResponseCode()); assertEquals(platformResult.getDebugMessage(), newBillingResult.getDebugMessage()); assertEquals( - (long) newBillingResult.getOnPurchasesUpdatedSubResponseCode(), - (long) platformResult.getSubResponseCode()); + newBillingResult.getOnPurchasesUpdatedSubResponseCode(), + platformResult.getSubResponseCode()); } private void assertSerialized(ProductDetails expected, PlatformProductDetails serialized) { @@ -208,7 +208,7 @@ private void assertSerialized(ProductDetails expected, PlatformProductDetails se List expectedOfferList = expected.getOneTimePurchaseOfferDetailsList(); - List serializedOfferList = + List serializedOfferList = serialized.getOneTimePurchaseOfferDetailsList(); if (expectedOfferList == null) { From 56dda816d438a8facadbc7ef236ab39febf1abb9 Mon Sep 17 00:00:00 2001 From: Gray Mackall <34871572+gmackall@users.noreply.github.com> Date: Thu, 21 May 2026 14:16:51 -0700 Subject: [PATCH 5/5] re order changelog --- packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md index 349f2b1c279e..4724caf0e208 100644 --- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md @@ -1,5 +1,6 @@ ## 0.5.0 +* Updates minimum supported SDK version to Flutter 3.38/Dart 3.10. * Updates Google Play Billing Library from 7.1.1 to 8.0.0. * **BREAKING CHANGES**: * Removes `queryPurchaseHistory` and its wrapper `queryPurchaseHistoryAsync`. Use `queryPurchases` instead. @@ -7,8 +8,6 @@ * Adds support for `oneTimePurchaseOfferDetailsList` in `ProductDetailsWrapper`. * Adds support for `unfetchedProductList` in `ProductDetailsResponseWrapper` to handle product IDs that could not be fetched. -* Updates minimum supported SDK version to Flutter 3.38/Dart 3.10. - ## 0.4.0+11 * Updates internal implementation to use Kotlin Pigeon.