From 8a911d1ea63630c844e627e8fdc185a894b13f32 Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Thu, 21 Nov 2024 19:36:00 +0100 Subject: [PATCH 01/16] Upgrade Play Billing library to 7.1.1 Signed-off-by: Marcin Chudy --- .../in_app_purchase_android/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 7a790d8d8406..faaa4a1a3536 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.0' - implementation 'com.android.billingclient:billing:6.2.0' + implementation 'com.android.billingclient:billing:7.1.1' testImplementation 'junit:junit:4.13.2' testImplementation 'org.json:json:20240303' testImplementation 'org.mockito:mockito-core:5.4.0' From 50cf4ba76b268217d99eaa9e1a7bec29466c0f49 Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Thu, 21 Nov 2024 19:47:01 +0100 Subject: [PATCH 02/16] Remove proration mode references Signed-off-by: Marcin Chudy --- .../in_app_purchase/example/lib/main.dart | 4 +-- .../inapppurchase/MethodCallHandlerImpl.java | 32 ++----------------- .../inapppurchase/MethodCallHandlerTest.java | 4 +-- 3 files changed, 7 insertions(+), 33 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase/example/lib/main.dart b/packages/in_app_purchase/in_app_purchase/example/lib/main.dart index 5afb52ac99ea..19698ff8a9c9 100644 --- a/packages/in_app_purchase/in_app_purchase/example/lib/main.dart +++ b/packages/in_app_purchase/in_app_purchase/example/lib/main.dart @@ -284,8 +284,8 @@ class _MyAppState extends State<_MyApp> { changeSubscriptionParam: (oldSubscription != null) ? ChangeSubscriptionParam( oldPurchaseDetails: oldSubscription, - prorationMode: - ProrationMode.immediateWithTimeProration, + replacementMode: + ReplacementMode.withTimeProration, ) : null); } else { 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 c7305a699382..50dad291d4e6 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 @@ -51,15 +51,6 @@ /** Handles method channel for the plugin. */ class MethodCallHandlerImpl implements Application.ActivityLifecycleCallbacks, InAppPurchaseApi { - // TODO(gmackall): Replace uses of deprecated ProrationMode enum values with new - // ReplacementMode enum values. - // https://github.com/flutter/flutter/issues/128957. - @SuppressWarnings(value = "deprecation") - @VisibleForTesting - static final int PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = - com.android.billingclient.api.BillingFlowParams.ProrationMode - .UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY; - @VisibleForTesting static final int REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = com.android.billingclient.api.BillingFlowParams.SubscriptionUpdateParams.ReplacementMode @@ -290,8 +281,7 @@ public void queryProductDetailsAsync( } } - if (params.getProrationMode() != PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY - && params.getReplacementMode() + if ( params.getReplacementMode() != REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY) { throw new FlutterError( "IN_APP_PURCHASE_CONFLICT_PRORATION_MODE_REPLACEMENT_MODE", @@ -300,9 +290,7 @@ public void queryProductDetailsAsync( } if (params.getOldProduct() == null - && (params.getProrationMode() - != PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY - || params.getReplacementMode() + && (params.getReplacementMode() != REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY)) { throw new FlutterError( "IN_APP_PURCHASE_REQUIRE_OLD_PRODUCT", @@ -352,11 +340,6 @@ public void queryProductDetailsAsync( && !params.getOldProduct().isEmpty() && params.getPurchaseToken() != null) { subscriptionUpdateParamsBuilder.setOldPurchaseToken(params.getPurchaseToken()); - if (params.getProrationMode() - != PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY) { - setReplaceProrationMode( - subscriptionUpdateParamsBuilder, params.getProrationMode().intValue()); - } if (params.getReplacementMode() != REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY) { subscriptionUpdateParamsBuilder.setSubscriptionReplacementMode( @@ -367,16 +350,6 @@ public void queryProductDetailsAsync( return fromBillingResult(billingClient.launchBillingFlow(activity, paramsBuilder.build())); } - // TODO(gmackall): Replace uses of deprecated setReplaceProrationMode. - // https://github.com/flutter/flutter/issues/128957. - @SuppressWarnings(value = "deprecation") - private void setReplaceProrationMode( - BillingFlowParams.SubscriptionUpdateParams.Builder builder, int prorationMode) { - // The proration mode value has to match one of the following declared in - // https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.ProrationMode - builder.setReplaceProrationMode(prorationMode); - } - @Override public void consumeAsync( @NonNull String purchaseToken, @NonNull Result result) { @@ -428,6 +401,7 @@ public void queryPurchasesAsync( } @Override + @Deprecated public void queryPurchaseHistoryAsync( @NonNull PlatformProductType productType, @NonNull Result result) { 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 58b1c42a0e41..a9839bb2f136 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 @@ -837,14 +837,14 @@ public void launchBillingFlow_ok_Full() { String oldProductId = "oldFoo"; String purchaseToken = "purchaseTokenFoo"; String accountId = "account"; - int prorationMode = BillingFlowParams.ProrationMode.IMMEDIATE_AND_CHARGE_FULL_PRICE; + int replacementMode = BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.CHARGE_FULL_PRICE; queryForProducts(unmodifiableList(asList(productId, oldProductId))); PlatformBillingFlowParams.Builder paramsBuilder = new PlatformBillingFlowParams.Builder(); paramsBuilder.setProduct(productId); paramsBuilder.setAccountId(accountId); paramsBuilder.setOldProduct(oldProductId); paramsBuilder.setPurchaseToken(purchaseToken); - paramsBuilder.setProrationMode((long) prorationMode); + paramsBuilder.setReplacementMode((long) replacementMode); paramsBuilder.setReplacementMode( (long) REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); From 8b5839b6e7461f03d42e392b54f54df30ac05e06 Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Thu, 21 Nov 2024 19:47:15 +0100 Subject: [PATCH 03/16] Add InstallmentPlanDetails model Signed-off-by: Marcin Chudy --- .../BillingClientFactoryImpl.java | 5 +- .../plugins/inapppurchase/Messages.java | 770 +++++++----------- .../plugins/inapppurchase/Translator.java | 13 + .../lib/src/messages.g.dart | 340 ++++---- .../pigeons/messages.dart | 12 + 5 files changed, 496 insertions(+), 644 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java index 460414b2e5ba..ec3cbca58736 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java @@ -10,6 +10,7 @@ import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import com.android.billingclient.api.BillingClient; +import com.android.billingclient.api.PendingPurchasesParams; import com.android.billingclient.api.UserChoiceBillingListener; import io.flutter.Log; import io.flutter.plugins.inapppurchase.Messages.PlatformBillingChoiceMode; @@ -22,7 +23,9 @@ public BillingClient createBillingClient( @NonNull Context context, @NonNull Messages.InAppPurchaseCallbackApi callbackApi, PlatformBillingChoiceMode billingChoiceMode) { - BillingClient.Builder builder = BillingClient.newBuilder(context).enablePendingPurchases(); + BillingClient.Builder builder = BillingClient.newBuilder(context).enablePendingPurchases( + PendingPurchasesParams.newBuilder().enableOneTimeProducts().build() + ); switch (billingChoiceMode) { case ALTERNATIVE_BILLING_ONLY: // https://developer.android.com/google/play/billing/alternative/alternative-billing-without-user-choice-in-app 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 cef3e316c3d6..eba42b2e2ab8 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 @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.4.2), do not edit directly. +// Autogenerated from Pigeon (v22.6.1), do not edit directly. // See also: https://pub.dev/packages/pigeon package io.flutter.plugins.inapppurchase; @@ -21,8 +21,11 @@ import java.lang.annotation.Target; import java.nio.ByteBuffer; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; /** Generated class from Pigeon. */ @@ -38,7 +41,8 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) + { super(message); this.code = code; this.details = details; @@ -57,15 +61,14 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @NonNull protected static FlutterError createConnectionError(@NonNull String channelName) { - return new FlutterError( - "channel-error", "Unable to establish connection on channel: " + channelName + ".", ""); + return new FlutterError("channel-error", "Unable to establish connection on channel: " + channelName + ".", ""); } @Target(METHOD) @@ -89,7 +92,7 @@ public enum PlatformBillingChoiceMode { /** * Billing through google play. * - *

Default state. + * Default state. */ PLAY_BILLING_ONLY(0), /** Billing through app provided flow. */ @@ -133,7 +136,7 @@ public enum PlatformRecurrenceMode { /** * Pigeon version of Java QueryProductDetailsParams.Product. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformQueryProduct { private @NonNull String productId; @@ -167,12 +170,8 @@ public void setProductType(@NonNull PlatformProductType setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformQueryProduct that = (PlatformQueryProduct) o; return productId.equals(that.productId) && productType.equals(that.productType); } @@ -229,7 +228,7 @@ ArrayList toList() { /** * Pigeon version of Java AccountIdentifiers. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformAccountIdentifiers { private @Nullable String obfuscatedAccountId; @@ -254,15 +253,10 @@ public void setObfuscatedProfileId(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformAccountIdentifiers that = (PlatformAccountIdentifiers) o; - return Objects.equals(obfuscatedAccountId, that.obfuscatedAccountId) - && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId); + return Objects.equals(obfuscatedAccountId, that.obfuscatedAccountId) && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId); } @Override @@ -317,7 +311,7 @@ ArrayList toList() { /** * Pigeon version of Java BillingResult. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingResult { private @NonNull Long responseCode; @@ -351,12 +345,8 @@ public void setDebugMessage(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformBillingResult that = (PlatformBillingResult) o; return responseCode.equals(that.responseCode) && debugMessage.equals(that.debugMessage); } @@ -413,7 +403,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.OneTimePurchaseOfferDetails. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformOneTimePurchaseOfferDetails { private @NonNull Long priceAmountMicros; @@ -460,16 +450,10 @@ public void setPriceCurrencyCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformOneTimePurchaseOfferDetails that = (PlatformOneTimePurchaseOfferDetails) o; - return priceAmountMicros.equals(that.priceAmountMicros) - && formattedPrice.equals(that.formattedPrice) - && priceCurrencyCode.equals(that.priceCurrencyCode); + return priceAmountMicros.equals(that.priceAmountMicros) && formattedPrice.equals(that.formattedPrice) && priceCurrencyCode.equals(that.priceCurrencyCode); } @Override @@ -504,8 +488,7 @@ public static final class Builder { } public @NonNull PlatformOneTimePurchaseOfferDetails build() { - PlatformOneTimePurchaseOfferDetails pigeonReturn = - new PlatformOneTimePurchaseOfferDetails(); + PlatformOneTimePurchaseOfferDetails pigeonReturn = new PlatformOneTimePurchaseOfferDetails(); pigeonReturn.setPriceAmountMicros(priceAmountMicros); pigeonReturn.setFormattedPrice(formattedPrice); pigeonReturn.setPriceCurrencyCode(priceCurrencyCode); @@ -522,8 +505,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformOneTimePurchaseOfferDetails fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformOneTimePurchaseOfferDetails fromList(@NonNull ArrayList pigeonVar_list) { PlatformOneTimePurchaseOfferDetails pigeonResult = new PlatformOneTimePurchaseOfferDetails(); Object priceAmountMicros = pigeonVar_list.get(0); pigeonResult.setPriceAmountMicros((Long) priceAmountMicros); @@ -538,7 +520,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformProductDetails { private @NonNull String description; @@ -612,8 +594,7 @@ public void setTitle(@NonNull String setterArg) { return oneTimePurchaseOfferDetails; } - public void setOneTimePurchaseOfferDetails( - @Nullable PlatformOneTimePurchaseOfferDetails setterArg) { + public void setOneTimePurchaseOfferDetails(@Nullable PlatformOneTimePurchaseOfferDetails setterArg) { this.oneTimePurchaseOfferDetails = setterArg; } @@ -623,8 +604,7 @@ public void setOneTimePurchaseOfferDetails( return subscriptionOfferDetails; } - public void setSubscriptionOfferDetails( - @Nullable List setterArg) { + public void setSubscriptionOfferDetails(@Nullable List setterArg) { this.subscriptionOfferDetails = setterArg; } @@ -633,32 +613,15 @@ public void setSubscriptionOfferDetails( @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformProductDetails that = (PlatformProductDetails) o; - return description.equals(that.description) - && name.equals(that.name) - && productId.equals(that.productId) - && productType.equals(that.productType) - && title.equals(that.title) - && Objects.equals(oneTimePurchaseOfferDetails, that.oneTimePurchaseOfferDetails) - && Objects.equals(subscriptionOfferDetails, that.subscriptionOfferDetails); + return description.equals(that.description) && name.equals(that.name) && productId.equals(that.productId) && productType.equals(that.productType) && title.equals(that.title) && Objects.equals(oneTimePurchaseOfferDetails, that.oneTimePurchaseOfferDetails) && Objects.equals(subscriptionOfferDetails, that.subscriptionOfferDetails); } @Override public int hashCode() { - return Objects.hash( - description, - name, - productId, - productType, - title, - oneTimePurchaseOfferDetails, - subscriptionOfferDetails); + return Objects.hash(description, name, productId, productType, title, oneTimePurchaseOfferDetails, subscriptionOfferDetails); } public static final class Builder { @@ -706,8 +669,7 @@ public static final class Builder { private @Nullable PlatformOneTimePurchaseOfferDetails oneTimePurchaseOfferDetails; @CanIgnoreReturnValue - public @NonNull Builder setOneTimePurchaseOfferDetails( - @Nullable PlatformOneTimePurchaseOfferDetails setterArg) { + public @NonNull Builder setOneTimePurchaseOfferDetails(@Nullable PlatformOneTimePurchaseOfferDetails setterArg) { this.oneTimePurchaseOfferDetails = setterArg; return this; } @@ -715,8 +677,7 @@ public static final class Builder { private @Nullable List subscriptionOfferDetails; @CanIgnoreReturnValue - public @NonNull Builder setSubscriptionOfferDetails( - @Nullable List setterArg) { + public @NonNull Builder setSubscriptionOfferDetails(@Nullable List setterArg) { this.subscriptionOfferDetails = setterArg; return this; } @@ -760,20 +721,18 @@ ArrayList toList() { Object title = pigeonVar_list.get(4); pigeonResult.setTitle((String) title); Object oneTimePurchaseOfferDetails = pigeonVar_list.get(5); - pigeonResult.setOneTimePurchaseOfferDetails( - (PlatformOneTimePurchaseOfferDetails) oneTimePurchaseOfferDetails); + pigeonResult.setOneTimePurchaseOfferDetails((PlatformOneTimePurchaseOfferDetails) oneTimePurchaseOfferDetails); Object subscriptionOfferDetails = pigeonVar_list.get(6); - pigeonResult.setSubscriptionOfferDetails( - (List) subscriptionOfferDetails); + pigeonResult.setSubscriptionOfferDetails((List) subscriptionOfferDetails); return pigeonResult; } } /** - * 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. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformProductDetailsResponse { private @NonNull PlatformBillingResult billingResult; @@ -807,12 +766,8 @@ public void setProductDetails(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformProductDetailsResponse that = (PlatformProductDetailsResponse) o; return billingResult.equals(that.billingResult) && productDetails.equals(that.productDetails); } @@ -856,8 +811,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformProductDetailsResponse fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformProductDetailsResponse fromList(@NonNull ArrayList pigeonVar_list) { PlatformProductDetailsResponse pigeonResult = new PlatformProductDetailsResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -868,10 +822,11 @@ ArrayList toList() { } /** - * 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. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformAlternativeBillingOnlyReportingDetailsResponse { private @NonNull PlatformBillingResult billingResult; @@ -905,16 +860,10 @@ public void setExternalTransactionToken(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformAlternativeBillingOnlyReportingDetailsResponse that = - (PlatformAlternativeBillingOnlyReportingDetailsResponse) o; - return billingResult.equals(that.billingResult) - && externalTransactionToken.equals(that.externalTransactionToken); + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + PlatformAlternativeBillingOnlyReportingDetailsResponse that = (PlatformAlternativeBillingOnlyReportingDetailsResponse) o; + return billingResult.equals(that.billingResult) && externalTransactionToken.equals(that.externalTransactionToken); } @Override @@ -941,8 +890,7 @@ public static final class Builder { } public @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse build() { - PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonReturn = - new PlatformAlternativeBillingOnlyReportingDetailsResponse(); + PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonReturn = new PlatformAlternativeBillingOnlyReportingDetailsResponse(); pigeonReturn.setBillingResult(billingResult); pigeonReturn.setExternalTransactionToken(externalTransactionToken); return pigeonReturn; @@ -957,10 +905,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse fromList( - @NonNull ArrayList pigeonVar_list) { - PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonResult = - new PlatformAlternativeBillingOnlyReportingDetailsResponse(); + static @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse fromList(@NonNull ArrayList pigeonVar_list) { + PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonResult = new PlatformAlternativeBillingOnlyReportingDetailsResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); Object externalTransactionToken = pigeonVar_list.get(1); @@ -970,10 +916,10 @@ ArrayList toList() { } /** - * 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. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingConfigResponse { private @NonNull PlatformBillingResult billingResult; @@ -1007,12 +953,8 @@ public void setCountryCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformBillingConfigResponse that = (PlatformBillingConfigResponse) o; return billingResult.equals(that.billingResult) && countryCode.equals(that.countryCode); } @@ -1056,8 +998,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformBillingConfigResponse fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformBillingConfigResponse fromList(@NonNull ArrayList pigeonVar_list) { PlatformBillingConfigResponse pigeonResult = new PlatformBillingConfigResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -1070,7 +1011,7 @@ ArrayList toList() { /** * Pigeon version of Java BillingFlowParams. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingFlowParams { private @NonNull String product; @@ -1167,34 +1108,15 @@ public void setPurchaseToken(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformBillingFlowParams that = (PlatformBillingFlowParams) o; - return product.equals(that.product) - && prorationMode.equals(that.prorationMode) - && replacementMode.equals(that.replacementMode) - && Objects.equals(offerToken, that.offerToken) - && Objects.equals(accountId, that.accountId) - && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId) - && Objects.equals(oldProduct, that.oldProduct) - && Objects.equals(purchaseToken, that.purchaseToken); + return product.equals(that.product) && prorationMode.equals(that.prorationMode) && replacementMode.equals(that.replacementMode) && Objects.equals(offerToken, that.offerToken) && Objects.equals(accountId, that.accountId) && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId) && Objects.equals(oldProduct, that.oldProduct) && Objects.equals(purchaseToken, that.purchaseToken); } @Override public int hashCode() { - return Objects.hash( - product, - prorationMode, - replacementMode, - offerToken, - accountId, - obfuscatedProfileId, - oldProduct, - purchaseToken); + return Objects.hash(product, prorationMode, replacementMode, offerToken, accountId, obfuscatedProfileId, oldProduct, purchaseToken); } public static final class Builder { @@ -1316,7 +1238,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.PricingPhase. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPricingPhase { private @NonNull Long billingCycleCount; @@ -1402,30 +1324,15 @@ public void setPriceCurrencyCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPricingPhase that = (PlatformPricingPhase) o; - return billingCycleCount.equals(that.billingCycleCount) - && recurrenceMode.equals(that.recurrenceMode) - && priceAmountMicros.equals(that.priceAmountMicros) - && billingPeriod.equals(that.billingPeriod) - && formattedPrice.equals(that.formattedPrice) - && priceCurrencyCode.equals(that.priceCurrencyCode); + return billingCycleCount.equals(that.billingCycleCount) && recurrenceMode.equals(that.recurrenceMode) && priceAmountMicros.equals(that.priceAmountMicros) && billingPeriod.equals(that.billingPeriod) && formattedPrice.equals(that.formattedPrice) && priceCurrencyCode.equals(that.priceCurrencyCode); } @Override public int hashCode() { - return Objects.hash( - billingCycleCount, - recurrenceMode, - priceAmountMicros, - billingPeriod, - formattedPrice, - priceCurrencyCode); + return Objects.hash(billingCycleCount, recurrenceMode, priceAmountMicros, billingPeriod, formattedPrice, priceCurrencyCode); } public static final class Builder { @@ -1523,9 +1430,9 @@ ArrayList toList() { /** * Pigeon version of Java Purchase. * - *

See also PurchaseWrapper on the Dart side. + * See also PurchaseWrapper on the Dart side. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchase { private @Nullable String orderId; @@ -1696,44 +1603,15 @@ public void setAccountIdentifiers(@Nullable PlatformAccountIdentifiers setterArg @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPurchase that = (PlatformPurchase) o; - return Objects.equals(orderId, that.orderId) - && packageName.equals(that.packageName) - && purchaseTime.equals(that.purchaseTime) - && purchaseToken.equals(that.purchaseToken) - && signature.equals(that.signature) - && products.equals(that.products) - && isAutoRenewing.equals(that.isAutoRenewing) - && originalJson.equals(that.originalJson) - && developerPayload.equals(that.developerPayload) - && isAcknowledged.equals(that.isAcknowledged) - && quantity.equals(that.quantity) - && purchaseState.equals(that.purchaseState) - && Objects.equals(accountIdentifiers, that.accountIdentifiers); + return Objects.equals(orderId, that.orderId) && packageName.equals(that.packageName) && purchaseTime.equals(that.purchaseTime) && purchaseToken.equals(that.purchaseToken) && signature.equals(that.signature) && products.equals(that.products) && isAutoRenewing.equals(that.isAutoRenewing) && originalJson.equals(that.originalJson) && developerPayload.equals(that.developerPayload) && isAcknowledged.equals(that.isAcknowledged) && quantity.equals(that.quantity) && purchaseState.equals(that.purchaseState) && Objects.equals(accountIdentifiers, that.accountIdentifiers); } @Override public int hashCode() { - return Objects.hash( - orderId, - packageName, - purchaseTime, - purchaseToken, - signature, - products, - isAutoRenewing, - originalJson, - developerPayload, - isAcknowledged, - quantity, - purchaseState, - accountIdentifiers); + return Objects.hash(orderId, packageName, purchaseTime, purchaseToken, signature, products, isAutoRenewing, originalJson, developerPayload, isAcknowledged, quantity, purchaseState, accountIdentifiers); } public static final class Builder { @@ -1837,8 +1715,7 @@ public static final class Builder { private @Nullable PlatformAccountIdentifiers accountIdentifiers; @CanIgnoreReturnValue - public @NonNull Builder setAccountIdentifiers( - @Nullable PlatformAccountIdentifiers setterArg) { + public @NonNull Builder setAccountIdentifiers(@Nullable PlatformAccountIdentifiers setterArg) { this.accountIdentifiers = setterArg; return this; } @@ -1916,9 +1793,9 @@ ArrayList toList() { /** * Pigeon version of PurchaseHistoryRecord. * - *

See also PurchaseHistoryRecordWrapper on the Dart side. + * See also PurchaseHistoryRecordWrapper on the Dart side. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchaseHistoryRecord { private @NonNull Long quantity; @@ -2014,32 +1891,15 @@ public void setProducts(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPurchaseHistoryRecord that = (PlatformPurchaseHistoryRecord) o; - return quantity.equals(that.quantity) - && purchaseTime.equals(that.purchaseTime) - && Objects.equals(developerPayload, that.developerPayload) - && originalJson.equals(that.originalJson) - && purchaseToken.equals(that.purchaseToken) - && signature.equals(that.signature) - && products.equals(that.products); + return quantity.equals(that.quantity) && purchaseTime.equals(that.purchaseTime) && Objects.equals(developerPayload, that.developerPayload) && originalJson.equals(that.originalJson) && purchaseToken.equals(that.purchaseToken) && signature.equals(that.signature) && products.equals(that.products); } @Override public int hashCode() { - return Objects.hash( - quantity, - purchaseTime, - developerPayload, - originalJson, - purchaseToken, - signature, - products); + return Objects.hash(quantity, purchaseTime, developerPayload, originalJson, purchaseToken, signature, products); } public static final class Builder { @@ -2126,8 +1986,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPurchaseHistoryRecord fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformPurchaseHistoryRecord fromList(@NonNull ArrayList pigeonVar_list) { PlatformPurchaseHistoryRecord pigeonResult = new PlatformPurchaseHistoryRecord(); Object quantity = pigeonVar_list.get(0); pigeonResult.setQuantity((Long) quantity); @@ -2148,10 +2007,10 @@ ArrayList toList() { } /** - * 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. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchaseHistoryResponse { private @NonNull PlatformBillingResult billingResult; @@ -2185,12 +2044,8 @@ public void setPurchases(@NonNull List setterArg) @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPurchaseHistoryResponse that = (PlatformPurchaseHistoryResponse) o; return billingResult.equals(that.billingResult) && purchases.equals(that.purchases); } @@ -2234,8 +2089,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPurchaseHistoryResponse fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformPurchaseHistoryResponse fromList(@NonNull ArrayList pigeonVar_list) { PlatformPurchaseHistoryResponse pigeonResult = new PlatformPurchaseHistoryResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -2246,10 +2100,10 @@ ArrayList toList() { } /** - * 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. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchasesResponse { private @NonNull PlatformBillingResult billingResult; @@ -2283,12 +2137,8 @@ public void setPurchases(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPurchasesResponse that = (PlatformPurchasesResponse) o; return billingResult.equals(that.billingResult) && purchases.equals(that.purchases); } @@ -2345,7 +2195,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.SubscriptionOfferDetails. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformSubscriptionOfferDetails { private @NonNull String basePlanId; @@ -2410,28 +2260,30 @@ public void setPricingPhases(@NonNull List setterArg) { this.pricingPhases = setterArg; } + private @Nullable PlatformInstallmentPlanDetails installmentPlanDetails; + + public @Nullable PlatformInstallmentPlanDetails getInstallmentPlanDetails() { + return installmentPlanDetails; + } + + public void setInstallmentPlanDetails(@Nullable PlatformInstallmentPlanDetails setterArg) { + this.installmentPlanDetails = setterArg; + } + /** Constructor is non-public to enforce null safety; use Builder. */ PlatformSubscriptionOfferDetails() {} @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformSubscriptionOfferDetails that = (PlatformSubscriptionOfferDetails) o; - return basePlanId.equals(that.basePlanId) - && Objects.equals(offerId, that.offerId) - && offerToken.equals(that.offerToken) - && offerTags.equals(that.offerTags) - && pricingPhases.equals(that.pricingPhases); + return basePlanId.equals(that.basePlanId) && Objects.equals(offerId, that.offerId) && offerToken.equals(that.offerToken) && offerTags.equals(that.offerTags) && pricingPhases.equals(that.pricingPhases) && Objects.equals(installmentPlanDetails, that.installmentPlanDetails); } @Override public int hashCode() { - return Objects.hash(basePlanId, offerId, offerToken, offerTags, pricingPhases); + return Objects.hash(basePlanId, offerId, offerToken, offerTags, pricingPhases, installmentPlanDetails); } public static final class Builder { @@ -2476,6 +2328,14 @@ public static final class Builder { return this; } + private @Nullable PlatformInstallmentPlanDetails installmentPlanDetails; + + @CanIgnoreReturnValue + public @NonNull Builder setInstallmentPlanDetails(@Nullable PlatformInstallmentPlanDetails setterArg) { + this.installmentPlanDetails = setterArg; + return this; + } + public @NonNull PlatformSubscriptionOfferDetails build() { PlatformSubscriptionOfferDetails pigeonReturn = new PlatformSubscriptionOfferDetails(); pigeonReturn.setBasePlanId(basePlanId); @@ -2483,23 +2343,24 @@ public static final class Builder { pigeonReturn.setOfferToken(offerToken); pigeonReturn.setOfferTags(offerTags); pigeonReturn.setPricingPhases(pricingPhases); + pigeonReturn.setInstallmentPlanDetails(installmentPlanDetails); return pigeonReturn; } } @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList<>(5); + ArrayList toListResult = new ArrayList<>(6); toListResult.add(basePlanId); toListResult.add(offerId); toListResult.add(offerToken); toListResult.add(offerTags); toListResult.add(pricingPhases); + toListResult.add(installmentPlanDetails); return toListResult; } - static @NonNull PlatformSubscriptionOfferDetails fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformSubscriptionOfferDetails fromList(@NonNull ArrayList pigeonVar_list) { PlatformSubscriptionOfferDetails pigeonResult = new PlatformSubscriptionOfferDetails(); Object basePlanId = pigeonVar_list.get(0); pigeonResult.setBasePlanId((String) basePlanId); @@ -2511,6 +2372,8 @@ ArrayList toList() { pigeonResult.setOfferTags((List) offerTags); Object pricingPhases = pigeonVar_list.get(4); pigeonResult.setPricingPhases((List) pricingPhases); + Object installmentPlanDetails = pigeonVar_list.get(5); + pigeonResult.setInstallmentPlanDetails((PlatformInstallmentPlanDetails) installmentPlanDetails); return pigeonResult; } } @@ -2518,7 +2381,7 @@ ArrayList toList() { /** * Pigeon version of UserChoiceDetailsWrapper and Java UserChoiceDetails. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformUserChoiceDetails { private @Nullable String originalExternalTransactionId; @@ -2562,16 +2425,10 @@ public void setProducts(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformUserChoiceDetails that = (PlatformUserChoiceDetails) o; - return Objects.equals(originalExternalTransactionId, that.originalExternalTransactionId) - && externalTransactionToken.equals(that.externalTransactionToken) - && products.equals(that.products); + return Objects.equals(originalExternalTransactionId, that.originalExternalTransactionId) && externalTransactionToken.equals(that.externalTransactionToken) && products.equals(that.products); } @Override @@ -2638,7 +2495,7 @@ ArrayList toList() { /** * Pigeon version of UserChoiseDetails.Product. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformUserChoiceProduct { private @NonNull String id; @@ -2682,16 +2539,10 @@ public void setType(@NonNull PlatformProductType setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformUserChoiceProduct that = (PlatformUserChoiceProduct) o; - return id.equals(that.id) - && Objects.equals(offerToken, that.offerToken) - && type.equals(that.type); + return id.equals(that.id) && Objects.equals(offerToken, that.offerToken) && type.equals(that.type); } @Override @@ -2755,6 +2606,98 @@ ArrayList toList() { } } + /** + * Pigeon version of ProductDetails.InstallmentPlanDetails. + * + * Generated class from Pigeon that represents data sent in messages. + */ + public static final class PlatformInstallmentPlanDetails { + private @NonNull Long commitmentPaymentsCount; + + public @NonNull Long getCommitmentPaymentsCount() { + return commitmentPaymentsCount; + } + + public void setCommitmentPaymentsCount(@NonNull Long setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"commitmentPaymentsCount\" is null."); + } + this.commitmentPaymentsCount = setterArg; + } + + private @NonNull Long subsequentCommitmentPaymentsCount; + + public @NonNull Long getSubsequentCommitmentPaymentsCount() { + return subsequentCommitmentPaymentsCount; + } + + public void setSubsequentCommitmentPaymentsCount(@NonNull Long setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"subsequentCommitmentPaymentsCount\" is null."); + } + this.subsequentCommitmentPaymentsCount = setterArg; + } + + /** Constructor is non-public to enforce null safety; use Builder. */ + PlatformInstallmentPlanDetails() {} + + @Override + public boolean equals(Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + PlatformInstallmentPlanDetails that = (PlatformInstallmentPlanDetails) o; + return commitmentPaymentsCount.equals(that.commitmentPaymentsCount) && subsequentCommitmentPaymentsCount.equals(that.subsequentCommitmentPaymentsCount); + } + + @Override + public int hashCode() { + return Objects.hash(commitmentPaymentsCount, subsequentCommitmentPaymentsCount); + } + + public static final class Builder { + + private @Nullable Long commitmentPaymentsCount; + + @CanIgnoreReturnValue + public @NonNull Builder setCommitmentPaymentsCount(@NonNull Long setterArg) { + this.commitmentPaymentsCount = setterArg; + return this; + } + + private @Nullable Long subsequentCommitmentPaymentsCount; + + @CanIgnoreReturnValue + public @NonNull Builder setSubsequentCommitmentPaymentsCount(@NonNull Long setterArg) { + this.subsequentCommitmentPaymentsCount = setterArg; + return this; + } + + public @NonNull PlatformInstallmentPlanDetails build() { + PlatformInstallmentPlanDetails pigeonReturn = new PlatformInstallmentPlanDetails(); + pigeonReturn.setCommitmentPaymentsCount(commitmentPaymentsCount); + pigeonReturn.setSubsequentCommitmentPaymentsCount(subsequentCommitmentPaymentsCount); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList<>(2); + toListResult.add(commitmentPaymentsCount); + toListResult.add(subsequentCommitmentPaymentsCount); + return toListResult; + } + + static @NonNull PlatformInstallmentPlanDetails fromList(@NonNull ArrayList pigeonVar_list) { + PlatformInstallmentPlanDetails pigeonResult = new PlatformInstallmentPlanDetails(); + Object commitmentPaymentsCount = pigeonVar_list.get(0); + pigeonResult.setCommitmentPaymentsCount((Long) commitmentPaymentsCount); + Object subsequentCommitmentPaymentsCount = pigeonVar_list.get(1); + pigeonResult.setSubsequentCommitmentPaymentsCount((Long) subsequentCommitmentPaymentsCount); + return pigeonResult; + } + } + private static class PigeonCodec extends StandardMessageCodec { public static final PigeonCodec INSTANCE = new PigeonCodec(); @@ -2763,30 +2706,22 @@ private PigeonCodec() {} @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte) 129: - { - Object value = readValue(buffer); - return value == null ? null : PlatformProductType.values()[((Long) value).intValue()]; - } - case (byte) 130: - { - Object value = readValue(buffer); - return value == null - ? null - : PlatformBillingChoiceMode.values()[((Long) value).intValue()]; - } - case (byte) 131: - { - Object value = readValue(buffer); - return value == null ? null : PlatformPurchaseState.values()[((Long) value).intValue()]; - } - case (byte) 132: - { - Object value = readValue(buffer); - return value == null - ? null - : PlatformRecurrenceMode.values()[((Long) value).intValue()]; - } + case (byte) 129: { + Object value = readValue(buffer); + return value == null ? null : PlatformProductType.values()[((Long) value).intValue()]; + } + case (byte) 130: { + Object value = readValue(buffer); + return value == null ? null : PlatformBillingChoiceMode.values()[((Long) value).intValue()]; + } + case (byte) 131: { + Object value = readValue(buffer); + return value == null ? null : PlatformPurchaseState.values()[((Long) value).intValue()]; + } + case (byte) 132: { + Object value = readValue(buffer); + return value == null ? null : PlatformRecurrenceMode.values()[((Long) value).intValue()]; + } case (byte) 133: return PlatformQueryProduct.fromList((ArrayList) readValue(buffer)); case (byte) 134: @@ -2794,15 +2729,13 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { case (byte) 135: return PlatformBillingResult.fromList((ArrayList) readValue(buffer)); case (byte) 136: - return PlatformOneTimePurchaseOfferDetails.fromList( - (ArrayList) readValue(buffer)); + return PlatformOneTimePurchaseOfferDetails.fromList((ArrayList) readValue(buffer)); case (byte) 137: return PlatformProductDetails.fromList((ArrayList) readValue(buffer)); case (byte) 138: return PlatformProductDetailsResponse.fromList((ArrayList) readValue(buffer)); case (byte) 139: - return PlatformAlternativeBillingOnlyReportingDetailsResponse.fromList( - (ArrayList) readValue(buffer)); + return PlatformAlternativeBillingOnlyReportingDetailsResponse.fromList((ArrayList) readValue(buffer)); case (byte) 140: return PlatformBillingConfigResponse.fromList((ArrayList) readValue(buffer)); case (byte) 141: @@ -2823,6 +2756,8 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { return PlatformUserChoiceDetails.fromList((ArrayList) readValue(buffer)); case (byte) 149: return PlatformUserChoiceProduct.fromList((ArrayList) readValue(buffer)); + case (byte) 150: + return PlatformInstallmentPlanDetails.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); } @@ -2862,8 +2797,7 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { writeValue(stream, ((PlatformProductDetailsResponse) value).toList()); } else if (value instanceof PlatformAlternativeBillingOnlyReportingDetailsResponse) { stream.write(139); - writeValue( - stream, ((PlatformAlternativeBillingOnlyReportingDetailsResponse) value).toList()); + writeValue(stream, ((PlatformAlternativeBillingOnlyReportingDetailsResponse) value).toList()); } else if (value instanceof PlatformBillingConfigResponse) { stream.write(140); writeValue(stream, ((PlatformBillingConfigResponse) value).toList()); @@ -2894,12 +2828,16 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { } else if (value instanceof PlatformUserChoiceProduct) { stream.write(149); writeValue(stream, ((PlatformUserChoiceProduct) value).toList()); + } else if (value instanceof PlatformInstallmentPlanDetails) { + stream.write(150); + writeValue(stream, ((PlatformInstallmentPlanDetails) value).toList()); } else { super.writeValue(stream, value); } } } + /** Asynchronous error handling return type for non-nullable API method returns. */ public interface Result { /** Success case callback method for handling returns. */ @@ -2927,86 +2865,51 @@ public interface VoidResult { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InAppPurchaseApi { /** Wraps BillingClient#isReady. */ - @NonNull + @NonNull Boolean isReady(); /** Wraps BillingClient#startConnection(BillingClientStateListener). */ - void startConnection( - @NonNull Long callbackHandle, - @NonNull PlatformBillingChoiceMode billingMode, - @NonNull Result result); + void startConnection(@NonNull Long callbackHandle, @NonNull PlatformBillingChoiceMode billingMode, @NonNull Result result); /** Wraps BillingClient#endConnection(BillingClientStateListener). */ void endConnection(); - /** - * Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, - * BillingConfigResponseListener). - */ + /** Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, BillingConfigResponseListener). */ void getBillingConfigAsync(@NonNull Result result); /** Wraps BillingClient#launchBillingFlow(Activity, BillingFlowParams). */ - @NonNull + @NonNull PlatformBillingResult launchBillingFlow(@NonNull PlatformBillingFlowParams params); - /** - * Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, - * AcknowledgePurchaseResponseListener). - */ - void acknowledgePurchase( - @NonNull String purchaseToken, @NonNull Result result); + /** Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, AcknowledgePurchaseResponseListener). */ + void acknowledgePurchase(@NonNull String purchaseToken, @NonNull Result result); /** Wraps BillingClient#consumeAsync(ConsumeParams, ConsumeResponseListener). */ void consumeAsync(@NonNull String purchaseToken, @NonNull Result result); /** Wraps BillingClient#queryPurchasesAsync(QueryPurchaseParams, PurchaseResponseListener). */ - 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). - */ - void queryProductDetailsAsync( - @NonNull List products, - @NonNull Result result); + 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). */ + void queryProductDetailsAsync(@NonNull List products, @NonNull Result result); /** Wraps BillingClient#isFeatureSupported(String). */ - @NonNull + @NonNull Boolean isFeatureSupported(@NonNull String feature); /** Wraps BillingClient#isAlternativeBillingOnlyAvailableAsync(). */ void isAlternativeBillingOnlyAvailableAsync(@NonNull Result result); /** Wraps BillingClient#showAlternativeBillingOnlyInformationDialog(). */ void showAlternativeBillingOnlyInformationDialog(@NonNull Result result); - /** - * Wraps - * BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). - */ - void createAlternativeBillingOnlyReportingDetailsAsync( - @NonNull Result result); + /** Wraps BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). */ + void createAlternativeBillingOnlyReportingDetailsAsync(@NonNull Result result); /** The codec used by InAppPurchaseApi. */ static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } - /** - * Sets up an instance of `InAppPurchaseApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `InAppPurchaseApi` to handle messages through the `binaryMessenger`. */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable InAppPurchaseApi api) { setUp(binaryMessenger, "", api); } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable InAppPurchaseApi api) { + static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String messageChannelSuffix, @Nullable InAppPurchaseApi api) { messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3014,7 +2917,8 @@ static void setUp( try { Boolean output = api.isReady(); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3026,10 +2930,7 @@ static void setUp( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3059,10 +2960,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3070,7 +2968,8 @@ public void error(Throwable error) { try { api.endConnection(); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3082,10 +2981,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3112,10 +3008,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3125,7 +3018,8 @@ public void error(Throwable error) { try { PlatformBillingResult output = api.launchBillingFlow(paramsArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3137,10 +3031,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3169,10 +3060,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3201,10 +3089,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3233,10 +3118,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3265,10 +3147,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3297,10 +3176,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3310,7 +3186,8 @@ public void error(Throwable error) { try { Boolean output = api.isFeatureSupported(featureArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3322,10 +3199,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3352,10 +3226,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3382,18 +3253,14 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList wrapped = new ArrayList<>(); Result resultCallback = new Result() { - public void success( - PlatformAlternativeBillingOnlyReportingDetailsResponse result) { + public void success(PlatformAlternativeBillingOnlyReportingDetailsResponse result) { wrapped.add(0, result); reply.reply(wrapped); } @@ -3420,90 +3287,79 @@ public static class InAppPurchaseCallbackApi { public InAppPurchaseCallbackApi(@NonNull BinaryMessenger argBinaryMessenger) { this(argBinaryMessenger, ""); } - - public InAppPurchaseCallbackApi( - @NonNull BinaryMessenger argBinaryMessenger, @NonNull String messageChannelSuffix) { + public InAppPurchaseCallbackApi(@NonNull BinaryMessenger argBinaryMessenger, @NonNull String messageChannelSuffix) { this.binaryMessenger = argBinaryMessenger; this.messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; } - /** Public interface for sending reply. The codec used by InAppPurchaseCallbackApi. */ + /** + * Public interface for sending reply. + * The codec used by InAppPurchaseCallbackApi. + */ static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } /** Called for BillingClientStateListener#onBillingServiceDisconnected(). */ - public void onBillingServiceDisconnected( - @NonNull Long callbackHandleArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected" - + messageChannelSuffix; + public void onBillingServiceDisconnected(@NonNull Long callbackHandleArg, @NonNull VoidResult result) { + final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected" + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(callbackHandleArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } /** Called for PurchasesUpdatedListener#onPurchasesUpdated(BillingResult, List). */ - public void onPurchasesUpdated( - @NonNull PlatformPurchasesResponse updateArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated" - + messageChannelSuffix; + public void onPurchasesUpdated(@NonNull PlatformPurchasesResponse updateArg, @NonNull VoidResult result) { + final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated" + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(updateArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } /** Called for UserChoiceBillingListener#userSelectedAlternativeBilling(UserChoiceDetails). */ - public void userSelectedalternativeBilling( - @NonNull PlatformUserChoiceDetails detailsArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling" - + messageChannelSuffix; + public void userSelectedalternativeBilling(@NonNull PlatformUserChoiceDetails detailsArg, @NonNull VoidResult result) { + final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling" + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(detailsArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } } 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 c06b3acfb503..31292a599b37 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 @@ -146,6 +146,7 @@ static PlatformProductType toPlatformProductType(@NonNull String typeString) { .setOfferTags(subscriptionOfferDetails.getOfferTags()) .setOfferToken(subscriptionOfferDetails.getOfferToken()) .setPricingPhases(fromPricingPhases(subscriptionOfferDetails.getPricingPhases())) + .setInstallmentPlanDetails(fromInstallmentPlanDetails(subscriptionOfferDetails.getInstallmentPlanDetails())) .build(); } @@ -170,6 +171,18 @@ static PlatformProductType toPlatformProductType(@NonNull String typeString) { .build(); } + static @Nullable Messages.PlatformInstallmentPlanDetails fromInstallmentPlanDetails( + @Nullable ProductDetails.InstallmentPlanDetails installmentPlanDetails) { + if (installmentPlanDetails == null) { + return null; + } + + return new Messages.PlatformInstallmentPlanDetails.Builder() + .setCommitmentPaymentsCount((long) installmentPlanDetails.getInstallmentPlanCommitmentPaymentsCount()) + .setSubsequentCommitmentPaymentsCount((long) installmentPlanDetails.getSubsequentInstallmentPlanCommitmentPaymentsCount()) + .build(); + } + static PlatformRecurrenceMode toPlatformRecurrenceMode(int mode) { switch (mode) { case ProductDetails.RecurrenceMode.FINITE_RECURRING: 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 1e6cca2ccbd3..abc82bbcfaed 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 @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.4.2), do not edit directly. +// Autogenerated from Pigeon (v22.6.1), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -18,8 +18,7 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -41,10 +40,8 @@ enum PlatformBillingChoiceMode { /// /// Default state. playBillingOnly, - /// Billing through app provided flow. alternativeBillingOnly, - /// Users can choose Play billing or alternative billing. userChoiceBilling, } @@ -222,10 +219,8 @@ class PlatformProductDetails { productId: result[2]! as String, productType: result[3]! as PlatformProductType, title: result[4]! as String, - oneTimePurchaseOfferDetails: - result[5] as PlatformOneTimePurchaseOfferDetails?, - subscriptionOfferDetails: (result[6] as List?) - ?.cast(), + oneTimePurchaseOfferDetails: result[5] as PlatformOneTimePurchaseOfferDetails?, + subscriptionOfferDetails: (result[6] as List?)?.cast(), ); } } @@ -253,8 +248,7 @@ class PlatformProductDetailsResponse { result as List; return PlatformProductDetailsResponse( billingResult: result[0]! as PlatformBillingResult, - productDetails: - (result[1] as List?)!.cast(), + productDetails: (result[1] as List?)!.cast(), ); } } @@ -279,8 +273,7 @@ class PlatformAlternativeBillingOnlyReportingDetailsResponse { ]; } - static PlatformAlternativeBillingOnlyReportingDetailsResponse decode( - Object result) { + static PlatformAlternativeBillingOnlyReportingDetailsResponse decode(Object result) { result as List; return PlatformAlternativeBillingOnlyReportingDetailsResponse( billingResult: result[0]! as PlatformBillingResult, @@ -582,8 +575,7 @@ class PlatformPurchaseHistoryResponse { result as List; return PlatformPurchaseHistoryResponse( billingResult: result[0]! as PlatformBillingResult, - purchases: - (result[1] as List?)!.cast(), + purchases: (result[1] as List?)!.cast(), ); } } @@ -624,6 +616,7 @@ class PlatformSubscriptionOfferDetails { required this.offerToken, required this.offerTags, required this.pricingPhases, + this.installmentPlanDetails, }); String basePlanId; @@ -636,6 +629,8 @@ class PlatformSubscriptionOfferDetails { List pricingPhases; + PlatformInstallmentPlanDetails? installmentPlanDetails; + Object encode() { return [ basePlanId, @@ -643,6 +638,7 @@ class PlatformSubscriptionOfferDetails { offerToken, offerTags, pricingPhases, + installmentPlanDetails, ]; } @@ -653,8 +649,8 @@ class PlatformSubscriptionOfferDetails { offerId: result[1] as String?, offerToken: result[2]! as String, offerTags: (result[3] as List?)!.cast(), - pricingPhases: - (result[4] as List?)!.cast(), + pricingPhases: (result[4] as List?)!.cast(), + installmentPlanDetails: result[5] as PlatformInstallmentPlanDetails?, ); } } @@ -686,8 +682,7 @@ class PlatformUserChoiceDetails { return PlatformUserChoiceDetails( originalExternalTransactionId: result[0] as String?, externalTransactionToken: result[1]! as String, - products: - (result[2] as List?)!.cast(), + products: (result[2] as List?)!.cast(), ); } } @@ -724,6 +719,34 @@ class PlatformUserChoiceProduct { } } +/// Pigeon version of ProductDetails.InstallmentPlanDetails. +class PlatformInstallmentPlanDetails { + PlatformInstallmentPlanDetails({ + required this.commitmentPaymentsCount, + required this.subsequentCommitmentPaymentsCount, + }); + + int commitmentPaymentsCount; + + int subsequentCommitmentPaymentsCount; + + Object encode() { + return [ + commitmentPaymentsCount, + subsequentCommitmentPaymentsCount, + ]; + } + + static PlatformInstallmentPlanDetails decode(Object result) { + result as List; + return PlatformInstallmentPlanDetails( + commitmentPaymentsCount: result[0]! as int, + subsequentCommitmentPaymentsCount: result[1]! as int, + ); + } +} + + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -731,70 +754,72 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is PlatformProductType) { + } else if (value is PlatformProductType) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is PlatformBillingChoiceMode) { + } else if (value is PlatformBillingChoiceMode) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is PlatformPurchaseState) { + } else if (value is PlatformPurchaseState) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is PlatformRecurrenceMode) { + } else if (value is PlatformRecurrenceMode) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is PlatformQueryProduct) { + } else if (value is PlatformQueryProduct) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is PlatformAccountIdentifiers) { + } else if (value is PlatformAccountIdentifiers) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is PlatformBillingResult) { + } else if (value is PlatformBillingResult) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else if (value is PlatformOneTimePurchaseOfferDetails) { + } else if (value is PlatformOneTimePurchaseOfferDetails) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is PlatformProductDetails) { + } else if (value is PlatformProductDetails) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else if (value is PlatformProductDetailsResponse) { + } else if (value is PlatformProductDetailsResponse) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value - is PlatformAlternativeBillingOnlyReportingDetailsResponse) { + } else if (value is PlatformAlternativeBillingOnlyReportingDetailsResponse) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is PlatformBillingConfigResponse) { + } else if (value is PlatformBillingConfigResponse) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is PlatformBillingFlowParams) { + } else if (value is PlatformBillingFlowParams) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else if (value is PlatformPricingPhase) { + } else if (value is PlatformPricingPhase) { buffer.putUint8(142); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchase) { + } else if (value is PlatformPurchase) { buffer.putUint8(143); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchaseHistoryRecord) { + } else if (value is PlatformPurchaseHistoryRecord) { buffer.putUint8(144); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchaseHistoryResponse) { + } else if (value is PlatformPurchaseHistoryResponse) { buffer.putUint8(145); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchasesResponse) { + } else if (value is PlatformPurchasesResponse) { buffer.putUint8(146); writeValue(buffer, value.encode()); - } else if (value is PlatformSubscriptionOfferDetails) { + } else if (value is PlatformSubscriptionOfferDetails) { buffer.putUint8(147); writeValue(buffer, value.encode()); - } else if (value is PlatformUserChoiceDetails) { + } else if (value is PlatformUserChoiceDetails) { buffer.putUint8(148); writeValue(buffer, value.encode()); - } else if (value is PlatformUserChoiceProduct) { + } else if (value is PlatformUserChoiceProduct) { buffer.putUint8(149); writeValue(buffer, value.encode()); + } else if (value is PlatformInstallmentPlanDetails) { + buffer.putUint8(150); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -803,53 +828,54 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformProductType.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformBillingChoiceMode.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformPurchaseState.values[value]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformRecurrenceMode.values[value]; - case 133: + case 133: return PlatformQueryProduct.decode(readValue(buffer)!); - case 134: + case 134: return PlatformAccountIdentifiers.decode(readValue(buffer)!); - case 135: + case 135: return PlatformBillingResult.decode(readValue(buffer)!); - case 136: + case 136: return PlatformOneTimePurchaseOfferDetails.decode(readValue(buffer)!); - case 137: + case 137: return PlatformProductDetails.decode(readValue(buffer)!); - case 138: + case 138: return PlatformProductDetailsResponse.decode(readValue(buffer)!); - case 139: - return PlatformAlternativeBillingOnlyReportingDetailsResponse.decode( - readValue(buffer)!); - case 140: + case 139: + return PlatformAlternativeBillingOnlyReportingDetailsResponse.decode(readValue(buffer)!); + case 140: return PlatformBillingConfigResponse.decode(readValue(buffer)!); - case 141: + case 141: return PlatformBillingFlowParams.decode(readValue(buffer)!); - case 142: + case 142: return PlatformPricingPhase.decode(readValue(buffer)!); - case 143: + case 143: return PlatformPurchase.decode(readValue(buffer)!); - case 144: + case 144: return PlatformPurchaseHistoryRecord.decode(readValue(buffer)!); - case 145: + case 145: return PlatformPurchaseHistoryResponse.decode(readValue(buffer)!); - case 146: + case 146: return PlatformPurchasesResponse.decode(readValue(buffer)!); - case 147: + case 147: return PlatformSubscriptionOfferDetails.decode(readValue(buffer)!); - case 148: + case 148: return PlatformUserChoiceDetails.decode(readValue(buffer)!); - case 149: + case 149: return PlatformUserChoiceProduct.decode(readValue(buffer)!); + case 150: + return PlatformInstallmentPlanDetails.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -860,11 +886,9 @@ 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 = ''}) + InAppPurchaseApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -873,10 +897,8 @@ class InAppPurchaseApi { /// Wraps BillingClient#isReady. Future isReady() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -902,18 +924,15 @@ class InAppPurchaseApi { } /// Wraps BillingClient#startConnection(BillingClientStateListener). - Future startConnection( - int callbackHandle, PlatformBillingChoiceMode billingMode) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + Future startConnection(int callbackHandle, PlatformBillingChoiceMode billingMode) async { + final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([callbackHandle, billingMode]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_channel.send([callbackHandle, billingMode]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -934,10 +953,8 @@ class InAppPurchaseApi { /// Wraps BillingClient#endConnection(BillingClientStateListener). Future endConnection() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -959,10 +976,8 @@ class InAppPurchaseApi { /// Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, BillingConfigResponseListener). Future getBillingConfigAsync() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -988,12 +1003,9 @@ class InAppPurchaseApi { } /// Wraps BillingClient#launchBillingFlow(Activity, BillingFlowParams). - Future launchBillingFlow( - PlatformBillingFlowParams params) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + Future launchBillingFlow(PlatformBillingFlowParams params) async { + final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1019,18 +1031,15 @@ class InAppPurchaseApi { } /// Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, AcknowledgePurchaseResponseListener). - Future acknowledgePurchase( - String purchaseToken) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + Future acknowledgePurchase(String purchaseToken) async { + final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([purchaseToken]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_channel.send([purchaseToken]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -1051,16 +1060,14 @@ class InAppPurchaseApi { /// Wraps BillingClient#consumeAsync(ConsumeParams, ConsumeResponseListener). Future consumeAsync(String purchaseToken) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([purchaseToken]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_channel.send([purchaseToken]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -1080,12 +1087,9 @@ class InAppPurchaseApi { } /// Wraps BillingClient#queryPurchasesAsync(QueryPurchaseParams, PurchaseResponseListener). - Future queryPurchasesAsync( - PlatformProductType productType) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + Future queryPurchasesAsync(PlatformProductType productType) async { + final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1111,12 +1115,9 @@ 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( + 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, @@ -1142,12 +1143,9 @@ class InAppPurchaseApi { } /// Wraps BillingClient#queryProductDetailsAsync(QueryProductDetailsParams, ProductDetailsResponseListener). - Future queryProductDetailsAsync( - List products) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + Future queryProductDetailsAsync(List products) async { + final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1174,10 +1172,8 @@ class InAppPurchaseApi { /// Wraps BillingClient#isFeatureSupported(String). Future isFeatureSupported(String feature) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1204,10 +1200,8 @@ class InAppPurchaseApi { /// Wraps BillingClient#isAlternativeBillingOnlyAvailableAsync(). Future isAlternativeBillingOnlyAvailableAsync() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1233,12 +1227,9 @@ class InAppPurchaseApi { } /// Wraps BillingClient#showAlternativeBillingOnlyInformationDialog(). - Future - showAlternativeBillingOnlyInformationDialog() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + Future showAlternativeBillingOnlyInformationDialog() async { + final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1264,12 +1255,9 @@ class InAppPurchaseApi { } /// Wraps BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). - Future - createAlternativeBillingOnlyReportingDetailsAsync() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + Future createAlternativeBillingOnlyReportingDetailsAsync() async { + final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1290,8 +1278,7 @@ class InAppPurchaseApi { message: 'Host platform returned null value for non-null return value.', ); } else { - return (pigeonVar_replyList[0] - as PlatformAlternativeBillingOnlyReportingDetailsResponse?)!; + return (pigeonVar_replyList[0] as PlatformAlternativeBillingOnlyReportingDetailsResponse?)!; } } } @@ -1308,26 +1295,18 @@ 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 BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected was null.'); + 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected was null.'); final List args = (message as List?)!; final int? arg_callbackHandle = (args[0] as int?); assert(arg_callbackHandle != null, @@ -1337,29 +1316,24 @@ 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 BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + '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 { assert(message != null, - 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated was null.'); + 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated was null.'); final List args = (message as List?)!; - final PlatformPurchasesResponse? arg_update = - (args[0] as PlatformPurchasesResponse?); + final PlatformPurchasesResponse? arg_update = (args[0] as PlatformPurchasesResponse?); assert(arg_update != null, 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated was null, expected non-null PlatformPurchasesResponse.'); try { @@ -1367,29 +1341,24 @@ 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 BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + '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 { assert(message != null, - 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling was null.'); + 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling was null.'); final List args = (message as List?)!; - final PlatformUserChoiceDetails? arg_details = - (args[0] as PlatformUserChoiceDetails?); + final PlatformUserChoiceDetails? arg_details = (args[0] as PlatformUserChoiceDetails?); assert(arg_details != null, 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling was null, expected non-null PlatformUserChoiceDetails.'); try { @@ -1397,9 +1366,8 @@ 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())); } }); } 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 3c15cc4750a9..00e16f8228ca 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 @@ -252,6 +252,7 @@ class PlatformSubscriptionOfferDetails { // internal API, we can always add that indirection later if we need it, // so for now this bypasses that unnecessary wrapper. final List pricingPhases; + final PlatformInstallmentPlanDetails? installmentPlanDetails; } /// Pigeon version of UserChoiceDetailsWrapper and Java UserChoiceDetails. @@ -280,6 +281,17 @@ class PlatformUserChoiceProduct { final PlatformProductType type; } +/// Pigeon version of ProductDetails.InstallmentPlanDetails. +class PlatformInstallmentPlanDetails { + PlatformInstallmentPlanDetails({ + required this.commitmentPaymentsCount, + required this.subsequentCommitmentPaymentsCount, + }); + + final int commitmentPaymentsCount; + final int subsequentCommitmentPaymentsCount; +} + /// Pigeon version of Java BillingClient.ProductType. enum PlatformProductType { inapp, From 1389eb4b5fa37c2905b8f83111af9bd00894edb0 Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Fri, 22 Nov 2024 11:23:41 +0100 Subject: [PATCH 04/16] Add installment plan details wrapper model Signed-off-by: Marcin Chudy --- .../subscription_offer_details_wrapper.dart | 67 ++++++++++++++++++- .../subscription_offer_details_wrapper.g.dart | 13 ++++ .../lib/src/pigeon_converters.dart | 16 +++++ .../pigeons/messages.dart | 1 + 4 files changed, 96 insertions(+), 1 deletion(-) diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/subscription_offer_details_wrapper.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/subscription_offer_details_wrapper.dart index 4b5642ed0431..ba3b1bd10776 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/subscription_offer_details_wrapper.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/subscription_offer_details_wrapper.dart @@ -26,6 +26,7 @@ class SubscriptionOfferDetailsWrapper { required this.offerTags, required this.offerIdToken, required this.pricingPhases, + this.installmentPlanDetails, }); /// Factory for creating a [SubscriptionOfferDetailsWrapper] from a [Map] @@ -59,6 +60,10 @@ class SubscriptionOfferDetailsWrapper { @JsonKey(defaultValue: []) final List pricingPhases; + /// Represents additional details of an installment subscription plan. + @JsonKey(defaultValue: null) + final InstallmentPlanDetailsWrapper? installmentPlanDetails; + @override bool operator ==(Object other) { if (other.runtimeType != runtimeType) { @@ -70,7 +75,8 @@ class SubscriptionOfferDetailsWrapper { other.offerId == offerId && listEquals(other.offerTags, offerTags) && other.offerIdToken == offerIdToken && - listEquals(other.pricingPhases, pricingPhases); + listEquals(other.pricingPhases, pricingPhases) && + installmentPlanDetails == other.installmentPlanDetails; } @override @@ -81,6 +87,7 @@ class SubscriptionOfferDetailsWrapper { offerTags.hashCode, offerIdToken.hashCode, pricingPhases.hashCode, + installmentPlanDetails.hashCode, ); } } @@ -158,3 +165,61 @@ class PricingPhaseWrapper { recurrenceMode, ); } + +/// Represents additional details of an installment subscription plan. +@JsonSerializable() +@immutable +class InstallmentPlanDetailsWrapper { + /// Creates a [InstallmentPlanDetailsWrapper]. + const InstallmentPlanDetailsWrapper({ + required this.commitmentPaymentsCount, + required this.subsequentCommitmentPaymentsCount, + }); + + /// Factory for creating a [InstallmentPlanDetailsWrapper] from a [Map] + /// with the plan details. + @Deprecated('JSON serialization is not intended for public use, and will ' + 'be removed in a future version.') + factory InstallmentPlanDetailsWrapper.fromJson(Map map) => + _$InstallmentPlanDetailsWrapperFromJson(map); + + /// Committed payments count after a user signs up for this subscription plan. + /// + /// For example, for a monthly subscription plan with commitmentPaymentsCount + /// as 12, users will be charged monthly for 12 month after initial signup. + /// User cancellation won't take effect until all 12 committed payments are finished. + @JsonKey(defaultValue: 0) + final int commitmentPaymentsCount; + + /// Subsequent committed payments count after this subscription plan renews. + /// + /// For example, for a monthly subscription plan with subsequentCommitmentPaymentsCount + /// as 12, when the subscription plan renews, users will be committed to another fresh + /// 12 monthly payments. + /// + /// Note: Returns 0 if the installment plan doesn't have any subsequent committment, + /// which means this subscription plan will fall back to a normal non-installment + /// monthly plan when the plan renews. + @JsonKey(defaultValue: 0) + final int subsequentCommitmentPaymentsCount; + + @override + bool operator ==(Object other) { + if (other.runtimeType != runtimeType) { + return false; + } + + return other is InstallmentPlanDetailsWrapper && + other.commitmentPaymentsCount == commitmentPaymentsCount && + other.subsequentCommitmentPaymentsCount == + subsequentCommitmentPaymentsCount; + } + + @override + int get hashCode { + return Object.hash( + commitmentPaymentsCount.hashCode, + subsequentCommitmentPaymentsCount.hashCode, + ); + } +} diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/subscription_offer_details_wrapper.g.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/subscription_offer_details_wrapper.g.dart index 46973ed7d427..e84d871063d4 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/subscription_offer_details_wrapper.g.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/subscription_offer_details_wrapper.g.dart @@ -21,6 +21,10 @@ SubscriptionOfferDetailsWrapper _$SubscriptionOfferDetailsWrapperFromJson( Map.from(e as Map))) .toList() ?? [], + installmentPlanDetails: json['installmentPlanDetails'] == null + ? null + : InstallmentPlanDetailsWrapper.fromJson( + Map.from(json['installmentPlanDetails'] as Map)), ); PricingPhaseWrapper _$PricingPhaseWrapperFromJson(Map json) => @@ -35,3 +39,12 @@ PricingPhaseWrapper _$PricingPhaseWrapperFromJson(Map json) => : const RecurrenceModeConverter() .fromJson((json['recurrenceMode'] as num?)?.toInt()), ); + +InstallmentPlanDetailsWrapper _$InstallmentPlanDetailsWrapperFromJson( + Map json) => + InstallmentPlanDetailsWrapper( + commitmentPaymentsCount: + (json['commitmentPaymentsCount'] as num?)?.toInt() ?? 0, + subsequentCommitmentPaymentsCount: + (json['subsequentCommitmentPaymentsCount'] as num?)?.toInt() ?? 0, + ); 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 bc93f614704f..46cd66a73248 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 @@ -215,6 +215,8 @@ SubscriptionOfferDetailsWrapper subscriptionOfferDetailsWrapperFromPlatform( offerIdToken: offer.offerToken, pricingPhases: offer.pricingPhases.map(pricingPhaseWrapperFromPlatform).toList(), + installmentPlanDetails: + installmentPlanDetailsFromPlatform(offer.installmentPlanDetails), ); } @@ -238,3 +240,17 @@ UserChoiceDetailsProductWrapper userChoiceDetailsProductFromPlatform( productType: productTypeFromPlatform(product.type), ); } + +/// Creates a [InstallmentPlanDetailsWrapper] from the Pigeon equivalent. +InstallmentPlanDetailsWrapper? installmentPlanDetailsFromPlatform( + PlatformInstallmentPlanDetails? details) { + if (details == null) { + return null; + } + + return InstallmentPlanDetailsWrapper( + commitmentPaymentsCount: details.commitmentPaymentsCount, + subsequentCommitmentPaymentsCount: + details.subsequentCommitmentPaymentsCount, + ); +} 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 00e16f8228ca..2eabfcaf2582 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 @@ -241,6 +241,7 @@ class PlatformSubscriptionOfferDetails { required this.offerToken, required this.offerTags, required this.pricingPhases, + required this.installmentPlanDetails, }); final String basePlanId; From aef1f8c51503264a349ae3ac5eaa30a376f889d1 Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Mon, 25 Nov 2024 17:10:52 +0100 Subject: [PATCH 05/16] Remove ProrationMode enum Signed-off-by: Marcin Chudy --- .../in_app_purchase/in_app_purchase/README.md | 4 +- .../plugins/inapppurchase/Messages.java | 43 +++-------- .../inapppurchase/MethodCallHandlerImpl.java | 10 +-- .../inapppurchase/MethodCallHandlerTest.java | 16 ---- .../example/lib/main.dart | 4 +- .../billing_client_wrapper.dart | 77 +------------------ .../billing_client_wrapper.g.dart | 9 --- .../src/in_app_purchase_android_platform.dart | 1 - .../lib/src/messages.g.dart | 17 ++-- .../src/types/change_subscription_param.dart | 8 -- .../pigeons/messages.dart | 2 - .../billing_client_wrapper_test.dart | 19 +++-- ...in_app_purchase_android_platform_test.dart | 2 +- 13 files changed, 31 insertions(+), 181 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase/README.md b/packages/in_app_purchase/in_app_purchase/README.md index 9242ecee44d7..6340db25b314 100644 --- a/packages/in_app_purchase/in_app_purchase/README.md +++ b/packages/in_app_purchase/in_app_purchase/README.md @@ -216,7 +216,7 @@ the end user's payment account. To upgrade/downgrade an existing in-app subscription in Google Play, you need to provide an instance of `ChangeSubscriptionParam` with the old `PurchaseDetails` that the user needs to migrate from, and an optional -`ProrationMode` with the `GooglePlayPurchaseParam` object while calling +`ReplacementMode` with the `GooglePlayPurchaseParam` object while calling `InAppPurchase.buyNonConsumable`. The App Store does not require this because it provides a subscription @@ -232,7 +232,7 @@ PurchaseParam purchaseParam = GooglePlayPurchaseParam( productDetails: productDetails, changeSubscriptionParam: ChangeSubscriptionParam( oldPurchaseDetails: oldPurchaseDetails, - prorationMode: ProrationMode.immediateWithTimeProration)); + replacementMode: ReplacementMode.withTimeProration)); InAppPurchase.instance .buyNonConsumable(purchaseParam: purchaseParam); ``` 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 eba42b2e2ab8..a82693e899bc 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 @@ -1027,19 +1027,6 @@ public void setProduct(@NonNull String setterArg) { this.product = setterArg; } - private @NonNull Long prorationMode; - - public @NonNull Long getProrationMode() { - return prorationMode; - } - - public void setProrationMode(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"prorationMode\" is null."); - } - this.prorationMode = setterArg; - } - private @NonNull Long replacementMode; public @NonNull Long getReplacementMode() { @@ -1111,12 +1098,12 @@ public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PlatformBillingFlowParams that = (PlatformBillingFlowParams) o; - return product.equals(that.product) && prorationMode.equals(that.prorationMode) && replacementMode.equals(that.replacementMode) && Objects.equals(offerToken, that.offerToken) && Objects.equals(accountId, that.accountId) && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId) && Objects.equals(oldProduct, that.oldProduct) && Objects.equals(purchaseToken, that.purchaseToken); + return product.equals(that.product) && replacementMode.equals(that.replacementMode) && Objects.equals(offerToken, that.offerToken) && Objects.equals(accountId, that.accountId) && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId) && Objects.equals(oldProduct, that.oldProduct) && Objects.equals(purchaseToken, that.purchaseToken); } @Override public int hashCode() { - return Objects.hash(product, prorationMode, replacementMode, offerToken, accountId, obfuscatedProfileId, oldProduct, purchaseToken); + return Objects.hash(product, replacementMode, offerToken, accountId, obfuscatedProfileId, oldProduct, purchaseToken); } public static final class Builder { @@ -1129,14 +1116,6 @@ public static final class Builder { return this; } - private @Nullable Long prorationMode; - - @CanIgnoreReturnValue - public @NonNull Builder setProrationMode(@NonNull Long setterArg) { - this.prorationMode = setterArg; - return this; - } - private @Nullable Long replacementMode; @CanIgnoreReturnValue @@ -1188,7 +1167,6 @@ public static final class Builder { public @NonNull PlatformBillingFlowParams build() { PlatformBillingFlowParams pigeonReturn = new PlatformBillingFlowParams(); pigeonReturn.setProduct(product); - pigeonReturn.setProrationMode(prorationMode); pigeonReturn.setReplacementMode(replacementMode); pigeonReturn.setOfferToken(offerToken); pigeonReturn.setAccountId(accountId); @@ -1201,9 +1179,8 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList<>(8); + ArrayList toListResult = new ArrayList<>(7); toListResult.add(product); - toListResult.add(prorationMode); toListResult.add(replacementMode); toListResult.add(offerToken); toListResult.add(accountId); @@ -1217,19 +1194,17 @@ ArrayList toList() { PlatformBillingFlowParams pigeonResult = new PlatformBillingFlowParams(); Object product = pigeonVar_list.get(0); pigeonResult.setProduct((String) product); - Object prorationMode = pigeonVar_list.get(1); - pigeonResult.setProrationMode((Long) prorationMode); - Object replacementMode = pigeonVar_list.get(2); + Object replacementMode = pigeonVar_list.get(1); pigeonResult.setReplacementMode((Long) replacementMode); - Object offerToken = pigeonVar_list.get(3); + Object offerToken = pigeonVar_list.get(2); pigeonResult.setOfferToken((String) offerToken); - Object accountId = pigeonVar_list.get(4); + Object accountId = pigeonVar_list.get(3); pigeonResult.setAccountId((String) accountId); - Object obfuscatedProfileId = pigeonVar_list.get(5); + Object obfuscatedProfileId = pigeonVar_list.get(4); pigeonResult.setObfuscatedProfileId((String) obfuscatedProfileId); - Object oldProduct = pigeonVar_list.get(6); + Object oldProduct = pigeonVar_list.get(5); pigeonResult.setOldProduct((String) oldProduct); - Object purchaseToken = pigeonVar_list.get(7); + Object purchaseToken = pigeonVar_list.get(6); pigeonResult.setPurchaseToken((String) purchaseToken); return pigeonResult; } 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 50dad291d4e6..ea20b017dfb2 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 @@ -281,20 +281,12 @@ public void queryProductDetailsAsync( } } - if ( params.getReplacementMode() - != REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY) { - throw new FlutterError( - "IN_APP_PURCHASE_CONFLICT_PRORATION_MODE_REPLACEMENT_MODE", - "launchBillingFlow failed because you provided both prorationMode and replacementMode. You can only provide one of them.", - null); - } - if (params.getOldProduct() == null && (params.getReplacementMode() != REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY)) { throw new FlutterError( "IN_APP_PURCHASE_REQUIRE_OLD_PRODUCT", - "launchBillingFlow failed because oldProduct is null. You must provide a valid oldProduct in order to use a proration mode.", + "launchBillingFlow failed because oldProduct is null. You must provide a valid oldProduct in order to use a replacement mode.", null); } else if (params.getOldProduct() != null && !cachedProducts.containsKey(params.getOldProduct())) { 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 a9839bb2f136..c6dcff2764d6 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 @@ -555,8 +555,6 @@ public void launchBillingFlow_null_AccountId_do_not_crash() { queryForProducts(singletonList(productId)); PlatformBillingFlowParams.Builder paramsBuilder = new PlatformBillingFlowParams.Builder(); paramsBuilder.setProduct(productId); - paramsBuilder.setProrationMode( - (long) PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); paramsBuilder.setReplacementMode( (long) REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); @@ -582,8 +580,6 @@ public void launchBillingFlow_ok_null_OldProduct() { PlatformBillingFlowParams.Builder paramsBuilder = new PlatformBillingFlowParams.Builder(); paramsBuilder.setProduct(productId); paramsBuilder.setAccountId(accountId); - paramsBuilder.setProrationMode( - (long) PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); paramsBuilder.setReplacementMode( (long) REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); @@ -613,8 +609,6 @@ public void launchBillingFlow_ok_null_Activity() { PlatformBillingFlowParams.Builder paramsBuilder = new PlatformBillingFlowParams.Builder(); paramsBuilder.setProduct(productId); paramsBuilder.setAccountId(accountId); - paramsBuilder.setProrationMode( - (long) PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); paramsBuilder.setReplacementMode( (long) REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); @@ -638,8 +632,6 @@ public void launchBillingFlow_ok_oldProduct() { paramsBuilder.setProduct(productId); paramsBuilder.setAccountId(accountId); paramsBuilder.setOldProduct(oldProductId); - paramsBuilder.setProrationMode( - (long) PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); paramsBuilder.setReplacementMode( (long) REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); @@ -667,8 +659,6 @@ public void launchBillingFlow_ok_AccountId() { PlatformBillingFlowParams.Builder paramsBuilder = new PlatformBillingFlowParams.Builder(); paramsBuilder.setProduct(productId); paramsBuilder.setAccountId(accountId); - paramsBuilder.setProrationMode( - (long) PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); paramsBuilder.setReplacementMode( (long) REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); @@ -872,8 +862,6 @@ public void launchBillingFlow_clientDisconnected() { PlatformBillingFlowParams.Builder paramsBuilder = new PlatformBillingFlowParams.Builder(); paramsBuilder.setProduct(productId); paramsBuilder.setAccountId(accountId); - paramsBuilder.setProrationMode( - (long) PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); paramsBuilder.setReplacementMode( (long) REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); @@ -895,8 +883,6 @@ public void launchBillingFlow_productNotFound() { PlatformBillingFlowParams.Builder paramsBuilder = new PlatformBillingFlowParams.Builder(); paramsBuilder.setProduct(productId); paramsBuilder.setAccountId(accountId); - paramsBuilder.setProrationMode( - (long) PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); paramsBuilder.setReplacementMode( (long) REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); @@ -921,8 +907,6 @@ public void launchBillingFlow_oldProductNotFound() { paramsBuilder.setProduct(productId); paramsBuilder.setAccountId(accountId); paramsBuilder.setOldProduct(oldProductId); - paramsBuilder.setProrationMode( - (long) PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); paramsBuilder.setReplacementMode( (long) REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); diff --git a/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart b/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart index 4773446cdeeb..2d5bfe86da12 100644 --- a/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart +++ b/packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart @@ -424,8 +424,8 @@ class _MyAppState extends State<_MyApp> { changeSubscriptionParam: oldSubscription != null ? ChangeSubscriptionParam( oldPurchaseDetails: oldSubscription, - prorationMode: ProrationMode - .immediateWithTimeProration) + replacementMode: + ReplacementMode.withTimeProration) : null); if (productDetails.id == _kConsumableId) { _inAppPurchasePlatform.buyConsumable( 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 1f46c3f1de20..c030c7c62e8a 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 @@ -181,7 +181,7 @@ class BillingClient { /// existing subscription. /// The [oldProduct](https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.SubscriptionUpdateParams.Builder#setOldPurchaseToken(java.lang.String)) and [purchaseToken] are the product id and purchase token that the user is upgrading or downgrading from. /// [purchaseToken] must not be `null` if [oldProduct] is not `null`. - /// The [prorationMode](https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.SubscriptionUpdateParams.Builder#setReplaceProrationMode(int)) is the mode of proration during subscription upgrade/downgrade. + /// The [replacementMode](https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.SubscriptionUpdateParams.Builder#setSubscriptionReplacementMode(int)) is the mode of replacement during subscription upgrade/downgrade. /// This value will only be effective if the `oldProduct` is also set. Future launchBillingFlow( {required String product, @@ -190,15 +190,12 @@ class BillingClient { String? obfuscatedProfileId, String? oldProduct, String? purchaseToken, - ProrationMode? prorationMode, ReplacementMode? replacementMode}) async { assert((oldProduct == null) == (purchaseToken == null), 'oldProduct and purchaseToken must both be set, or both be null.'); return resultWrapperFromPlatform( await _hostApi.launchBillingFlow(PlatformBillingFlowParams( product: product, - prorationMode: const ProrationModeConverter().toJson(prorationMode ?? - ProrationMode.unknownSubscriptionUpgradeDowngradePolicy), replacementMode: const ReplacementModeConverter() .toJson(replacementMode ?? ReplacementMode.unknownReplacementMode), offerToken: offerToken, @@ -553,78 +550,6 @@ class ProductTypeConverter implements JsonConverter { String toJson(ProductType object) => _$ProductTypeEnumMap[object]!; } -/// Enum representing the proration mode. -/// -/// When upgrading or downgrading a subscription, set this mode to provide details -/// about the proration that will be applied when the subscription changes. -/// -/// Wraps [`BillingFlowParams.ProrationMode`](https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.ProrationMode) -/// See the linked documentation for an explanation of the different constants. -@JsonEnum(alwaysCreate: true) -enum ProrationMode { -// WARNING: Changes to this class need to be reflected in our generated code. -// Run `flutter packages pub run build_runner watch` to rebuild and watch for -// further changes. - - /// Unknown upgrade or downgrade policy. - @JsonValue(0) - unknownSubscriptionUpgradeDowngradePolicy, - - /// Replacement takes effect immediately, and the remaining time will be prorated - /// and credited to the user. - /// - /// This is the current default behavior. - @JsonValue(1) - immediateWithTimeProration, - - /// Replacement takes effect immediately, and the billing cycle remains the same. - /// - /// The price for the remaining period will be charged. - /// This option is only available for subscription upgrade. - @JsonValue(2) - immediateAndChargeProratedPrice, - - /// Replacement takes effect immediately, and the new price will be charged on next - /// recurrence time. - /// - /// The billing cycle stays the same. - @JsonValue(3) - immediateWithoutProration, - - /// Replacement takes effect when the old plan expires, and the new price will - /// be charged at the same time. - @JsonValue(4) - deferred, - - /// Replacement takes effect immediately, and the user is charged full price - /// of new plan and is given a full billing cycle of subscription, plus - /// remaining prorated time from the old plan. - @JsonValue(5) - immediateAndChargeFullPrice, -} - -/// Serializer for [ProrationMode]. -/// -/// Use these in `@JsonSerializable()` classes by annotating them with -/// `@ProrationModeConverter()`. -class ProrationModeConverter implements JsonConverter { - /// Default const constructor. - const ProrationModeConverter(); - - @override - @Deprecated('JSON serialization is not intended for public use, and will ' - 'be removed in a future version.') - ProrationMode fromJson(int? json) { - if (json == null) { - return ProrationMode.unknownSubscriptionUpgradeDowngradePolicy; - } - return $enumDecode(_$ProrationModeEnumMap, json); - } - - @override - int toJson(ProrationMode object) => _$ProrationModeEnumMap[object]!; -} - /// Enum representing the replacement mode. /// /// When upgrading or downgrading a subscription, set this mode to provide details diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_wrapper.g.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_wrapper.g.dart index eb0033193d95..ea2fb7e75a20 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_wrapper.g.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_wrapper.g.dart @@ -33,15 +33,6 @@ const _$ProductTypeEnumMap = { ProductType.subs: 'subs', }; -const _$ProrationModeEnumMap = { - ProrationMode.unknownSubscriptionUpgradeDowngradePolicy: 0, - ProrationMode.immediateWithTimeProration: 1, - ProrationMode.immediateAndChargeProratedPrice: 2, - ProrationMode.immediateWithoutProration: 3, - ProrationMode.deferred: 4, - ProrationMode.immediateAndChargeFullPrice: 5, -}; - const _$ReplacementModeEnumMap = { ReplacementMode.unknownReplacementMode: 0, ReplacementMode.withTimeProration: 1, diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart index 333ccc83bc25..f39d58173674 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart @@ -162,7 +162,6 @@ class InAppPurchaseAndroidPlatform extends InAppPurchasePlatform { oldProduct: changeSubscriptionParam?.oldPurchaseDetails.productID, purchaseToken: changeSubscriptionParam ?.oldPurchaseDetails.verificationData.serverVerificationData, - prorationMode: changeSubscriptionParam?.prorationMode, replacementMode: changeSubscriptionParam?.replacementMode), ); return billingResultWrapper.responseCode == BillingResponse.ok; 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 abc82bbcfaed..e43a036ab31a 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 @@ -314,7 +314,6 @@ class PlatformBillingConfigResponse { class PlatformBillingFlowParams { PlatformBillingFlowParams({ required this.product, - required this.prorationMode, required this.replacementMode, this.offerToken, this.accountId, @@ -325,8 +324,6 @@ class PlatformBillingFlowParams { String product; - int prorationMode; - int replacementMode; String? offerToken; @@ -342,7 +339,6 @@ class PlatformBillingFlowParams { Object encode() { return [ product, - prorationMode, replacementMode, offerToken, accountId, @@ -356,13 +352,12 @@ class PlatformBillingFlowParams { result as List; return PlatformBillingFlowParams( product: result[0]! as String, - prorationMode: result[1]! as int, - replacementMode: result[2]! as int, - offerToken: result[3] as String?, - accountId: result[4] as String?, - obfuscatedProfileId: result[5] as String?, - oldProduct: result[6] as String?, - purchaseToken: result[7] as String?, + replacementMode: result[1]! as int, + offerToken: result[2] as String?, + accountId: result[3] as String?, + obfuscatedProfileId: result[4] as String?, + oldProduct: result[5] as String?, + purchaseToken: result[6] as String?, ); } } diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/types/change_subscription_param.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/types/change_subscription_param.dart index f76fc3e9005b..25907402469b 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/types/change_subscription_param.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/types/change_subscription_param.dart @@ -10,7 +10,6 @@ class ChangeSubscriptionParam { /// Creates a new change subscription param object with given data ChangeSubscriptionParam({ required this.oldPurchaseDetails, - @Deprecated('Use replacementMode instead') this.prorationMode, this.replacementMode, }); @@ -18,13 +17,6 @@ class ChangeSubscriptionParam { /// upgrade/downgrade from. final GooglePlayPurchaseDetails oldPurchaseDetails; - /// The proration mode. - /// - /// This is an optional parameter that indicates how to handle the existing - /// subscription when the new subscription comes into effect. - @Deprecated('Use replacementMode instead') - final ProrationMode? prorationMode; - /// The replacement mode. /// /// This is an optional parameter that indicates how to handle the existing 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 2eabfcaf2582..498233c9ce41 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 @@ -110,7 +110,6 @@ class PlatformBillingConfigResponse { class PlatformBillingFlowParams { PlatformBillingFlowParams({ required this.product, - required this.prorationMode, required this.replacementMode, required this.offerToken, required this.accountId, @@ -123,7 +122,6 @@ class PlatformBillingFlowParams { // Ideally this would be replaced with an enum on the dart side that maps // to constants on the Java side, but it's deprecated anyway so that will be // resolved during the update to the new API. - final int prorationMode; final int replacementMode; final String? offerToken; final String? accountId; 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 0d94ddc7bf9e..18208350d86d 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 @@ -343,8 +343,8 @@ void main() { const ProductDetailsWrapper productDetails = dummyOneTimeProductDetails; const String accountId = 'hashedAccountId'; const String profileId = 'hashedProfileId'; - const ProrationMode prorationMode = - ProrationMode.immediateAndChargeProratedPrice; + const ReplacementMode replacementMode = + ReplacementMode.chargeProratedPrice; expect( await billingClient.launchBillingFlow( @@ -352,7 +352,7 @@ void main() { accountId: accountId, obfuscatedProfileId: profileId, oldProduct: dummyOldPurchase.products.first, - prorationMode: prorationMode, + replacementMode: replacementMode, purchaseToken: dummyOldPurchase.purchaseToken), equals(expectedBillingResult)); final VerificationResult result = @@ -364,8 +364,8 @@ void main() { expect(params.oldProduct, equals(dummyOldPurchase.products.first)); expect(params.obfuscatedProfileId, equals(profileId)); expect(params.purchaseToken, equals(dummyOldPurchase.purchaseToken)); - expect(params.prorationMode, - const ProrationModeConverter().toJson(prorationMode)); + expect(params.replacementMode, + const ReplacementModeConverter().toJson(replacementMode)); }); test( @@ -380,8 +380,7 @@ void main() { const ProductDetailsWrapper productDetails = dummyOneTimeProductDetails; const String accountId = 'hashedAccountId'; const String profileId = 'hashedProfileId'; - const ProrationMode prorationMode = - ProrationMode.immediateAndChargeFullPrice; + const ReplacementMode replacementMode = ReplacementMode.chargeFullPrice; expect( await billingClient.launchBillingFlow( @@ -389,7 +388,7 @@ void main() { accountId: accountId, obfuscatedProfileId: profileId, oldProduct: dummyOldPurchase.products.first, - prorationMode: prorationMode, + replacementMode: replacementMode, purchaseToken: dummyOldPurchase.purchaseToken), equals(expectedBillingResult)); final VerificationResult result = @@ -401,8 +400,8 @@ void main() { expect(params.oldProduct, equals(dummyOldPurchase.products.first)); expect(params.obfuscatedProfileId, equals(profileId)); expect(params.purchaseToken, equals(dummyOldPurchase.purchaseToken)); - expect(params.prorationMode, - const ProrationModeConverter().toJson(prorationMode)); + expect(params.replacementMode, + const ReplacementModeConverter().toJson(replacementMode)); }); test('handles null accountId', () async { 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 ee183eeba71a..34b974cdae45 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 @@ -717,7 +717,7 @@ void main() { oldPurchaseDetails: GooglePlayPurchaseDetails.fromPurchase( dummyUnacknowledgedPurchase) .first, - prorationMode: ProrationMode.deferred, + replacementMode: ReplacementMode.deferred, )); await iapAndroidPlatform.buyNonConsumable(purchaseParam: purchaseParam); From 6a52e71fb3a83bf64ffc645c0d8e89b0d5e72b2c Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Tue, 26 Nov 2024 01:16:08 +0100 Subject: [PATCH 06/16] Update Android tests Signed-off-by: Marcin Chudy --- .../android/build.gradle | 2 +- .../BillingClientFactoryImpl.java | 7 +- .../plugins/inapppurchase/Messages.java | 672 ++++++++++++------ .../inapppurchase/MethodCallHandlerImpl.java | 2 +- .../plugins/inapppurchase/Translator.java | 9 +- .../inapppurchase/MethodCallHandlerTest.java | 70 +- .../plugins/inapppurchase/TranslatorTest.java | 11 + .../billing_client_wrapper.dart | 1 + .../product_details_wrapper_test.dart | 27 + 9 files changed, 533 insertions(+), 268 deletions(-) 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 faaa4a1a3536..e440b1976171 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 @@ -31,7 +31,7 @@ android { compileSdk 34 defaultConfig { - minSdk 19 + minSdk 21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java index ec3cbca58736..6aaa17b8c5e9 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java @@ -23,9 +23,10 @@ public BillingClient createBillingClient( @NonNull Context context, @NonNull Messages.InAppPurchaseCallbackApi callbackApi, PlatformBillingChoiceMode billingChoiceMode) { - BillingClient.Builder builder = BillingClient.newBuilder(context).enablePendingPurchases( - PendingPurchasesParams.newBuilder().enableOneTimeProducts().build() - ); + BillingClient.Builder builder = + BillingClient.newBuilder(context) + .enablePendingPurchases( + PendingPurchasesParams.newBuilder().enableOneTimeProducts().build()); switch (billingChoiceMode) { case ALTERNATIVE_BILLING_ONLY: // https://developer.android.com/google/play/billing/alternative/alternative-billing-without-user-choice-in-app 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 a82693e899bc..b52ca1d56614 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 @@ -21,11 +21,8 @@ import java.lang.annotation.Target; import java.nio.ByteBuffer; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Objects; /** Generated class from Pigeon. */ @@ -41,8 +38,7 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) - { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { super(message); this.code = code; this.details = details; @@ -61,14 +57,15 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @NonNull protected static FlutterError createConnectionError(@NonNull String channelName) { - return new FlutterError("channel-error", "Unable to establish connection on channel: " + channelName + ".", ""); + return new FlutterError( + "channel-error", "Unable to establish connection on channel: " + channelName + ".", ""); } @Target(METHOD) @@ -92,7 +89,7 @@ public enum PlatformBillingChoiceMode { /** * Billing through google play. * - * Default state. + *

Default state. */ PLAY_BILLING_ONLY(0), /** Billing through app provided flow. */ @@ -136,7 +133,7 @@ public enum PlatformRecurrenceMode { /** * Pigeon version of Java QueryProductDetailsParams.Product. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformQueryProduct { private @NonNull String productId; @@ -170,8 +167,12 @@ public void setProductType(@NonNull PlatformProductType setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformQueryProduct that = (PlatformQueryProduct) o; return productId.equals(that.productId) && productType.equals(that.productType); } @@ -228,7 +229,7 @@ ArrayList toList() { /** * Pigeon version of Java AccountIdentifiers. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformAccountIdentifiers { private @Nullable String obfuscatedAccountId; @@ -253,10 +254,15 @@ public void setObfuscatedProfileId(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformAccountIdentifiers that = (PlatformAccountIdentifiers) o; - return Objects.equals(obfuscatedAccountId, that.obfuscatedAccountId) && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId); + return Objects.equals(obfuscatedAccountId, that.obfuscatedAccountId) + && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId); } @Override @@ -311,7 +317,7 @@ ArrayList toList() { /** * Pigeon version of Java BillingResult. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingResult { private @NonNull Long responseCode; @@ -345,8 +351,12 @@ public void setDebugMessage(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformBillingResult that = (PlatformBillingResult) o; return responseCode.equals(that.responseCode) && debugMessage.equals(that.debugMessage); } @@ -403,7 +413,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.OneTimePurchaseOfferDetails. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformOneTimePurchaseOfferDetails { private @NonNull Long priceAmountMicros; @@ -450,10 +460,16 @@ public void setPriceCurrencyCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformOneTimePurchaseOfferDetails that = (PlatformOneTimePurchaseOfferDetails) o; - return priceAmountMicros.equals(that.priceAmountMicros) && formattedPrice.equals(that.formattedPrice) && priceCurrencyCode.equals(that.priceCurrencyCode); + return priceAmountMicros.equals(that.priceAmountMicros) + && formattedPrice.equals(that.formattedPrice) + && priceCurrencyCode.equals(that.priceCurrencyCode); } @Override @@ -488,7 +504,8 @@ public static final class Builder { } public @NonNull PlatformOneTimePurchaseOfferDetails build() { - PlatformOneTimePurchaseOfferDetails pigeonReturn = new PlatformOneTimePurchaseOfferDetails(); + PlatformOneTimePurchaseOfferDetails pigeonReturn = + new PlatformOneTimePurchaseOfferDetails(); pigeonReturn.setPriceAmountMicros(priceAmountMicros); pigeonReturn.setFormattedPrice(formattedPrice); pigeonReturn.setPriceCurrencyCode(priceCurrencyCode); @@ -505,7 +522,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformOneTimePurchaseOfferDetails fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformOneTimePurchaseOfferDetails fromList( + @NonNull ArrayList pigeonVar_list) { PlatformOneTimePurchaseOfferDetails pigeonResult = new PlatformOneTimePurchaseOfferDetails(); Object priceAmountMicros = pigeonVar_list.get(0); pigeonResult.setPriceAmountMicros((Long) priceAmountMicros); @@ -520,7 +538,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformProductDetails { private @NonNull String description; @@ -594,7 +612,8 @@ public void setTitle(@NonNull String setterArg) { return oneTimePurchaseOfferDetails; } - public void setOneTimePurchaseOfferDetails(@Nullable PlatformOneTimePurchaseOfferDetails setterArg) { + public void setOneTimePurchaseOfferDetails( + @Nullable PlatformOneTimePurchaseOfferDetails setterArg) { this.oneTimePurchaseOfferDetails = setterArg; } @@ -604,7 +623,8 @@ public void setOneTimePurchaseOfferDetails(@Nullable PlatformOneTimePurchaseOffe return subscriptionOfferDetails; } - public void setSubscriptionOfferDetails(@Nullable List setterArg) { + public void setSubscriptionOfferDetails( + @Nullable List setterArg) { this.subscriptionOfferDetails = setterArg; } @@ -613,15 +633,32 @@ public void setSubscriptionOfferDetails(@Nullable List subscriptionOfferDetails; @CanIgnoreReturnValue - public @NonNull Builder setSubscriptionOfferDetails(@Nullable List setterArg) { + public @NonNull Builder setSubscriptionOfferDetails( + @Nullable List setterArg) { this.subscriptionOfferDetails = setterArg; return this; } @@ -721,18 +760,20 @@ ArrayList toList() { Object title = pigeonVar_list.get(4); pigeonResult.setTitle((String) title); Object oneTimePurchaseOfferDetails = pigeonVar_list.get(5); - pigeonResult.setOneTimePurchaseOfferDetails((PlatformOneTimePurchaseOfferDetails) oneTimePurchaseOfferDetails); + pigeonResult.setOneTimePurchaseOfferDetails( + (PlatformOneTimePurchaseOfferDetails) oneTimePurchaseOfferDetails); Object subscriptionOfferDetails = pigeonVar_list.get(6); - pigeonResult.setSubscriptionOfferDetails((List) subscriptionOfferDetails); + pigeonResult.setSubscriptionOfferDetails( + (List) subscriptionOfferDetails); return pigeonResult; } } /** - * 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. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformProductDetailsResponse { private @NonNull PlatformBillingResult billingResult; @@ -766,8 +807,12 @@ public void setProductDetails(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformProductDetailsResponse that = (PlatformProductDetailsResponse) o; return billingResult.equals(that.billingResult) && productDetails.equals(that.productDetails); } @@ -811,7 +856,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformProductDetailsResponse fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformProductDetailsResponse fromList( + @NonNull ArrayList pigeonVar_list) { PlatformProductDetailsResponse pigeonResult = new PlatformProductDetailsResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -822,11 +868,10 @@ ArrayList toList() { } /** - * 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. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformAlternativeBillingOnlyReportingDetailsResponse { private @NonNull PlatformBillingResult billingResult; @@ -860,10 +905,16 @@ public void setExternalTransactionToken(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } - PlatformAlternativeBillingOnlyReportingDetailsResponse that = (PlatformAlternativeBillingOnlyReportingDetailsResponse) o; - return billingResult.equals(that.billingResult) && externalTransactionToken.equals(that.externalTransactionToken); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PlatformAlternativeBillingOnlyReportingDetailsResponse that = + (PlatformAlternativeBillingOnlyReportingDetailsResponse) o; + return billingResult.equals(that.billingResult) + && externalTransactionToken.equals(that.externalTransactionToken); } @Override @@ -890,7 +941,8 @@ public static final class Builder { } public @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse build() { - PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonReturn = new PlatformAlternativeBillingOnlyReportingDetailsResponse(); + PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonReturn = + new PlatformAlternativeBillingOnlyReportingDetailsResponse(); pigeonReturn.setBillingResult(billingResult); pigeonReturn.setExternalTransactionToken(externalTransactionToken); return pigeonReturn; @@ -905,8 +957,10 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse fromList(@NonNull ArrayList pigeonVar_list) { - PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonResult = new PlatformAlternativeBillingOnlyReportingDetailsResponse(); + static @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse fromList( + @NonNull ArrayList pigeonVar_list) { + PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonResult = + new PlatformAlternativeBillingOnlyReportingDetailsResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); Object externalTransactionToken = pigeonVar_list.get(1); @@ -916,10 +970,10 @@ ArrayList toList() { } /** - * 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. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingConfigResponse { private @NonNull PlatformBillingResult billingResult; @@ -953,8 +1007,12 @@ public void setCountryCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformBillingConfigResponse that = (PlatformBillingConfigResponse) o; return billingResult.equals(that.billingResult) && countryCode.equals(that.countryCode); } @@ -998,7 +1056,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformBillingConfigResponse fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformBillingConfigResponse fromList( + @NonNull ArrayList pigeonVar_list) { PlatformBillingConfigResponse pigeonResult = new PlatformBillingConfigResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -1011,7 +1070,7 @@ ArrayList toList() { /** * Pigeon version of Java BillingFlowParams. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingFlowParams { private @NonNull String product; @@ -1095,15 +1154,32 @@ public void setPurchaseToken(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformBillingFlowParams that = (PlatformBillingFlowParams) o; - return product.equals(that.product) && replacementMode.equals(that.replacementMode) && Objects.equals(offerToken, that.offerToken) && Objects.equals(accountId, that.accountId) && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId) && Objects.equals(oldProduct, that.oldProduct) && Objects.equals(purchaseToken, that.purchaseToken); + return product.equals(that.product) + && replacementMode.equals(that.replacementMode) + && Objects.equals(offerToken, that.offerToken) + && Objects.equals(accountId, that.accountId) + && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId) + && Objects.equals(oldProduct, that.oldProduct) + && Objects.equals(purchaseToken, that.purchaseToken); } @Override public int hashCode() { - return Objects.hash(product, replacementMode, offerToken, accountId, obfuscatedProfileId, oldProduct, purchaseToken); + return Objects.hash( + product, + replacementMode, + offerToken, + accountId, + obfuscatedProfileId, + oldProduct, + purchaseToken); } public static final class Builder { @@ -1213,7 +1289,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.PricingPhase. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPricingPhase { private @NonNull Long billingCycleCount; @@ -1299,15 +1375,30 @@ public void setPriceCurrencyCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPricingPhase that = (PlatformPricingPhase) o; - return billingCycleCount.equals(that.billingCycleCount) && recurrenceMode.equals(that.recurrenceMode) && priceAmountMicros.equals(that.priceAmountMicros) && billingPeriod.equals(that.billingPeriod) && formattedPrice.equals(that.formattedPrice) && priceCurrencyCode.equals(that.priceCurrencyCode); + return billingCycleCount.equals(that.billingCycleCount) + && recurrenceMode.equals(that.recurrenceMode) + && priceAmountMicros.equals(that.priceAmountMicros) + && billingPeriod.equals(that.billingPeriod) + && formattedPrice.equals(that.formattedPrice) + && priceCurrencyCode.equals(that.priceCurrencyCode); } @Override public int hashCode() { - return Objects.hash(billingCycleCount, recurrenceMode, priceAmountMicros, billingPeriod, formattedPrice, priceCurrencyCode); + return Objects.hash( + billingCycleCount, + recurrenceMode, + priceAmountMicros, + billingPeriod, + formattedPrice, + priceCurrencyCode); } public static final class Builder { @@ -1405,9 +1496,9 @@ ArrayList toList() { /** * Pigeon version of Java Purchase. * - * See also PurchaseWrapper on the Dart side. + *

See also PurchaseWrapper on the Dart side. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchase { private @Nullable String orderId; @@ -1578,15 +1669,44 @@ public void setAccountIdentifiers(@Nullable PlatformAccountIdentifiers setterArg @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPurchase that = (PlatformPurchase) o; - return Objects.equals(orderId, that.orderId) && packageName.equals(that.packageName) && purchaseTime.equals(that.purchaseTime) && purchaseToken.equals(that.purchaseToken) && signature.equals(that.signature) && products.equals(that.products) && isAutoRenewing.equals(that.isAutoRenewing) && originalJson.equals(that.originalJson) && developerPayload.equals(that.developerPayload) && isAcknowledged.equals(that.isAcknowledged) && quantity.equals(that.quantity) && purchaseState.equals(that.purchaseState) && Objects.equals(accountIdentifiers, that.accountIdentifiers); + return Objects.equals(orderId, that.orderId) + && packageName.equals(that.packageName) + && purchaseTime.equals(that.purchaseTime) + && purchaseToken.equals(that.purchaseToken) + && signature.equals(that.signature) + && products.equals(that.products) + && isAutoRenewing.equals(that.isAutoRenewing) + && originalJson.equals(that.originalJson) + && developerPayload.equals(that.developerPayload) + && isAcknowledged.equals(that.isAcknowledged) + && quantity.equals(that.quantity) + && purchaseState.equals(that.purchaseState) + && Objects.equals(accountIdentifiers, that.accountIdentifiers); } @Override public int hashCode() { - return Objects.hash(orderId, packageName, purchaseTime, purchaseToken, signature, products, isAutoRenewing, originalJson, developerPayload, isAcknowledged, quantity, purchaseState, accountIdentifiers); + return Objects.hash( + orderId, + packageName, + purchaseTime, + purchaseToken, + signature, + products, + isAutoRenewing, + originalJson, + developerPayload, + isAcknowledged, + quantity, + purchaseState, + accountIdentifiers); } public static final class Builder { @@ -1690,7 +1810,8 @@ public static final class Builder { private @Nullable PlatformAccountIdentifiers accountIdentifiers; @CanIgnoreReturnValue - public @NonNull Builder setAccountIdentifiers(@Nullable PlatformAccountIdentifiers setterArg) { + public @NonNull Builder setAccountIdentifiers( + @Nullable PlatformAccountIdentifiers setterArg) { this.accountIdentifiers = setterArg; return this; } @@ -1768,9 +1889,9 @@ ArrayList toList() { /** * Pigeon version of PurchaseHistoryRecord. * - * See also PurchaseHistoryRecordWrapper on the Dart side. + *

See also PurchaseHistoryRecordWrapper on the Dart side. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchaseHistoryRecord { private @NonNull Long quantity; @@ -1866,15 +1987,32 @@ public void setProducts(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPurchaseHistoryRecord that = (PlatformPurchaseHistoryRecord) o; - return quantity.equals(that.quantity) && purchaseTime.equals(that.purchaseTime) && Objects.equals(developerPayload, that.developerPayload) && originalJson.equals(that.originalJson) && purchaseToken.equals(that.purchaseToken) && signature.equals(that.signature) && products.equals(that.products); + return quantity.equals(that.quantity) + && purchaseTime.equals(that.purchaseTime) + && Objects.equals(developerPayload, that.developerPayload) + && originalJson.equals(that.originalJson) + && purchaseToken.equals(that.purchaseToken) + && signature.equals(that.signature) + && products.equals(that.products); } @Override public int hashCode() { - return Objects.hash(quantity, purchaseTime, developerPayload, originalJson, purchaseToken, signature, products); + return Objects.hash( + quantity, + purchaseTime, + developerPayload, + originalJson, + purchaseToken, + signature, + products); } public static final class Builder { @@ -1961,7 +2099,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPurchaseHistoryRecord fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformPurchaseHistoryRecord fromList( + @NonNull ArrayList pigeonVar_list) { PlatformPurchaseHistoryRecord pigeonResult = new PlatformPurchaseHistoryRecord(); Object quantity = pigeonVar_list.get(0); pigeonResult.setQuantity((Long) quantity); @@ -1982,10 +2121,10 @@ ArrayList toList() { } /** - * 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. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchaseHistoryResponse { private @NonNull PlatformBillingResult billingResult; @@ -2019,8 +2158,12 @@ public void setPurchases(@NonNull List setterArg) @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPurchaseHistoryResponse that = (PlatformPurchaseHistoryResponse) o; return billingResult.equals(that.billingResult) && purchases.equals(that.purchases); } @@ -2064,7 +2207,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPurchaseHistoryResponse fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformPurchaseHistoryResponse fromList( + @NonNull ArrayList pigeonVar_list) { PlatformPurchaseHistoryResponse pigeonResult = new PlatformPurchaseHistoryResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -2075,10 +2219,10 @@ ArrayList toList() { } /** - * 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. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchasesResponse { private @NonNull PlatformBillingResult billingResult; @@ -2112,8 +2256,12 @@ public void setPurchases(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPurchasesResponse that = (PlatformPurchasesResponse) o; return billingResult.equals(that.billingResult) && purchases.equals(that.purchases); } @@ -2170,7 +2318,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.SubscriptionOfferDetails. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformSubscriptionOfferDetails { private @NonNull String basePlanId; @@ -2250,15 +2398,25 @@ public void setInstallmentPlanDetails(@Nullable PlatformInstallmentPlanDetails s @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformSubscriptionOfferDetails that = (PlatformSubscriptionOfferDetails) o; - return basePlanId.equals(that.basePlanId) && Objects.equals(offerId, that.offerId) && offerToken.equals(that.offerToken) && offerTags.equals(that.offerTags) && pricingPhases.equals(that.pricingPhases) && Objects.equals(installmentPlanDetails, that.installmentPlanDetails); + return basePlanId.equals(that.basePlanId) + && Objects.equals(offerId, that.offerId) + && offerToken.equals(that.offerToken) + && offerTags.equals(that.offerTags) + && pricingPhases.equals(that.pricingPhases) + && Objects.equals(installmentPlanDetails, that.installmentPlanDetails); } @Override public int hashCode() { - return Objects.hash(basePlanId, offerId, offerToken, offerTags, pricingPhases, installmentPlanDetails); + return Objects.hash( + basePlanId, offerId, offerToken, offerTags, pricingPhases, installmentPlanDetails); } public static final class Builder { @@ -2306,7 +2464,8 @@ public static final class Builder { private @Nullable PlatformInstallmentPlanDetails installmentPlanDetails; @CanIgnoreReturnValue - public @NonNull Builder setInstallmentPlanDetails(@Nullable PlatformInstallmentPlanDetails setterArg) { + public @NonNull Builder setInstallmentPlanDetails( + @Nullable PlatformInstallmentPlanDetails setterArg) { this.installmentPlanDetails = setterArg; return this; } @@ -2335,7 +2494,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformSubscriptionOfferDetails fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformSubscriptionOfferDetails fromList( + @NonNull ArrayList pigeonVar_list) { PlatformSubscriptionOfferDetails pigeonResult = new PlatformSubscriptionOfferDetails(); Object basePlanId = pigeonVar_list.get(0); pigeonResult.setBasePlanId((String) basePlanId); @@ -2348,7 +2508,8 @@ ArrayList toList() { Object pricingPhases = pigeonVar_list.get(4); pigeonResult.setPricingPhases((List) pricingPhases); Object installmentPlanDetails = pigeonVar_list.get(5); - pigeonResult.setInstallmentPlanDetails((PlatformInstallmentPlanDetails) installmentPlanDetails); + pigeonResult.setInstallmentPlanDetails( + (PlatformInstallmentPlanDetails) installmentPlanDetails); return pigeonResult; } } @@ -2356,7 +2517,7 @@ ArrayList toList() { /** * Pigeon version of UserChoiceDetailsWrapper and Java UserChoiceDetails. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformUserChoiceDetails { private @Nullable String originalExternalTransactionId; @@ -2400,10 +2561,16 @@ public void setProducts(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformUserChoiceDetails that = (PlatformUserChoiceDetails) o; - return Objects.equals(originalExternalTransactionId, that.originalExternalTransactionId) && externalTransactionToken.equals(that.externalTransactionToken) && products.equals(that.products); + return Objects.equals(originalExternalTransactionId, that.originalExternalTransactionId) + && externalTransactionToken.equals(that.externalTransactionToken) + && products.equals(that.products); } @Override @@ -2470,7 +2637,7 @@ ArrayList toList() { /** * Pigeon version of UserChoiseDetails.Product. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformUserChoiceProduct { private @NonNull String id; @@ -2514,10 +2681,16 @@ public void setType(@NonNull PlatformProductType setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformUserChoiceProduct that = (PlatformUserChoiceProduct) o; - return id.equals(that.id) && Objects.equals(offerToken, that.offerToken) && type.equals(that.type); + return id.equals(that.id) + && Objects.equals(offerToken, that.offerToken) + && type.equals(that.type); } @Override @@ -2584,7 +2757,7 @@ ArrayList toList() { /** * Pigeon version of ProductDetails.InstallmentPlanDetails. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformInstallmentPlanDetails { private @NonNull Long commitmentPaymentsCount; @@ -2608,7 +2781,8 @@ public void setCommitmentPaymentsCount(@NonNull Long setterArg) { public void setSubsequentCommitmentPaymentsCount(@NonNull Long setterArg) { if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"subsequentCommitmentPaymentsCount\" is null."); + throw new IllegalStateException( + "Nonnull field \"subsequentCommitmentPaymentsCount\" is null."); } this.subsequentCommitmentPaymentsCount = setterArg; } @@ -2618,10 +2792,15 @@ public void setSubsequentCommitmentPaymentsCount(@NonNull Long setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformInstallmentPlanDetails that = (PlatformInstallmentPlanDetails) o; - return commitmentPaymentsCount.equals(that.commitmentPaymentsCount) && subsequentCommitmentPaymentsCount.equals(that.subsequentCommitmentPaymentsCount); + return commitmentPaymentsCount.equals(that.commitmentPaymentsCount) + && subsequentCommitmentPaymentsCount.equals(that.subsequentCommitmentPaymentsCount); } @Override @@ -2663,7 +2842,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformInstallmentPlanDetails fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformInstallmentPlanDetails fromList( + @NonNull ArrayList pigeonVar_list) { PlatformInstallmentPlanDetails pigeonResult = new PlatformInstallmentPlanDetails(); Object commitmentPaymentsCount = pigeonVar_list.get(0); pigeonResult.setCommitmentPaymentsCount((Long) commitmentPaymentsCount); @@ -2681,22 +2861,30 @@ private PigeonCodec() {} @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte) 129: { - Object value = readValue(buffer); - return value == null ? null : PlatformProductType.values()[((Long) value).intValue()]; - } - case (byte) 130: { - Object value = readValue(buffer); - return value == null ? null : PlatformBillingChoiceMode.values()[((Long) value).intValue()]; - } - case (byte) 131: { - Object value = readValue(buffer); - return value == null ? null : PlatformPurchaseState.values()[((Long) value).intValue()]; - } - case (byte) 132: { - Object value = readValue(buffer); - return value == null ? null : PlatformRecurrenceMode.values()[((Long) value).intValue()]; - } + case (byte) 129: + { + Object value = readValue(buffer); + return value == null ? null : PlatformProductType.values()[((Long) value).intValue()]; + } + case (byte) 130: + { + Object value = readValue(buffer); + return value == null + ? null + : PlatformBillingChoiceMode.values()[((Long) value).intValue()]; + } + case (byte) 131: + { + Object value = readValue(buffer); + return value == null ? null : PlatformPurchaseState.values()[((Long) value).intValue()]; + } + case (byte) 132: + { + Object value = readValue(buffer); + return value == null + ? null + : PlatformRecurrenceMode.values()[((Long) value).intValue()]; + } case (byte) 133: return PlatformQueryProduct.fromList((ArrayList) readValue(buffer)); case (byte) 134: @@ -2704,13 +2892,15 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { case (byte) 135: return PlatformBillingResult.fromList((ArrayList) readValue(buffer)); case (byte) 136: - return PlatformOneTimePurchaseOfferDetails.fromList((ArrayList) readValue(buffer)); + return PlatformOneTimePurchaseOfferDetails.fromList( + (ArrayList) readValue(buffer)); case (byte) 137: return PlatformProductDetails.fromList((ArrayList) readValue(buffer)); case (byte) 138: return PlatformProductDetailsResponse.fromList((ArrayList) readValue(buffer)); case (byte) 139: - return PlatformAlternativeBillingOnlyReportingDetailsResponse.fromList((ArrayList) readValue(buffer)); + return PlatformAlternativeBillingOnlyReportingDetailsResponse.fromList( + (ArrayList) readValue(buffer)); case (byte) 140: return PlatformBillingConfigResponse.fromList((ArrayList) readValue(buffer)); case (byte) 141: @@ -2772,7 +2962,8 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { writeValue(stream, ((PlatformProductDetailsResponse) value).toList()); } else if (value instanceof PlatformAlternativeBillingOnlyReportingDetailsResponse) { stream.write(139); - writeValue(stream, ((PlatformAlternativeBillingOnlyReportingDetailsResponse) value).toList()); + writeValue( + stream, ((PlatformAlternativeBillingOnlyReportingDetailsResponse) value).toList()); } else if (value instanceof PlatformBillingConfigResponse) { stream.write(140); writeValue(stream, ((PlatformBillingConfigResponse) value).toList()); @@ -2812,7 +3003,6 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { } } - /** Asynchronous error handling return type for non-nullable API method returns. */ public interface Result { /** Success case callback method for handling returns. */ @@ -2840,51 +3030,86 @@ public interface VoidResult { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InAppPurchaseApi { /** Wraps BillingClient#isReady. */ - @NonNull + @NonNull Boolean isReady(); /** Wraps BillingClient#startConnection(BillingClientStateListener). */ - void startConnection(@NonNull Long callbackHandle, @NonNull PlatformBillingChoiceMode billingMode, @NonNull Result result); + void startConnection( + @NonNull Long callbackHandle, + @NonNull PlatformBillingChoiceMode billingMode, + @NonNull Result result); /** Wraps BillingClient#endConnection(BillingClientStateListener). */ void endConnection(); - /** Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, BillingConfigResponseListener). */ + /** + * Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, + * BillingConfigResponseListener). + */ void getBillingConfigAsync(@NonNull Result result); /** Wraps BillingClient#launchBillingFlow(Activity, BillingFlowParams). */ - @NonNull + @NonNull PlatformBillingResult launchBillingFlow(@NonNull PlatformBillingFlowParams params); - /** Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, AcknowledgePurchaseResponseListener). */ - void acknowledgePurchase(@NonNull String purchaseToken, @NonNull Result result); + /** + * Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, + * AcknowledgePurchaseResponseListener). + */ + void acknowledgePurchase( + @NonNull String purchaseToken, @NonNull Result result); /** Wraps BillingClient#consumeAsync(ConsumeParams, ConsumeResponseListener). */ void consumeAsync(@NonNull String purchaseToken, @NonNull Result result); /** Wraps BillingClient#queryPurchasesAsync(QueryPurchaseParams, PurchaseResponseListener). */ - 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). */ - void queryProductDetailsAsync(@NonNull List products, @NonNull Result result); + 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). + */ + void queryProductDetailsAsync( + @NonNull List products, + @NonNull Result result); /** Wraps BillingClient#isFeatureSupported(String). */ - @NonNull + @NonNull Boolean isFeatureSupported(@NonNull String feature); /** Wraps BillingClient#isAlternativeBillingOnlyAvailableAsync(). */ void isAlternativeBillingOnlyAvailableAsync(@NonNull Result result); /** Wraps BillingClient#showAlternativeBillingOnlyInformationDialog(). */ void showAlternativeBillingOnlyInformationDialog(@NonNull Result result); - /** Wraps BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). */ - void createAlternativeBillingOnlyReportingDetailsAsync(@NonNull Result result); + /** + * Wraps + * BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). + */ + void createAlternativeBillingOnlyReportingDetailsAsync( + @NonNull Result result); /** The codec used by InAppPurchaseApi. */ static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } - /**Sets up an instance of `InAppPurchaseApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `InAppPurchaseApi` to handle messages through the `binaryMessenger`. + */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable InAppPurchaseApi api) { setUp(binaryMessenger, "", api); } - static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String messageChannelSuffix, @Nullable InAppPurchaseApi api) { + + static void setUp( + @NonNull BinaryMessenger binaryMessenger, + @NonNull String messageChannelSuffix, + @Nullable InAppPurchaseApi api) { messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2892,8 +3117,7 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String mess try { Boolean output = api.isReady(); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -2905,7 +3129,10 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String mess { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2935,7 +3162,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2943,8 +3173,7 @@ public void error(Throwable error) { try { api.endConnection(); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -2956,7 +3185,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2983,7 +3215,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2993,8 +3228,7 @@ public void error(Throwable error) { try { PlatformBillingResult output = api.launchBillingFlow(paramsArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3006,7 +3240,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3035,7 +3272,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3064,7 +3304,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3093,7 +3336,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3122,7 +3368,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3151,7 +3400,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3161,8 +3413,7 @@ public void error(Throwable error) { try { Boolean output = api.isFeatureSupported(featureArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3174,7 +3425,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3201,7 +3455,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3228,14 +3485,18 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList wrapped = new ArrayList<>(); Result resultCallback = new Result() { - public void success(PlatformAlternativeBillingOnlyReportingDetailsResponse result) { + public void success( + PlatformAlternativeBillingOnlyReportingDetailsResponse result) { wrapped.add(0, result); reply.reply(wrapped); } @@ -3262,79 +3523,90 @@ public static class InAppPurchaseCallbackApi { public InAppPurchaseCallbackApi(@NonNull BinaryMessenger argBinaryMessenger) { this(argBinaryMessenger, ""); } - public InAppPurchaseCallbackApi(@NonNull BinaryMessenger argBinaryMessenger, @NonNull String messageChannelSuffix) { + + public InAppPurchaseCallbackApi( + @NonNull BinaryMessenger argBinaryMessenger, @NonNull String messageChannelSuffix) { this.binaryMessenger = argBinaryMessenger; this.messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; } - /** - * Public interface for sending reply. - * The codec used by InAppPurchaseCallbackApi. - */ + /** Public interface for sending reply. The codec used by InAppPurchaseCallbackApi. */ static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } /** Called for BillingClientStateListener#onBillingServiceDisconnected(). */ - public void onBillingServiceDisconnected(@NonNull Long callbackHandleArg, @NonNull VoidResult result) { - final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected" + messageChannelSuffix; + public void onBillingServiceDisconnected( + @NonNull Long callbackHandleArg, @NonNull VoidResult result) { + final String channelName = + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected" + + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(callbackHandleArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error( + new FlutterError( + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } /** Called for PurchasesUpdatedListener#onPurchasesUpdated(BillingResult, List). */ - public void onPurchasesUpdated(@NonNull PlatformPurchasesResponse updateArg, @NonNull VoidResult result) { - final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated" + messageChannelSuffix; + public void onPurchasesUpdated( + @NonNull PlatformPurchasesResponse updateArg, @NonNull VoidResult result) { + final String channelName = + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated" + + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(updateArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error( + new FlutterError( + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } /** Called for UserChoiceBillingListener#userSelectedAlternativeBilling(UserChoiceDetails). */ - public void userSelectedalternativeBilling(@NonNull PlatformUserChoiceDetails detailsArg, @NonNull VoidResult result) { - final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling" + messageChannelSuffix; + public void userSelectedalternativeBilling( + @NonNull PlatformUserChoiceDetails detailsArg, @NonNull VoidResult result) { + final String channelName = + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling" + + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(detailsArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error( + new FlutterError( + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } } 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 ea20b017dfb2..a56729e64783 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 @@ -283,7 +283,7 @@ public void queryProductDetailsAsync( if (params.getOldProduct() == null && (params.getReplacementMode() - != REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY)) { + != REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY)) { throw new FlutterError( "IN_APP_PURCHASE_REQUIRE_OLD_PRODUCT", "launchBillingFlow failed because oldProduct is null. You must provide a valid oldProduct in order to use a replacement mode.", 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 31292a599b37..db31226eebbf 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 @@ -146,7 +146,8 @@ static PlatformProductType toPlatformProductType(@NonNull String typeString) { .setOfferTags(subscriptionOfferDetails.getOfferTags()) .setOfferToken(subscriptionOfferDetails.getOfferToken()) .setPricingPhases(fromPricingPhases(subscriptionOfferDetails.getPricingPhases())) - .setInstallmentPlanDetails(fromInstallmentPlanDetails(subscriptionOfferDetails.getInstallmentPlanDetails())) + .setInstallmentPlanDetails( + fromInstallmentPlanDetails(subscriptionOfferDetails.getInstallmentPlanDetails())) .build(); } @@ -178,8 +179,10 @@ static PlatformProductType toPlatformProductType(@NonNull String typeString) { } return new Messages.PlatformInstallmentPlanDetails.Builder() - .setCommitmentPaymentsCount((long) installmentPlanDetails.getInstallmentPlanCommitmentPaymentsCount()) - .setSubsequentCommitmentPaymentsCount((long) installmentPlanDetails.getSubsequentInstallmentPlanCommitmentPaymentsCount()) + .setCommitmentPaymentsCount( + (long) installmentPlanDetails.getInstallmentPlanCommitmentPaymentsCount()) + .setSubsequentCommitmentPaymentsCount( + (long) installmentPlanDetails.getSubsequentInstallmentPlanCommitmentPaymentsCount()) .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 c6dcff2764d6..5bc6555cdd0f 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 @@ -5,7 +5,6 @@ package io.flutter.plugins.inapppurchase; import static io.flutter.plugins.inapppurchase.MethodCallHandlerImpl.ACTIVITY_UNAVAILABLE; -import static io.flutter.plugins.inapppurchase.MethodCallHandlerImpl.PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY; import static io.flutter.plugins.inapppurchase.MethodCallHandlerImpl.REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; @@ -677,27 +676,22 @@ public void launchBillingFlow_ok_AccountId() { assertResultsMatch(platformResult, billingResult); } - // TODO(gmackall): Replace uses of deprecated ProrationMode enum values with new - // ReplacementMode enum values. - // https://github.com/flutter/flutter/issues/128957. @Test - @SuppressWarnings(value = "deprecation") public void launchBillingFlow_ok_Proration() { // Fetch the product details first and query the method call String productId = "foo"; String oldProductId = "oldFoo"; String purchaseToken = "purchaseTokenFoo"; String accountId = "account"; - int prorationMode = BillingFlowParams.ProrationMode.IMMEDIATE_AND_CHARGE_PRORATED_PRICE; + int replacementMode = + BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.CHARGE_PRORATED_PRICE; queryForProducts(unmodifiableList(asList(productId, oldProductId))); PlatformBillingFlowParams.Builder paramsBuilder = new PlatformBillingFlowParams.Builder(); paramsBuilder.setProduct(productId); paramsBuilder.setAccountId(accountId); paramsBuilder.setOldProduct(oldProductId); paramsBuilder.setPurchaseToken(purchaseToken); - paramsBuilder.setProrationMode((long) prorationMode); - paramsBuilder.setReplacementMode( - (long) REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); + paramsBuilder.setReplacementMode((long) replacementMode); // Launch the billing flow BillingResult billingResult = buildBillingResult(); @@ -714,25 +708,20 @@ public void launchBillingFlow_ok_Proration() { assertResultsMatch(platformResult, billingResult); } - // TODO(gmackall): Replace uses of deprecated ProrationMode enum values with new - // ReplacementMode enum values. - // https://github.com/flutter/flutter/issues/128957. @Test - @SuppressWarnings(value = "deprecation") public void launchBillingFlow_ok_Proration_with_null_OldProduct() { // Fetch the product details first and query the method call String productId = "foo"; String accountId = "account"; String queryOldProductId = "oldFoo"; - int prorationMode = BillingFlowParams.ProrationMode.IMMEDIATE_AND_CHARGE_PRORATED_PRICE; + int replacementMode = + BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.CHARGE_PRORATED_PRICE; queryForProducts(unmodifiableList(asList(productId, queryOldProductId))); PlatformBillingFlowParams.Builder paramsBuilder = new PlatformBillingFlowParams.Builder(); paramsBuilder.setProduct(productId); paramsBuilder.setAccountId(accountId); paramsBuilder.setOldProduct(null); - paramsBuilder.setProrationMode((long) prorationMode); - paramsBuilder.setReplacementMode( - (long) REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); + paramsBuilder.setReplacementMode((long) replacementMode); // Launch the billing flow BillingResult billingResult = buildBillingResult(); @@ -763,8 +752,6 @@ public void launchBillingFlow_ok_Replacement_with_null_OldProduct() { paramsBuilder.setProduct(productId); paramsBuilder.setAccountId(accountId); paramsBuilder.setOldProduct(null); - paramsBuilder.setProrationMode( - (long) PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); paramsBuilder.setReplacementMode((long) replacementMode); // Launch the billing flow @@ -783,51 +770,14 @@ public void launchBillingFlow_ok_Replacement_with_null_OldProduct() { } @Test - @SuppressWarnings(value = "deprecation") - public void launchBillingFlow_ok_Proration_and_Replacement_conflict() { - // Fetch the product details first and query the method call - String productId = "foo"; - String accountId = "account"; - String queryOldProductId = "oldFoo"; - int prorationMode = BillingFlowParams.ProrationMode.IMMEDIATE_AND_CHARGE_PRORATED_PRICE; - int replacementMode = - BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.CHARGE_PRORATED_PRICE; - queryForProducts(unmodifiableList(asList(productId, queryOldProductId))); - PlatformBillingFlowParams.Builder paramsBuilder = new PlatformBillingFlowParams.Builder(); - paramsBuilder.setProduct(productId); - paramsBuilder.setAccountId(accountId); - paramsBuilder.setOldProduct(queryOldProductId); - paramsBuilder.setProrationMode((long) prorationMode); - paramsBuilder.setReplacementMode((long) replacementMode); - - // Launch the billing flow - BillingResult billingResult = buildBillingResult(); - when(mockBillingClient.launchBillingFlow(any(), any())).thenReturn(billingResult); - - // Assert that the synchronous call throws an exception. - FlutterError exception = - assertThrows( - FlutterError.class, - () -> methodChannelHandler.launchBillingFlow(paramsBuilder.build())); - assertEquals("IN_APP_PURCHASE_CONFLICT_PRORATION_MODE_REPLACEMENT_MODE", exception.code); - assertTrue( - Objects.requireNonNull(exception.getMessage()) - .contains( - "launchBillingFlow failed because you provided both prorationMode and replacementMode. You can only provide one of them.")); - } - - // TODO(gmackall): Replace uses of deprecated ProrationMode enum values with new - // ReplacementMode enum values. - // https://github.com/flutter/flutter/issues/128957. - @Test - @SuppressWarnings(value = "deprecation") public void launchBillingFlow_ok_Full() { // Fetch the product details first and query the method call String productId = "foo"; String oldProductId = "oldFoo"; String purchaseToken = "purchaseTokenFoo"; String accountId = "account"; - int replacementMode = BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.CHARGE_FULL_PRICE; + int replacementMode = + BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.CHARGE_FULL_PRICE; queryForProducts(unmodifiableList(asList(productId, oldProductId))); PlatformBillingFlowParams.Builder paramsBuilder = new PlatformBillingFlowParams.Builder(); paramsBuilder.setProduct(productId); @@ -835,8 +785,6 @@ public void launchBillingFlow_ok_Full() { paramsBuilder.setOldProduct(oldProductId); paramsBuilder.setPurchaseToken(purchaseToken); paramsBuilder.setReplacementMode((long) replacementMode); - paramsBuilder.setReplacementMode( - (long) REPLACEMENT_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY); // Launch the billing flow BillingResult billingResult = buildBillingResult(); @@ -972,6 +920,7 @@ public void queryPurchases_returns_success() { } @Test + @SuppressWarnings(value = "deprecation") public void queryPurchaseHistoryAsync() { // Set up an established billing client and all our mocked responses establishConnectedBillingClient(); @@ -999,6 +948,7 @@ public void queryPurchaseHistoryAsync() { } @Test + @SuppressWarnings(value = "deprecation") public void queryPurchaseHistoryAsync_clientDisconnected() { methodChannelHandler.endConnection(); 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 fff2ef2ffbc1..4e61be83e549 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 @@ -242,6 +242,7 @@ private void assertSerialized( assertEquals(expected.getOfferTags(), serialized.getOfferTags()); assertEquals(expected.getOfferToken(), serialized.getOfferToken()); assertSerialized(expected.getPricingPhases(), serialized.getPricingPhases()); + assertSerialized(expected.getInstallmentPlanDetails(), serialized.getInstallmentPlanDetails()); } private void assertSerialized( @@ -287,6 +288,16 @@ private void assertSerialized(Purchase expected, Messages.PlatformPurchase seria Objects.requireNonNull(serialized.getAccountIdentifiers()).getObfuscatedProfileId()); } + private void assertSerialized(ProductDetails.InstallmentPlanDetails expected, + Messages.PlatformInstallmentPlanDetails serialized) { + assertEquals( + expected.getInstallmentPlanCommitmentPaymentsCount(), + serialized.getCommitmentPaymentsCount().intValue()); + assertEquals( + expected.getSubsequentInstallmentPlanCommitmentPaymentsCount(), + serialized.getSubsequentCommitmentPaymentsCount().intValue()); + } + private String productTypeFromPlatform(Messages.PlatformProductType type) { switch (type) { case 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 c030c7c62e8a..41ff39a2adea 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 @@ -250,6 +250,7 @@ class BillingClient { /// /// 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( 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 3bd6a497490f..685966fa2882 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 @@ -42,6 +42,10 @@ const ProductDetailsWrapper dummySubscriptionProductDetails = recurrenceMode: RecurrenceMode.finiteRecurring, ), ], + installmentPlanDetails: InstallmentPlanDetailsWrapper( + commitmentPaymentsCount: 1, + subsequentCommitmentPaymentsCount: 2, + ), ), ], ); @@ -191,6 +195,10 @@ void main() { recurrenceMode: RecurrenceMode.finiteRecurring, ), ], + installmentPlanDetails: InstallmentPlanDetailsWrapper( + commitmentPaymentsCount: 1, + subsequentCommitmentPaymentsCount: 2, + ), ), ], ); @@ -221,6 +229,10 @@ void main() { recurrenceMode: RecurrenceMode.finiteRecurring, ), ], + installmentPlanDetails: InstallmentPlanDetailsWrapper( + commitmentPaymentsCount: 1, + subsequentCommitmentPaymentsCount: 2, + ), ), ], ); @@ -291,6 +303,8 @@ Map buildSubscriptionMap( 'offerTags': original.offerTags, 'offerIdToken': original.offerIdToken, 'pricingPhases': buildPricingPhaseMapList(original.pricingPhases), + 'installmentPlanDetails': + buildInstallmentPlanMap(original.installmentPlanDetails), }; } @@ -313,3 +327,16 @@ Map buildPricingPhaseMap(PricingPhaseWrapper original) { const RecurrenceModeConverter().toJson(original.recurrenceMode), }; } + +Map buildInstallmentPlanMap( + InstallmentPlanDetailsWrapper? installmentPlanDetails) { + if (installmentPlanDetails == null) { + return {}; + } + + return { + 'commitmentPaymentsCount': installmentPlanDetails.commitmentPaymentsCount, + 'subsequentCommitmentPaymentsCount': + installmentPlanDetails.subsequentCommitmentPaymentsCount, + }; +} From 8ec4ad0487fef6d8261b3a2e3f3024c9455de5d1 Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Tue, 26 Nov 2024 01:58:47 +0100 Subject: [PATCH 07/16] Add PendingPurchaseUpdate model Signed-off-by: Marcin Chudy --- .../plugins/inapppurchase/Messages.java | 821 +++++++----------- .../plugins/inapppurchase/Translator.java | 19 + .../purchase_wrapper.dart | 59 +- .../purchase_wrapper.g.dart | 13 + .../lib/src/messages.g.dart | 65 +- .../lib/src/pigeon_converters.dart | 14 + .../pigeons/messages.dart | 15 + .../product_details_wrapper_test.dart | 4 +- .../purchase_wrapper_test.dart | 58 ++ 9 files changed, 565 insertions(+), 503 deletions(-) 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 b52ca1d56614..b5d4019e8541 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 @@ -21,8 +21,11 @@ import java.lang.annotation.Target; import java.nio.ByteBuffer; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; /** Generated class from Pigeon. */ @@ -38,7 +41,8 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) + { super(message); this.code = code; this.details = details; @@ -57,15 +61,14 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @NonNull protected static FlutterError createConnectionError(@NonNull String channelName) { - return new FlutterError( - "channel-error", "Unable to establish connection on channel: " + channelName + ".", ""); + return new FlutterError("channel-error", "Unable to establish connection on channel: " + channelName + ".", ""); } @Target(METHOD) @@ -89,7 +92,7 @@ public enum PlatformBillingChoiceMode { /** * Billing through google play. * - *

Default state. + * Default state. */ PLAY_BILLING_ONLY(0), /** Billing through app provided flow. */ @@ -133,7 +136,7 @@ public enum PlatformRecurrenceMode { /** * Pigeon version of Java QueryProductDetailsParams.Product. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformQueryProduct { private @NonNull String productId; @@ -167,12 +170,8 @@ public void setProductType(@NonNull PlatformProductType setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformQueryProduct that = (PlatformQueryProduct) o; return productId.equals(that.productId) && productType.equals(that.productType); } @@ -229,7 +228,7 @@ ArrayList toList() { /** * Pigeon version of Java AccountIdentifiers. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformAccountIdentifiers { private @Nullable String obfuscatedAccountId; @@ -254,15 +253,10 @@ public void setObfuscatedProfileId(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformAccountIdentifiers that = (PlatformAccountIdentifiers) o; - return Objects.equals(obfuscatedAccountId, that.obfuscatedAccountId) - && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId); + return Objects.equals(obfuscatedAccountId, that.obfuscatedAccountId) && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId); } @Override @@ -317,7 +311,7 @@ ArrayList toList() { /** * Pigeon version of Java BillingResult. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingResult { private @NonNull Long responseCode; @@ -351,12 +345,8 @@ public void setDebugMessage(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformBillingResult that = (PlatformBillingResult) o; return responseCode.equals(that.responseCode) && debugMessage.equals(that.debugMessage); } @@ -413,7 +403,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.OneTimePurchaseOfferDetails. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformOneTimePurchaseOfferDetails { private @NonNull Long priceAmountMicros; @@ -460,16 +450,10 @@ public void setPriceCurrencyCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformOneTimePurchaseOfferDetails that = (PlatformOneTimePurchaseOfferDetails) o; - return priceAmountMicros.equals(that.priceAmountMicros) - && formattedPrice.equals(that.formattedPrice) - && priceCurrencyCode.equals(that.priceCurrencyCode); + return priceAmountMicros.equals(that.priceAmountMicros) && formattedPrice.equals(that.formattedPrice) && priceCurrencyCode.equals(that.priceCurrencyCode); } @Override @@ -504,8 +488,7 @@ public static final class Builder { } public @NonNull PlatformOneTimePurchaseOfferDetails build() { - PlatformOneTimePurchaseOfferDetails pigeonReturn = - new PlatformOneTimePurchaseOfferDetails(); + PlatformOneTimePurchaseOfferDetails pigeonReturn = new PlatformOneTimePurchaseOfferDetails(); pigeonReturn.setPriceAmountMicros(priceAmountMicros); pigeonReturn.setFormattedPrice(formattedPrice); pigeonReturn.setPriceCurrencyCode(priceCurrencyCode); @@ -522,8 +505,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformOneTimePurchaseOfferDetails fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformOneTimePurchaseOfferDetails fromList(@NonNull ArrayList pigeonVar_list) { PlatformOneTimePurchaseOfferDetails pigeonResult = new PlatformOneTimePurchaseOfferDetails(); Object priceAmountMicros = pigeonVar_list.get(0); pigeonResult.setPriceAmountMicros((Long) priceAmountMicros); @@ -538,7 +520,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformProductDetails { private @NonNull String description; @@ -612,8 +594,7 @@ public void setTitle(@NonNull String setterArg) { return oneTimePurchaseOfferDetails; } - public void setOneTimePurchaseOfferDetails( - @Nullable PlatformOneTimePurchaseOfferDetails setterArg) { + public void setOneTimePurchaseOfferDetails(@Nullable PlatformOneTimePurchaseOfferDetails setterArg) { this.oneTimePurchaseOfferDetails = setterArg; } @@ -623,8 +604,7 @@ public void setOneTimePurchaseOfferDetails( return subscriptionOfferDetails; } - public void setSubscriptionOfferDetails( - @Nullable List setterArg) { + public void setSubscriptionOfferDetails(@Nullable List setterArg) { this.subscriptionOfferDetails = setterArg; } @@ -633,32 +613,15 @@ public void setSubscriptionOfferDetails( @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformProductDetails that = (PlatformProductDetails) o; - return description.equals(that.description) - && name.equals(that.name) - && productId.equals(that.productId) - && productType.equals(that.productType) - && title.equals(that.title) - && Objects.equals(oneTimePurchaseOfferDetails, that.oneTimePurchaseOfferDetails) - && Objects.equals(subscriptionOfferDetails, that.subscriptionOfferDetails); + return description.equals(that.description) && name.equals(that.name) && productId.equals(that.productId) && productType.equals(that.productType) && title.equals(that.title) && Objects.equals(oneTimePurchaseOfferDetails, that.oneTimePurchaseOfferDetails) && Objects.equals(subscriptionOfferDetails, that.subscriptionOfferDetails); } @Override public int hashCode() { - return Objects.hash( - description, - name, - productId, - productType, - title, - oneTimePurchaseOfferDetails, - subscriptionOfferDetails); + return Objects.hash(description, name, productId, productType, title, oneTimePurchaseOfferDetails, subscriptionOfferDetails); } public static final class Builder { @@ -706,8 +669,7 @@ public static final class Builder { private @Nullable PlatformOneTimePurchaseOfferDetails oneTimePurchaseOfferDetails; @CanIgnoreReturnValue - public @NonNull Builder setOneTimePurchaseOfferDetails( - @Nullable PlatformOneTimePurchaseOfferDetails setterArg) { + public @NonNull Builder setOneTimePurchaseOfferDetails(@Nullable PlatformOneTimePurchaseOfferDetails setterArg) { this.oneTimePurchaseOfferDetails = setterArg; return this; } @@ -715,8 +677,7 @@ public static final class Builder { private @Nullable List subscriptionOfferDetails; @CanIgnoreReturnValue - public @NonNull Builder setSubscriptionOfferDetails( - @Nullable List setterArg) { + public @NonNull Builder setSubscriptionOfferDetails(@Nullable List setterArg) { this.subscriptionOfferDetails = setterArg; return this; } @@ -760,20 +721,18 @@ ArrayList toList() { Object title = pigeonVar_list.get(4); pigeonResult.setTitle((String) title); Object oneTimePurchaseOfferDetails = pigeonVar_list.get(5); - pigeonResult.setOneTimePurchaseOfferDetails( - (PlatformOneTimePurchaseOfferDetails) oneTimePurchaseOfferDetails); + pigeonResult.setOneTimePurchaseOfferDetails((PlatformOneTimePurchaseOfferDetails) oneTimePurchaseOfferDetails); Object subscriptionOfferDetails = pigeonVar_list.get(6); - pigeonResult.setSubscriptionOfferDetails( - (List) subscriptionOfferDetails); + pigeonResult.setSubscriptionOfferDetails((List) subscriptionOfferDetails); return pigeonResult; } } /** - * 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. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformProductDetailsResponse { private @NonNull PlatformBillingResult billingResult; @@ -807,12 +766,8 @@ public void setProductDetails(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformProductDetailsResponse that = (PlatformProductDetailsResponse) o; return billingResult.equals(that.billingResult) && productDetails.equals(that.productDetails); } @@ -856,8 +811,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformProductDetailsResponse fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformProductDetailsResponse fromList(@NonNull ArrayList pigeonVar_list) { PlatformProductDetailsResponse pigeonResult = new PlatformProductDetailsResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -868,10 +822,11 @@ ArrayList toList() { } /** - * 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. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformAlternativeBillingOnlyReportingDetailsResponse { private @NonNull PlatformBillingResult billingResult; @@ -905,16 +860,10 @@ public void setExternalTransactionToken(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformAlternativeBillingOnlyReportingDetailsResponse that = - (PlatformAlternativeBillingOnlyReportingDetailsResponse) o; - return billingResult.equals(that.billingResult) - && externalTransactionToken.equals(that.externalTransactionToken); + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + PlatformAlternativeBillingOnlyReportingDetailsResponse that = (PlatformAlternativeBillingOnlyReportingDetailsResponse) o; + return billingResult.equals(that.billingResult) && externalTransactionToken.equals(that.externalTransactionToken); } @Override @@ -941,8 +890,7 @@ public static final class Builder { } public @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse build() { - PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonReturn = - new PlatformAlternativeBillingOnlyReportingDetailsResponse(); + PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonReturn = new PlatformAlternativeBillingOnlyReportingDetailsResponse(); pigeonReturn.setBillingResult(billingResult); pigeonReturn.setExternalTransactionToken(externalTransactionToken); return pigeonReturn; @@ -957,10 +905,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse fromList( - @NonNull ArrayList pigeonVar_list) { - PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonResult = - new PlatformAlternativeBillingOnlyReportingDetailsResponse(); + static @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse fromList(@NonNull ArrayList pigeonVar_list) { + PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonResult = new PlatformAlternativeBillingOnlyReportingDetailsResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); Object externalTransactionToken = pigeonVar_list.get(1); @@ -970,10 +916,10 @@ ArrayList toList() { } /** - * 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. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingConfigResponse { private @NonNull PlatformBillingResult billingResult; @@ -1007,12 +953,8 @@ public void setCountryCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformBillingConfigResponse that = (PlatformBillingConfigResponse) o; return billingResult.equals(that.billingResult) && countryCode.equals(that.countryCode); } @@ -1056,8 +998,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformBillingConfigResponse fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformBillingConfigResponse fromList(@NonNull ArrayList pigeonVar_list) { PlatformBillingConfigResponse pigeonResult = new PlatformBillingConfigResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -1070,7 +1011,7 @@ ArrayList toList() { /** * Pigeon version of Java BillingFlowParams. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingFlowParams { private @NonNull String product; @@ -1154,32 +1095,15 @@ public void setPurchaseToken(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformBillingFlowParams that = (PlatformBillingFlowParams) o; - return product.equals(that.product) - && replacementMode.equals(that.replacementMode) - && Objects.equals(offerToken, that.offerToken) - && Objects.equals(accountId, that.accountId) - && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId) - && Objects.equals(oldProduct, that.oldProduct) - && Objects.equals(purchaseToken, that.purchaseToken); + return product.equals(that.product) && replacementMode.equals(that.replacementMode) && Objects.equals(offerToken, that.offerToken) && Objects.equals(accountId, that.accountId) && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId) && Objects.equals(oldProduct, that.oldProduct) && Objects.equals(purchaseToken, that.purchaseToken); } @Override public int hashCode() { - return Objects.hash( - product, - replacementMode, - offerToken, - accountId, - obfuscatedProfileId, - oldProduct, - purchaseToken); + return Objects.hash(product, replacementMode, offerToken, accountId, obfuscatedProfileId, oldProduct, purchaseToken); } public static final class Builder { @@ -1289,7 +1213,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.PricingPhase. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPricingPhase { private @NonNull Long billingCycleCount; @@ -1375,30 +1299,15 @@ public void setPriceCurrencyCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPricingPhase that = (PlatformPricingPhase) o; - return billingCycleCount.equals(that.billingCycleCount) - && recurrenceMode.equals(that.recurrenceMode) - && priceAmountMicros.equals(that.priceAmountMicros) - && billingPeriod.equals(that.billingPeriod) - && formattedPrice.equals(that.formattedPrice) - && priceCurrencyCode.equals(that.priceCurrencyCode); + return billingCycleCount.equals(that.billingCycleCount) && recurrenceMode.equals(that.recurrenceMode) && priceAmountMicros.equals(that.priceAmountMicros) && billingPeriod.equals(that.billingPeriod) && formattedPrice.equals(that.formattedPrice) && priceCurrencyCode.equals(that.priceCurrencyCode); } @Override public int hashCode() { - return Objects.hash( - billingCycleCount, - recurrenceMode, - priceAmountMicros, - billingPeriod, - formattedPrice, - priceCurrencyCode); + return Objects.hash(billingCycleCount, recurrenceMode, priceAmountMicros, billingPeriod, formattedPrice, priceCurrencyCode); } public static final class Builder { @@ -1496,9 +1405,9 @@ ArrayList toList() { /** * Pigeon version of Java Purchase. * - *

See also PurchaseWrapper on the Dart side. + * See also PurchaseWrapper on the Dart side. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchase { private @Nullable String orderId; @@ -1664,49 +1573,30 @@ public void setAccountIdentifiers(@Nullable PlatformAccountIdentifiers setterArg this.accountIdentifiers = setterArg; } + private @Nullable PlatformPendingPurchaseUpdate pendingPurchaseUpdate; + + public @Nullable PlatformPendingPurchaseUpdate getPendingPurchaseUpdate() { + return pendingPurchaseUpdate; + } + + public void setPendingPurchaseUpdate(@Nullable PlatformPendingPurchaseUpdate setterArg) { + this.pendingPurchaseUpdate = setterArg; + } + /** Constructor is non-public to enforce null safety; use Builder. */ PlatformPurchase() {} @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPurchase that = (PlatformPurchase) o; - return Objects.equals(orderId, that.orderId) - && packageName.equals(that.packageName) - && purchaseTime.equals(that.purchaseTime) - && purchaseToken.equals(that.purchaseToken) - && signature.equals(that.signature) - && products.equals(that.products) - && isAutoRenewing.equals(that.isAutoRenewing) - && originalJson.equals(that.originalJson) - && developerPayload.equals(that.developerPayload) - && isAcknowledged.equals(that.isAcknowledged) - && quantity.equals(that.quantity) - && purchaseState.equals(that.purchaseState) - && Objects.equals(accountIdentifiers, that.accountIdentifiers); + return Objects.equals(orderId, that.orderId) && packageName.equals(that.packageName) && purchaseTime.equals(that.purchaseTime) && purchaseToken.equals(that.purchaseToken) && signature.equals(that.signature) && products.equals(that.products) && isAutoRenewing.equals(that.isAutoRenewing) && originalJson.equals(that.originalJson) && developerPayload.equals(that.developerPayload) && isAcknowledged.equals(that.isAcknowledged) && quantity.equals(that.quantity) && purchaseState.equals(that.purchaseState) && Objects.equals(accountIdentifiers, that.accountIdentifiers) && Objects.equals(pendingPurchaseUpdate, that.pendingPurchaseUpdate); } @Override public int hashCode() { - return Objects.hash( - orderId, - packageName, - purchaseTime, - purchaseToken, - signature, - products, - isAutoRenewing, - originalJson, - developerPayload, - isAcknowledged, - quantity, - purchaseState, - accountIdentifiers); + return Objects.hash(orderId, packageName, purchaseTime, purchaseToken, signature, products, isAutoRenewing, originalJson, developerPayload, isAcknowledged, quantity, purchaseState, accountIdentifiers, pendingPurchaseUpdate); } public static final class Builder { @@ -1810,12 +1700,19 @@ public static final class Builder { private @Nullable PlatformAccountIdentifiers accountIdentifiers; @CanIgnoreReturnValue - public @NonNull Builder setAccountIdentifiers( - @Nullable PlatformAccountIdentifiers setterArg) { + public @NonNull Builder setAccountIdentifiers(@Nullable PlatformAccountIdentifiers setterArg) { this.accountIdentifiers = setterArg; return this; } + private @Nullable PlatformPendingPurchaseUpdate pendingPurchaseUpdate; + + @CanIgnoreReturnValue + public @NonNull Builder setPendingPurchaseUpdate(@Nullable PlatformPendingPurchaseUpdate setterArg) { + this.pendingPurchaseUpdate = setterArg; + return this; + } + public @NonNull PlatformPurchase build() { PlatformPurchase pigeonReturn = new PlatformPurchase(); pigeonReturn.setOrderId(orderId); @@ -1831,13 +1728,14 @@ public static final class Builder { pigeonReturn.setQuantity(quantity); pigeonReturn.setPurchaseState(purchaseState); pigeonReturn.setAccountIdentifiers(accountIdentifiers); + pigeonReturn.setPendingPurchaseUpdate(pendingPurchaseUpdate); return pigeonReturn; } } @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList<>(13); + ArrayList toListResult = new ArrayList<>(14); toListResult.add(orderId); toListResult.add(packageName); toListResult.add(purchaseTime); @@ -1851,6 +1749,7 @@ ArrayList toList() { toListResult.add(quantity); toListResult.add(purchaseState); toListResult.add(accountIdentifiers); + toListResult.add(pendingPurchaseUpdate); return toListResult; } @@ -1882,6 +1781,102 @@ ArrayList toList() { pigeonResult.setPurchaseState((PlatformPurchaseState) purchaseState); Object accountIdentifiers = pigeonVar_list.get(12); pigeonResult.setAccountIdentifiers((PlatformAccountIdentifiers) accountIdentifiers); + Object pendingPurchaseUpdate = pigeonVar_list.get(13); + pigeonResult.setPendingPurchaseUpdate((PlatformPendingPurchaseUpdate) pendingPurchaseUpdate); + return pigeonResult; + } + } + + /** + * Pigeon version of Java Purchase. + * + * See also PendingPurchaseUpdateWrapper on the Dart side. + * + * Generated class from Pigeon that represents data sent in messages. + */ + public static final class PlatformPendingPurchaseUpdate { + private @NonNull List products; + + public @NonNull List getProducts() { + return products; + } + + public void setProducts(@NonNull List setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"products\" is null."); + } + this.products = setterArg; + } + + private @NonNull String purchaseToken; + + public @NonNull String getPurchaseToken() { + return purchaseToken; + } + + public void setPurchaseToken(@NonNull String setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"purchaseToken\" is null."); + } + this.purchaseToken = setterArg; + } + + /** Constructor is non-public to enforce null safety; use Builder. */ + PlatformPendingPurchaseUpdate() {} + + @Override + public boolean equals(Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + PlatformPendingPurchaseUpdate that = (PlatformPendingPurchaseUpdate) o; + return products.equals(that.products) && purchaseToken.equals(that.purchaseToken); + } + + @Override + public int hashCode() { + return Objects.hash(products, purchaseToken); + } + + public static final class Builder { + + private @Nullable List products; + + @CanIgnoreReturnValue + public @NonNull Builder setProducts(@NonNull List setterArg) { + this.products = setterArg; + return this; + } + + private @Nullable String purchaseToken; + + @CanIgnoreReturnValue + public @NonNull Builder setPurchaseToken(@NonNull String setterArg) { + this.purchaseToken = setterArg; + return this; + } + + public @NonNull PlatformPendingPurchaseUpdate build() { + PlatformPendingPurchaseUpdate pigeonReturn = new PlatformPendingPurchaseUpdate(); + pigeonReturn.setProducts(products); + pigeonReturn.setPurchaseToken(purchaseToken); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList<>(2); + toListResult.add(products); + toListResult.add(purchaseToken); + return toListResult; + } + + static @NonNull PlatformPendingPurchaseUpdate fromList(@NonNull ArrayList pigeonVar_list) { + PlatformPendingPurchaseUpdate pigeonResult = new PlatformPendingPurchaseUpdate(); + Object products = pigeonVar_list.get(0); + pigeonResult.setProducts((List) products); + Object purchaseToken = pigeonVar_list.get(1); + pigeonResult.setPurchaseToken((String) purchaseToken); return pigeonResult; } } @@ -1889,9 +1884,9 @@ ArrayList toList() { /** * Pigeon version of PurchaseHistoryRecord. * - *

See also PurchaseHistoryRecordWrapper on the Dart side. + * See also PurchaseHistoryRecordWrapper on the Dart side. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchaseHistoryRecord { private @NonNull Long quantity; @@ -1987,32 +1982,15 @@ public void setProducts(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPurchaseHistoryRecord that = (PlatformPurchaseHistoryRecord) o; - return quantity.equals(that.quantity) - && purchaseTime.equals(that.purchaseTime) - && Objects.equals(developerPayload, that.developerPayload) - && originalJson.equals(that.originalJson) - && purchaseToken.equals(that.purchaseToken) - && signature.equals(that.signature) - && products.equals(that.products); + return quantity.equals(that.quantity) && purchaseTime.equals(that.purchaseTime) && Objects.equals(developerPayload, that.developerPayload) && originalJson.equals(that.originalJson) && purchaseToken.equals(that.purchaseToken) && signature.equals(that.signature) && products.equals(that.products); } @Override public int hashCode() { - return Objects.hash( - quantity, - purchaseTime, - developerPayload, - originalJson, - purchaseToken, - signature, - products); + return Objects.hash(quantity, purchaseTime, developerPayload, originalJson, purchaseToken, signature, products); } public static final class Builder { @@ -2099,8 +2077,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPurchaseHistoryRecord fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformPurchaseHistoryRecord fromList(@NonNull ArrayList pigeonVar_list) { PlatformPurchaseHistoryRecord pigeonResult = new PlatformPurchaseHistoryRecord(); Object quantity = pigeonVar_list.get(0); pigeonResult.setQuantity((Long) quantity); @@ -2121,10 +2098,10 @@ ArrayList toList() { } /** - * 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. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchaseHistoryResponse { private @NonNull PlatformBillingResult billingResult; @@ -2158,12 +2135,8 @@ public void setPurchases(@NonNull List setterArg) @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPurchaseHistoryResponse that = (PlatformPurchaseHistoryResponse) o; return billingResult.equals(that.billingResult) && purchases.equals(that.purchases); } @@ -2207,8 +2180,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPurchaseHistoryResponse fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformPurchaseHistoryResponse fromList(@NonNull ArrayList pigeonVar_list) { PlatformPurchaseHistoryResponse pigeonResult = new PlatformPurchaseHistoryResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -2219,10 +2191,10 @@ ArrayList toList() { } /** - * 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. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchasesResponse { private @NonNull PlatformBillingResult billingResult; @@ -2256,12 +2228,8 @@ public void setPurchases(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPurchasesResponse that = (PlatformPurchasesResponse) o; return billingResult.equals(that.billingResult) && purchases.equals(that.purchases); } @@ -2318,7 +2286,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.SubscriptionOfferDetails. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformSubscriptionOfferDetails { private @NonNull String basePlanId; @@ -2398,25 +2366,15 @@ public void setInstallmentPlanDetails(@Nullable PlatformInstallmentPlanDetails s @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformSubscriptionOfferDetails that = (PlatformSubscriptionOfferDetails) o; - return basePlanId.equals(that.basePlanId) - && Objects.equals(offerId, that.offerId) - && offerToken.equals(that.offerToken) - && offerTags.equals(that.offerTags) - && pricingPhases.equals(that.pricingPhases) - && Objects.equals(installmentPlanDetails, that.installmentPlanDetails); + return basePlanId.equals(that.basePlanId) && Objects.equals(offerId, that.offerId) && offerToken.equals(that.offerToken) && offerTags.equals(that.offerTags) && pricingPhases.equals(that.pricingPhases) && Objects.equals(installmentPlanDetails, that.installmentPlanDetails); } @Override public int hashCode() { - return Objects.hash( - basePlanId, offerId, offerToken, offerTags, pricingPhases, installmentPlanDetails); + return Objects.hash(basePlanId, offerId, offerToken, offerTags, pricingPhases, installmentPlanDetails); } public static final class Builder { @@ -2464,8 +2422,7 @@ public static final class Builder { private @Nullable PlatformInstallmentPlanDetails installmentPlanDetails; @CanIgnoreReturnValue - public @NonNull Builder setInstallmentPlanDetails( - @Nullable PlatformInstallmentPlanDetails setterArg) { + public @NonNull Builder setInstallmentPlanDetails(@Nullable PlatformInstallmentPlanDetails setterArg) { this.installmentPlanDetails = setterArg; return this; } @@ -2494,8 +2451,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformSubscriptionOfferDetails fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformSubscriptionOfferDetails fromList(@NonNull ArrayList pigeonVar_list) { PlatformSubscriptionOfferDetails pigeonResult = new PlatformSubscriptionOfferDetails(); Object basePlanId = pigeonVar_list.get(0); pigeonResult.setBasePlanId((String) basePlanId); @@ -2508,8 +2464,7 @@ ArrayList toList() { Object pricingPhases = pigeonVar_list.get(4); pigeonResult.setPricingPhases((List) pricingPhases); Object installmentPlanDetails = pigeonVar_list.get(5); - pigeonResult.setInstallmentPlanDetails( - (PlatformInstallmentPlanDetails) installmentPlanDetails); + pigeonResult.setInstallmentPlanDetails((PlatformInstallmentPlanDetails) installmentPlanDetails); return pigeonResult; } } @@ -2517,7 +2472,7 @@ ArrayList toList() { /** * Pigeon version of UserChoiceDetailsWrapper and Java UserChoiceDetails. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformUserChoiceDetails { private @Nullable String originalExternalTransactionId; @@ -2561,16 +2516,10 @@ public void setProducts(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformUserChoiceDetails that = (PlatformUserChoiceDetails) o; - return Objects.equals(originalExternalTransactionId, that.originalExternalTransactionId) - && externalTransactionToken.equals(that.externalTransactionToken) - && products.equals(that.products); + return Objects.equals(originalExternalTransactionId, that.originalExternalTransactionId) && externalTransactionToken.equals(that.externalTransactionToken) && products.equals(that.products); } @Override @@ -2637,7 +2586,7 @@ ArrayList toList() { /** * Pigeon version of UserChoiseDetails.Product. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformUserChoiceProduct { private @NonNull String id; @@ -2681,16 +2630,10 @@ public void setType(@NonNull PlatformProductType setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformUserChoiceProduct that = (PlatformUserChoiceProduct) o; - return id.equals(that.id) - && Objects.equals(offerToken, that.offerToken) - && type.equals(that.type); + return id.equals(that.id) && Objects.equals(offerToken, that.offerToken) && type.equals(that.type); } @Override @@ -2757,7 +2700,7 @@ ArrayList toList() { /** * Pigeon version of ProductDetails.InstallmentPlanDetails. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformInstallmentPlanDetails { private @NonNull Long commitmentPaymentsCount; @@ -2781,8 +2724,7 @@ public void setCommitmentPaymentsCount(@NonNull Long setterArg) { public void setSubsequentCommitmentPaymentsCount(@NonNull Long setterArg) { if (setterArg == null) { - throw new IllegalStateException( - "Nonnull field \"subsequentCommitmentPaymentsCount\" is null."); + throw new IllegalStateException("Nonnull field \"subsequentCommitmentPaymentsCount\" is null."); } this.subsequentCommitmentPaymentsCount = setterArg; } @@ -2792,15 +2734,10 @@ public void setSubsequentCommitmentPaymentsCount(@NonNull Long setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformInstallmentPlanDetails that = (PlatformInstallmentPlanDetails) o; - return commitmentPaymentsCount.equals(that.commitmentPaymentsCount) - && subsequentCommitmentPaymentsCount.equals(that.subsequentCommitmentPaymentsCount); + return commitmentPaymentsCount.equals(that.commitmentPaymentsCount) && subsequentCommitmentPaymentsCount.equals(that.subsequentCommitmentPaymentsCount); } @Override @@ -2842,8 +2779,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformInstallmentPlanDetails fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformInstallmentPlanDetails fromList(@NonNull ArrayList pigeonVar_list) { PlatformInstallmentPlanDetails pigeonResult = new PlatformInstallmentPlanDetails(); Object commitmentPaymentsCount = pigeonVar_list.get(0); pigeonResult.setCommitmentPaymentsCount((Long) commitmentPaymentsCount); @@ -2861,30 +2797,22 @@ private PigeonCodec() {} @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte) 129: - { - Object value = readValue(buffer); - return value == null ? null : PlatformProductType.values()[((Long) value).intValue()]; - } - case (byte) 130: - { - Object value = readValue(buffer); - return value == null - ? null - : PlatformBillingChoiceMode.values()[((Long) value).intValue()]; - } - case (byte) 131: - { - Object value = readValue(buffer); - return value == null ? null : PlatformPurchaseState.values()[((Long) value).intValue()]; - } - case (byte) 132: - { - Object value = readValue(buffer); - return value == null - ? null - : PlatformRecurrenceMode.values()[((Long) value).intValue()]; - } + case (byte) 129: { + Object value = readValue(buffer); + return value == null ? null : PlatformProductType.values()[((Long) value).intValue()]; + } + case (byte) 130: { + Object value = readValue(buffer); + return value == null ? null : PlatformBillingChoiceMode.values()[((Long) value).intValue()]; + } + case (byte) 131: { + Object value = readValue(buffer); + return value == null ? null : PlatformPurchaseState.values()[((Long) value).intValue()]; + } + case (byte) 132: { + Object value = readValue(buffer); + return value == null ? null : PlatformRecurrenceMode.values()[((Long) value).intValue()]; + } case (byte) 133: return PlatformQueryProduct.fromList((ArrayList) readValue(buffer)); case (byte) 134: @@ -2892,15 +2820,13 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { case (byte) 135: return PlatformBillingResult.fromList((ArrayList) readValue(buffer)); case (byte) 136: - return PlatformOneTimePurchaseOfferDetails.fromList( - (ArrayList) readValue(buffer)); + return PlatformOneTimePurchaseOfferDetails.fromList((ArrayList) readValue(buffer)); case (byte) 137: return PlatformProductDetails.fromList((ArrayList) readValue(buffer)); case (byte) 138: return PlatformProductDetailsResponse.fromList((ArrayList) readValue(buffer)); case (byte) 139: - return PlatformAlternativeBillingOnlyReportingDetailsResponse.fromList( - (ArrayList) readValue(buffer)); + return PlatformAlternativeBillingOnlyReportingDetailsResponse.fromList((ArrayList) readValue(buffer)); case (byte) 140: return PlatformBillingConfigResponse.fromList((ArrayList) readValue(buffer)); case (byte) 141: @@ -2910,18 +2836,20 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { case (byte) 143: return PlatformPurchase.fromList((ArrayList) readValue(buffer)); case (byte) 144: - return PlatformPurchaseHistoryRecord.fromList((ArrayList) readValue(buffer)); + return PlatformPendingPurchaseUpdate.fromList((ArrayList) readValue(buffer)); case (byte) 145: - return PlatformPurchaseHistoryResponse.fromList((ArrayList) readValue(buffer)); + return PlatformPurchaseHistoryRecord.fromList((ArrayList) readValue(buffer)); case (byte) 146: - return PlatformPurchasesResponse.fromList((ArrayList) readValue(buffer)); + return PlatformPurchaseHistoryResponse.fromList((ArrayList) readValue(buffer)); case (byte) 147: - return PlatformSubscriptionOfferDetails.fromList((ArrayList) readValue(buffer)); + return PlatformPurchasesResponse.fromList((ArrayList) readValue(buffer)); case (byte) 148: - return PlatformUserChoiceDetails.fromList((ArrayList) readValue(buffer)); + return PlatformSubscriptionOfferDetails.fromList((ArrayList) readValue(buffer)); case (byte) 149: - return PlatformUserChoiceProduct.fromList((ArrayList) readValue(buffer)); + return PlatformUserChoiceDetails.fromList((ArrayList) readValue(buffer)); case (byte) 150: + return PlatformUserChoiceProduct.fromList((ArrayList) readValue(buffer)); + case (byte) 151: return PlatformInstallmentPlanDetails.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); @@ -2962,8 +2890,7 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { writeValue(stream, ((PlatformProductDetailsResponse) value).toList()); } else if (value instanceof PlatformAlternativeBillingOnlyReportingDetailsResponse) { stream.write(139); - writeValue( - stream, ((PlatformAlternativeBillingOnlyReportingDetailsResponse) value).toList()); + writeValue(stream, ((PlatformAlternativeBillingOnlyReportingDetailsResponse) value).toList()); } else if (value instanceof PlatformBillingConfigResponse) { stream.write(140); writeValue(stream, ((PlatformBillingConfigResponse) value).toList()); @@ -2976,26 +2903,29 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { } else if (value instanceof PlatformPurchase) { stream.write(143); writeValue(stream, ((PlatformPurchase) value).toList()); - } else if (value instanceof PlatformPurchaseHistoryRecord) { + } else if (value instanceof PlatformPendingPurchaseUpdate) { stream.write(144); + writeValue(stream, ((PlatformPendingPurchaseUpdate) value).toList()); + } else if (value instanceof PlatformPurchaseHistoryRecord) { + stream.write(145); writeValue(stream, ((PlatformPurchaseHistoryRecord) value).toList()); } else if (value instanceof PlatformPurchaseHistoryResponse) { - stream.write(145); + stream.write(146); writeValue(stream, ((PlatformPurchaseHistoryResponse) value).toList()); } else if (value instanceof PlatformPurchasesResponse) { - stream.write(146); + stream.write(147); writeValue(stream, ((PlatformPurchasesResponse) value).toList()); } else if (value instanceof PlatformSubscriptionOfferDetails) { - stream.write(147); + stream.write(148); writeValue(stream, ((PlatformSubscriptionOfferDetails) value).toList()); } else if (value instanceof PlatformUserChoiceDetails) { - stream.write(148); + stream.write(149); writeValue(stream, ((PlatformUserChoiceDetails) value).toList()); } else if (value instanceof PlatformUserChoiceProduct) { - stream.write(149); + stream.write(150); writeValue(stream, ((PlatformUserChoiceProduct) value).toList()); } else if (value instanceof PlatformInstallmentPlanDetails) { - stream.write(150); + stream.write(151); writeValue(stream, ((PlatformInstallmentPlanDetails) value).toList()); } else { super.writeValue(stream, value); @@ -3003,6 +2933,7 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { } } + /** Asynchronous error handling return type for non-nullable API method returns. */ public interface Result { /** Success case callback method for handling returns. */ @@ -3030,86 +2961,51 @@ public interface VoidResult { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InAppPurchaseApi { /** Wraps BillingClient#isReady. */ - @NonNull + @NonNull Boolean isReady(); /** Wraps BillingClient#startConnection(BillingClientStateListener). */ - void startConnection( - @NonNull Long callbackHandle, - @NonNull PlatformBillingChoiceMode billingMode, - @NonNull Result result); + void startConnection(@NonNull Long callbackHandle, @NonNull PlatformBillingChoiceMode billingMode, @NonNull Result result); /** Wraps BillingClient#endConnection(BillingClientStateListener). */ void endConnection(); - /** - * Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, - * BillingConfigResponseListener). - */ + /** Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, BillingConfigResponseListener). */ void getBillingConfigAsync(@NonNull Result result); /** Wraps BillingClient#launchBillingFlow(Activity, BillingFlowParams). */ - @NonNull + @NonNull PlatformBillingResult launchBillingFlow(@NonNull PlatformBillingFlowParams params); - /** - * Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, - * AcknowledgePurchaseResponseListener). - */ - void acknowledgePurchase( - @NonNull String purchaseToken, @NonNull Result result); + /** Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, AcknowledgePurchaseResponseListener). */ + void acknowledgePurchase(@NonNull String purchaseToken, @NonNull Result result); /** Wraps BillingClient#consumeAsync(ConsumeParams, ConsumeResponseListener). */ void consumeAsync(@NonNull String purchaseToken, @NonNull Result result); /** Wraps BillingClient#queryPurchasesAsync(QueryPurchaseParams, PurchaseResponseListener). */ - 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). - */ - void queryProductDetailsAsync( - @NonNull List products, - @NonNull Result result); + 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). */ + void queryProductDetailsAsync(@NonNull List products, @NonNull Result result); /** Wraps BillingClient#isFeatureSupported(String). */ - @NonNull + @NonNull Boolean isFeatureSupported(@NonNull String feature); /** Wraps BillingClient#isAlternativeBillingOnlyAvailableAsync(). */ void isAlternativeBillingOnlyAvailableAsync(@NonNull Result result); /** Wraps BillingClient#showAlternativeBillingOnlyInformationDialog(). */ void showAlternativeBillingOnlyInformationDialog(@NonNull Result result); - /** - * Wraps - * BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). - */ - void createAlternativeBillingOnlyReportingDetailsAsync( - @NonNull Result result); + /** Wraps BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). */ + void createAlternativeBillingOnlyReportingDetailsAsync(@NonNull Result result); /** The codec used by InAppPurchaseApi. */ static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } - /** - * Sets up an instance of `InAppPurchaseApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `InAppPurchaseApi` to handle messages through the `binaryMessenger`. */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable InAppPurchaseApi api) { setUp(binaryMessenger, "", api); } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable InAppPurchaseApi api) { + static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String messageChannelSuffix, @Nullable InAppPurchaseApi api) { messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3117,7 +3013,8 @@ static void setUp( try { Boolean output = api.isReady(); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3129,10 +3026,7 @@ static void setUp( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3162,10 +3056,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3173,7 +3064,8 @@ public void error(Throwable error) { try { api.endConnection(); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3185,10 +3077,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3215,10 +3104,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3228,7 +3114,8 @@ public void error(Throwable error) { try { PlatformBillingResult output = api.launchBillingFlow(paramsArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3240,10 +3127,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3272,10 +3156,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3304,10 +3185,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3336,10 +3214,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3368,10 +3243,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3400,10 +3272,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3413,7 +3282,8 @@ public void error(Throwable error) { try { Boolean output = api.isFeatureSupported(featureArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3425,10 +3295,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3455,10 +3322,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3485,18 +3349,14 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList wrapped = new ArrayList<>(); Result resultCallback = new Result() { - public void success( - PlatformAlternativeBillingOnlyReportingDetailsResponse result) { + public void success(PlatformAlternativeBillingOnlyReportingDetailsResponse result) { wrapped.add(0, result); reply.reply(wrapped); } @@ -3523,90 +3383,79 @@ public static class InAppPurchaseCallbackApi { public InAppPurchaseCallbackApi(@NonNull BinaryMessenger argBinaryMessenger) { this(argBinaryMessenger, ""); } - - public InAppPurchaseCallbackApi( - @NonNull BinaryMessenger argBinaryMessenger, @NonNull String messageChannelSuffix) { + public InAppPurchaseCallbackApi(@NonNull BinaryMessenger argBinaryMessenger, @NonNull String messageChannelSuffix) { this.binaryMessenger = argBinaryMessenger; this.messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; } - /** Public interface for sending reply. The codec used by InAppPurchaseCallbackApi. */ + /** + * Public interface for sending reply. + * The codec used by InAppPurchaseCallbackApi. + */ static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } /** Called for BillingClientStateListener#onBillingServiceDisconnected(). */ - public void onBillingServiceDisconnected( - @NonNull Long callbackHandleArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected" - + messageChannelSuffix; + public void onBillingServiceDisconnected(@NonNull Long callbackHandleArg, @NonNull VoidResult result) { + final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected" + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(callbackHandleArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } /** Called for PurchasesUpdatedListener#onPurchasesUpdated(BillingResult, List). */ - public void onPurchasesUpdated( - @NonNull PlatformPurchasesResponse updateArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated" - + messageChannelSuffix; + public void onPurchasesUpdated(@NonNull PlatformPurchasesResponse updateArg, @NonNull VoidResult result) { + final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated" + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(updateArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } /** Called for UserChoiceBillingListener#userSelectedAlternativeBilling(UserChoiceDetails). */ - public void userSelectedalternativeBilling( - @NonNull PlatformUserChoiceDetails detailsArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling" - + messageChannelSuffix; + public void userSelectedalternativeBilling(@NonNull PlatformUserChoiceDetails detailsArg, @NonNull VoidResult result) { + final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling" + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(detailsArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } } 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 db31226eebbf..92fd90546e82 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 @@ -22,6 +22,7 @@ import io.flutter.plugins.inapppurchase.Messages.PlatformBillingConfigResponse; import io.flutter.plugins.inapppurchase.Messages.PlatformBillingResult; import io.flutter.plugins.inapppurchase.Messages.PlatformOneTimePurchaseOfferDetails; +import io.flutter.plugins.inapppurchase.Messages.PlatformPendingPurchaseUpdate; import io.flutter.plugins.inapppurchase.Messages.PlatformPricingPhase; import io.flutter.plugins.inapppurchase.Messages.PlatformProductDetails; import io.flutter.plugins.inapppurchase.Messages.PlatformProductType; @@ -233,9 +234,27 @@ static PlatformPurchaseState toPlatformPurchaseState(int state) { .setObfuscatedProfileId(accountIdentifiers.getObfuscatedProfileId()) .build()); } + + Purchase.PendingPurchaseUpdate pendingPurchaseUpdate = purchase.getPendingPurchaseUpdate(); + if (pendingPurchaseUpdate != null) { + builder.setPendingPurchaseUpdate(fromPendingPurchaseUpdate(pendingPurchaseUpdate)); + } + return builder.build(); } + static @Nullable PlatformPendingPurchaseUpdate fromPendingPurchaseUpdate( + @Nullable Purchase.PendingPurchaseUpdate pendingPurchaseUpdate) { + if (pendingPurchaseUpdate == null) { + return null; + } + + return new Messages.PlatformPendingPurchaseUpdate.Builder() + .setPurchaseToken(pendingPurchaseUpdate.getPurchaseToken()) + .setProducts(pendingPurchaseUpdate.getProducts()) + .build(); + } + static @NonNull PlatformPurchaseHistoryRecord fromPurchaseHistoryRecord( @NonNull PurchaseHistoryRecord purchaseHistoryRecord) { return new PlatformPurchaseHistoryRecord.Builder() diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/purchase_wrapper.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/purchase_wrapper.dart index 8d17d81c9a49..59926ec712f3 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/purchase_wrapper.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/purchase_wrapper.dart @@ -39,6 +39,7 @@ class PurchaseWrapper { required this.purchaseState, this.obfuscatedAccountId, this.obfuscatedProfileId, + this.pendingPurchaseUpdate, }); /// Factory for creating a [PurchaseWrapper] from a [Map] with the purchase details. @@ -65,7 +66,8 @@ class PurchaseWrapper { other.isAutoRenewing == isAutoRenewing && other.originalJson == originalJson && other.isAcknowledged == isAcknowledged && - other.purchaseState == purchaseState; + other.purchaseState == purchaseState && + other.pendingPurchaseUpdate == pendingPurchaseUpdate; } @override @@ -79,7 +81,8 @@ class PurchaseWrapper { isAutoRenewing, originalJson, isAcknowledged, - purchaseState); + purchaseState, + pendingPurchaseUpdate); /// The unique ID for this purchase. Corresponds to the Google Payments order /// ID. @@ -158,6 +161,58 @@ class PurchaseWrapper { /// directly calling [BillingClient.launchBillingFlow] and is not available /// on the generic [InAppPurchasePlatform]. final String? obfuscatedProfileId; + + /// The [PendingPurchaseUpdateWrapper] for an uncommitted transaction. + /// + /// A PendingPurchaseUpdate is normally generated from a pending transaction + /// upgrading/downgrading an existing subscription. + /// Returns null if this purchase does not have a pending transaction. + final PendingPurchaseUpdateWrapper? pendingPurchaseUpdate; +} + +@JsonSerializable() +@immutable + +/// Represents a pending change/update to the existing purchase. +class PendingPurchaseUpdateWrapper { + /// Creates a pending purchase wrapper update wrapper with the given purchase details. + const PendingPurchaseUpdateWrapper({ + required this.purchaseToken, + required this.products, + }); + + /// Factory for creating a [PendingPurchaseUpdateWrapper] from a [Map] with the purchase details. + @Deprecated('JSON serialization is not intended for public use, and will ' + 'be removed in a future version.') + factory PendingPurchaseUpdateWrapper.fromJson(Map map) => + _$PendingPurchaseUpdateWrapperFromJson(map); + + /// A token that uniquely identifies this pending transaction. + @JsonKey(defaultValue: '') + final String purchaseToken; + + /// The product IDs of this pending purchase update. + @JsonKey(defaultValue: []) + final List products; + + @override + bool operator ==(Object other) { + if (identical(other, this)) { + return true; + } + if (other.runtimeType != runtimeType) { + return false; + } + return other is PendingPurchaseUpdateWrapper && + other.purchaseToken == purchaseToken && + listEquals(other.products, products); + } + + @override + int get hashCode => Object.hash( + purchaseToken, + products.hashCode, + ); } /// Data structure representing a purchase history record. diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/purchase_wrapper.g.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/purchase_wrapper.g.dart index b97afce0f628..32c6d492f43d 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/purchase_wrapper.g.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/purchase_wrapper.g.dart @@ -24,6 +24,19 @@ PurchaseWrapper _$PurchaseWrapperFromJson(Map json) => PurchaseWrapper( .fromJson((json['purchaseState'] as num?)?.toInt()), obfuscatedAccountId: json['obfuscatedAccountId'] as String?, obfuscatedProfileId: json['obfuscatedProfileId'] as String?, + pendingPurchaseUpdate: json['pendingPurchaseUpdate'] == null + ? null + : PendingPurchaseUpdateWrapper.fromJson( + Map.from(json['pendingPurchaseUpdate'] as Map)), + ); + +PendingPurchaseUpdateWrapper _$PendingPurchaseUpdateWrapperFromJson(Map json) => + PendingPurchaseUpdateWrapper( + purchaseToken: json['purchaseToken'] as String? ?? '', + products: (json['products'] as List?) + ?.map((e) => e as String) + .toList() ?? + [], ); PurchaseHistoryRecordWrapper _$PurchaseHistoryRecordWrapperFromJson(Map json) => 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 e43a036ab31a..123ad0a37ce7 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 @@ -427,6 +427,7 @@ class PlatformPurchase { required this.quantity, required this.purchaseState, this.accountIdentifiers, + this.pendingPurchaseUpdate, }); String? orderId; @@ -455,6 +456,8 @@ class PlatformPurchase { PlatformAccountIdentifiers? accountIdentifiers; + PlatformPendingPurchaseUpdate? pendingPurchaseUpdate; + Object encode() { return [ orderId, @@ -470,6 +473,7 @@ class PlatformPurchase { quantity, purchaseState, accountIdentifiers, + pendingPurchaseUpdate, ]; } @@ -489,6 +493,36 @@ class PlatformPurchase { quantity: result[10]! as int, purchaseState: result[11]! as PlatformPurchaseState, accountIdentifiers: result[12] as PlatformAccountIdentifiers?, + pendingPurchaseUpdate: result[13] as PlatformPendingPurchaseUpdate?, + ); + } +} + +/// Pigeon version of Java Purchase. +/// +/// See also PendingPurchaseUpdateWrapper on the Dart side. +class PlatformPendingPurchaseUpdate { + PlatformPendingPurchaseUpdate({ + required this.products, + required this.purchaseToken, + }); + + List products; + + String purchaseToken; + + Object encode() { + return [ + products, + purchaseToken, + ]; + } + + static PlatformPendingPurchaseUpdate decode(Object result) { + result as List; + return PlatformPendingPurchaseUpdate( + products: (result[0] as List?)!.cast(), + purchaseToken: result[1]! as String, ); } } @@ -794,27 +828,30 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is PlatformPurchase) { buffer.putUint8(143); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchaseHistoryRecord) { + } else if (value is PlatformPendingPurchaseUpdate) { buffer.putUint8(144); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchaseHistoryResponse) { + } else if (value is PlatformPurchaseHistoryRecord) { buffer.putUint8(145); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchasesResponse) { + } else if (value is PlatformPurchaseHistoryResponse) { buffer.putUint8(146); writeValue(buffer, value.encode()); - } else if (value is PlatformSubscriptionOfferDetails) { + } else if (value is PlatformPurchasesResponse) { buffer.putUint8(147); writeValue(buffer, value.encode()); - } else if (value is PlatformUserChoiceDetails) { + } else if (value is PlatformSubscriptionOfferDetails) { buffer.putUint8(148); writeValue(buffer, value.encode()); - } else if (value is PlatformUserChoiceProduct) { + } else if (value is PlatformUserChoiceDetails) { buffer.putUint8(149); writeValue(buffer, value.encode()); - } else if (value is PlatformInstallmentPlanDetails) { + } else if (value is PlatformUserChoiceProduct) { buffer.putUint8(150); writeValue(buffer, value.encode()); + } else if (value is PlatformInstallmentPlanDetails) { + buffer.putUint8(151); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -858,18 +895,20 @@ class _PigeonCodec extends StandardMessageCodec { case 143: return PlatformPurchase.decode(readValue(buffer)!); case 144: - return PlatformPurchaseHistoryRecord.decode(readValue(buffer)!); + return PlatformPendingPurchaseUpdate.decode(readValue(buffer)!); case 145: - return PlatformPurchaseHistoryResponse.decode(readValue(buffer)!); + return PlatformPurchaseHistoryRecord.decode(readValue(buffer)!); case 146: - return PlatformPurchasesResponse.decode(readValue(buffer)!); + return PlatformPurchaseHistoryResponse.decode(readValue(buffer)!); case 147: - return PlatformSubscriptionOfferDetails.decode(readValue(buffer)!); + return PlatformPurchasesResponse.decode(readValue(buffer)!); case 148: - return PlatformUserChoiceDetails.decode(readValue(buffer)!); + return PlatformSubscriptionOfferDetails.decode(readValue(buffer)!); case 149: - return PlatformUserChoiceProduct.decode(readValue(buffer)!); + return PlatformUserChoiceDetails.decode(readValue(buffer)!); case 150: + return PlatformUserChoiceProduct.decode(readValue(buffer)!); + case 151: return PlatformInstallmentPlanDetails.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); 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 46cd66a73248..97a441789091 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 @@ -182,9 +182,23 @@ PurchaseWrapper purchaseWrapperFromPlatform(PlatformPurchase purchase) { developerPayload: purchase.developerPayload, obfuscatedAccountId: purchase.accountIdentifiers?.obfuscatedAccountId, obfuscatedProfileId: purchase.accountIdentifiers?.obfuscatedProfileId, + pendingPurchaseUpdate: + pendingPurchaseUpdateFromPlatform(purchase.pendingPurchaseUpdate), ); } +/// Creates a [PendingPurchaseUpdateWrapper] from the Pigeon equivalent. +PendingPurchaseUpdateWrapper? pendingPurchaseUpdateFromPlatform( + PlatformPendingPurchaseUpdate? pendingPurchaseUpdate) { + if (pendingPurchaseUpdate == null) { + return null; + } + + return PendingPurchaseUpdateWrapper( + purchaseToken: pendingPurchaseUpdate.purchaseToken, + products: pendingPurchaseUpdate.products); +} + /// Creates a [PurchaseStateWrapper] from the Pigeon equivalent. PurchaseStateWrapper purchaseStateWrapperFromPlatform( PlatformPurchaseState state) { 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 498233c9ce41..883db968eb93 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 @@ -167,6 +167,7 @@ class PlatformPurchase { required this.quantity, required this.purchaseState, required this.accountIdentifiers, + required this.pendingPurchaseUpdate, }); final String? orderId; @@ -182,6 +183,20 @@ class PlatformPurchase { final int quantity; final PlatformPurchaseState purchaseState; final PlatformAccountIdentifiers? accountIdentifiers; + final PlatformPendingPurchaseUpdate? pendingPurchaseUpdate; +} + +/// Pigeon version of Java Purchase. +/// +/// See also PendingPurchaseUpdateWrapper on the Dart side. +class PlatformPendingPurchaseUpdate { + PlatformPendingPurchaseUpdate({ + required this.products, + required this.purchaseToken, + }); + + final List products; + final String purchaseToken; } /// Pigeon version of PurchaseHistoryRecord. 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 685966fa2882..7eda49df2f8e 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 @@ -328,10 +328,10 @@ Map buildPricingPhaseMap(PricingPhaseWrapper original) { }; } -Map buildInstallmentPlanMap( +Map? buildInstallmentPlanMap( InstallmentPlanDetailsWrapper? installmentPlanDetails) { if (installmentPlanDetails == null) { - return {}; + return null; } return { diff --git a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/purchase_wrapper_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/purchase_wrapper_test.dart index 14cd446bf8a0..64dfdbb202bc 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/purchase_wrapper_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/purchase_wrapper_test.dart @@ -50,6 +50,25 @@ const PurchaseWrapper dummyUnacknowledgedPurchase = PurchaseWrapper( purchaseState: PurchaseStateWrapper.purchased, ); +const PurchaseWrapper dummyPendingUpdatePurchase = PurchaseWrapper( + orderId: 'orderId', + packageName: 'packageName', + purchaseTime: 0, + signature: 'signature', + products: ['product'], + purchaseToken: 'purchaseToken', + isAutoRenewing: false, + originalJson: '', + developerPayload: 'dummy payload', + isAcknowledged: true, + purchaseState: PurchaseStateWrapper.purchased, + obfuscatedAccountId: 'Account101', + obfuscatedProfileId: 'Profile103', + pendingPurchaseUpdate: PendingPurchaseUpdateWrapper( + purchaseToken: 'pendingPurchaseToken', + products: ['pendingProduct']), +); + const PurchaseHistoryRecordWrapper dummyPurchaseHistoryRecord = PurchaseHistoryRecordWrapper( purchaseTime: 0, @@ -60,6 +79,12 @@ const PurchaseHistoryRecordWrapper dummyPurchaseHistoryRecord = developerPayload: 'dummy payload', ); +const PendingPurchaseUpdateWrapper dummyPendingPurchaseUpdate = + PendingPurchaseUpdateWrapper( + products: ['product'], + purchaseToken: 'purchaseToken', +); + void main() { group('PurchaseWrapper', () { test('converts from map', () { @@ -70,6 +95,14 @@ void main() { expect(parsed, equals(expected)); }); + test('converts from map with pending purchase', () { + const PurchaseWrapper expected = dummyPendingUpdatePurchase; + final PurchaseWrapper parsed = + PurchaseWrapper.fromJson(buildPurchaseMap(expected)); + + expect(parsed, equals(expected)); + }); + test('fromPurchase() should return correct PurchaseDetail object', () { final List details = GooglePlayPurchaseDetails.fromPurchase(dummyMultipleProductsPurchase); @@ -212,6 +245,17 @@ void main() { expect(parsed.purchaseHistoryRecordList, isEmpty); }); }); + + group('PendingPurchaseUpdateWrapper', () { + test('converts from map', () { + const PendingPurchaseUpdateWrapper expected = dummyPendingPurchaseUpdate; + final PendingPurchaseUpdateWrapper parsed = + PendingPurchaseUpdateWrapper.fromJson( + buildPendingPurchaseUpdateMap(expected)!); + + expect(parsed, equals(expected)); + }); + }); } Map buildPurchaseMap(PurchaseWrapper original) { @@ -230,6 +274,8 @@ Map buildPurchaseMap(PurchaseWrapper original) { 'isAcknowledged': original.isAcknowledged, 'obfuscatedAccountId': original.obfuscatedAccountId, 'obfuscatedProfileId': original.obfuscatedProfileId, + 'pendingPurchaseUpdate': + buildPendingPurchaseUpdateMap(original.pendingPurchaseUpdate), }; } @@ -252,3 +298,15 @@ Map buildBillingResultMap(BillingResultWrapper original) { 'debugMessage': original.debugMessage, }; } + +Map? buildPendingPurchaseUpdateMap( + PendingPurchaseUpdateWrapper? original) { + if (original == null) { + return null; + } + + return { + 'products': original.products, + 'purchaseToken': original.purchaseToken, + }; +} From 3b5e517659fd3de0dc5c063d83e72ebd54618915 Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Tue, 26 Nov 2024 15:41:17 +0100 Subject: [PATCH 08/16] Fix formatting Signed-off-by: Marcin Chudy --- .../plugins/inapppurchase/Messages.java | 692 ++++++++++++------ .../plugins/inapppurchase/Translator.java | 2 +- .../inapppurchase/MethodCallHandlerTest.java | 2 +- .../plugins/inapppurchase/TranslatorTest.java | 13 +- 4 files changed, 495 insertions(+), 214 deletions(-) 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 b5d4019e8541..366524fd38c0 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 @@ -21,11 +21,8 @@ import java.lang.annotation.Target; import java.nio.ByteBuffer; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Objects; /** Generated class from Pigeon. */ @@ -41,8 +38,7 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) - { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { super(message); this.code = code; this.details = details; @@ -61,14 +57,15 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @NonNull protected static FlutterError createConnectionError(@NonNull String channelName) { - return new FlutterError("channel-error", "Unable to establish connection on channel: " + channelName + ".", ""); + return new FlutterError( + "channel-error", "Unable to establish connection on channel: " + channelName + ".", ""); } @Target(METHOD) @@ -92,7 +89,7 @@ public enum PlatformBillingChoiceMode { /** * Billing through google play. * - * Default state. + *

Default state. */ PLAY_BILLING_ONLY(0), /** Billing through app provided flow. */ @@ -136,7 +133,7 @@ public enum PlatformRecurrenceMode { /** * Pigeon version of Java QueryProductDetailsParams.Product. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformQueryProduct { private @NonNull String productId; @@ -170,8 +167,12 @@ public void setProductType(@NonNull PlatformProductType setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformQueryProduct that = (PlatformQueryProduct) o; return productId.equals(that.productId) && productType.equals(that.productType); } @@ -228,7 +229,7 @@ ArrayList toList() { /** * Pigeon version of Java AccountIdentifiers. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformAccountIdentifiers { private @Nullable String obfuscatedAccountId; @@ -253,10 +254,15 @@ public void setObfuscatedProfileId(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformAccountIdentifiers that = (PlatformAccountIdentifiers) o; - return Objects.equals(obfuscatedAccountId, that.obfuscatedAccountId) && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId); + return Objects.equals(obfuscatedAccountId, that.obfuscatedAccountId) + && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId); } @Override @@ -311,7 +317,7 @@ ArrayList toList() { /** * Pigeon version of Java BillingResult. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingResult { private @NonNull Long responseCode; @@ -345,8 +351,12 @@ public void setDebugMessage(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformBillingResult that = (PlatformBillingResult) o; return responseCode.equals(that.responseCode) && debugMessage.equals(that.debugMessage); } @@ -403,7 +413,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.OneTimePurchaseOfferDetails. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformOneTimePurchaseOfferDetails { private @NonNull Long priceAmountMicros; @@ -450,10 +460,16 @@ public void setPriceCurrencyCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformOneTimePurchaseOfferDetails that = (PlatformOneTimePurchaseOfferDetails) o; - return priceAmountMicros.equals(that.priceAmountMicros) && formattedPrice.equals(that.formattedPrice) && priceCurrencyCode.equals(that.priceCurrencyCode); + return priceAmountMicros.equals(that.priceAmountMicros) + && formattedPrice.equals(that.formattedPrice) + && priceCurrencyCode.equals(that.priceCurrencyCode); } @Override @@ -488,7 +504,8 @@ public static final class Builder { } public @NonNull PlatformOneTimePurchaseOfferDetails build() { - PlatformOneTimePurchaseOfferDetails pigeonReturn = new PlatformOneTimePurchaseOfferDetails(); + PlatformOneTimePurchaseOfferDetails pigeonReturn = + new PlatformOneTimePurchaseOfferDetails(); pigeonReturn.setPriceAmountMicros(priceAmountMicros); pigeonReturn.setFormattedPrice(formattedPrice); pigeonReturn.setPriceCurrencyCode(priceCurrencyCode); @@ -505,7 +522,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformOneTimePurchaseOfferDetails fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformOneTimePurchaseOfferDetails fromList( + @NonNull ArrayList pigeonVar_list) { PlatformOneTimePurchaseOfferDetails pigeonResult = new PlatformOneTimePurchaseOfferDetails(); Object priceAmountMicros = pigeonVar_list.get(0); pigeonResult.setPriceAmountMicros((Long) priceAmountMicros); @@ -520,7 +538,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformProductDetails { private @NonNull String description; @@ -594,7 +612,8 @@ public void setTitle(@NonNull String setterArg) { return oneTimePurchaseOfferDetails; } - public void setOneTimePurchaseOfferDetails(@Nullable PlatformOneTimePurchaseOfferDetails setterArg) { + public void setOneTimePurchaseOfferDetails( + @Nullable PlatformOneTimePurchaseOfferDetails setterArg) { this.oneTimePurchaseOfferDetails = setterArg; } @@ -604,7 +623,8 @@ public void setOneTimePurchaseOfferDetails(@Nullable PlatformOneTimePurchaseOffe return subscriptionOfferDetails; } - public void setSubscriptionOfferDetails(@Nullable List setterArg) { + public void setSubscriptionOfferDetails( + @Nullable List setterArg) { this.subscriptionOfferDetails = setterArg; } @@ -613,15 +633,32 @@ public void setSubscriptionOfferDetails(@Nullable List subscriptionOfferDetails; @CanIgnoreReturnValue - public @NonNull Builder setSubscriptionOfferDetails(@Nullable List setterArg) { + public @NonNull Builder setSubscriptionOfferDetails( + @Nullable List setterArg) { this.subscriptionOfferDetails = setterArg; return this; } @@ -721,18 +760,20 @@ ArrayList toList() { Object title = pigeonVar_list.get(4); pigeonResult.setTitle((String) title); Object oneTimePurchaseOfferDetails = pigeonVar_list.get(5); - pigeonResult.setOneTimePurchaseOfferDetails((PlatformOneTimePurchaseOfferDetails) oneTimePurchaseOfferDetails); + pigeonResult.setOneTimePurchaseOfferDetails( + (PlatformOneTimePurchaseOfferDetails) oneTimePurchaseOfferDetails); Object subscriptionOfferDetails = pigeonVar_list.get(6); - pigeonResult.setSubscriptionOfferDetails((List) subscriptionOfferDetails); + pigeonResult.setSubscriptionOfferDetails( + (List) subscriptionOfferDetails); return pigeonResult; } } /** - * 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. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformProductDetailsResponse { private @NonNull PlatformBillingResult billingResult; @@ -766,8 +807,12 @@ public void setProductDetails(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformProductDetailsResponse that = (PlatformProductDetailsResponse) o; return billingResult.equals(that.billingResult) && productDetails.equals(that.productDetails); } @@ -811,7 +856,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformProductDetailsResponse fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformProductDetailsResponse fromList( + @NonNull ArrayList pigeonVar_list) { PlatformProductDetailsResponse pigeonResult = new PlatformProductDetailsResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -822,11 +868,10 @@ ArrayList toList() { } /** - * 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. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformAlternativeBillingOnlyReportingDetailsResponse { private @NonNull PlatformBillingResult billingResult; @@ -860,10 +905,16 @@ public void setExternalTransactionToken(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } - PlatformAlternativeBillingOnlyReportingDetailsResponse that = (PlatformAlternativeBillingOnlyReportingDetailsResponse) o; - return billingResult.equals(that.billingResult) && externalTransactionToken.equals(that.externalTransactionToken); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PlatformAlternativeBillingOnlyReportingDetailsResponse that = + (PlatformAlternativeBillingOnlyReportingDetailsResponse) o; + return billingResult.equals(that.billingResult) + && externalTransactionToken.equals(that.externalTransactionToken); } @Override @@ -890,7 +941,8 @@ public static final class Builder { } public @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse build() { - PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonReturn = new PlatformAlternativeBillingOnlyReportingDetailsResponse(); + PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonReturn = + new PlatformAlternativeBillingOnlyReportingDetailsResponse(); pigeonReturn.setBillingResult(billingResult); pigeonReturn.setExternalTransactionToken(externalTransactionToken); return pigeonReturn; @@ -905,8 +957,10 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse fromList(@NonNull ArrayList pigeonVar_list) { - PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonResult = new PlatformAlternativeBillingOnlyReportingDetailsResponse(); + static @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse fromList( + @NonNull ArrayList pigeonVar_list) { + PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonResult = + new PlatformAlternativeBillingOnlyReportingDetailsResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); Object externalTransactionToken = pigeonVar_list.get(1); @@ -916,10 +970,10 @@ ArrayList toList() { } /** - * 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. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingConfigResponse { private @NonNull PlatformBillingResult billingResult; @@ -953,8 +1007,12 @@ public void setCountryCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformBillingConfigResponse that = (PlatformBillingConfigResponse) o; return billingResult.equals(that.billingResult) && countryCode.equals(that.countryCode); } @@ -998,7 +1056,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformBillingConfigResponse fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformBillingConfigResponse fromList( + @NonNull ArrayList pigeonVar_list) { PlatformBillingConfigResponse pigeonResult = new PlatformBillingConfigResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -1011,7 +1070,7 @@ ArrayList toList() { /** * Pigeon version of Java BillingFlowParams. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingFlowParams { private @NonNull String product; @@ -1095,15 +1154,32 @@ public void setPurchaseToken(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformBillingFlowParams that = (PlatformBillingFlowParams) o; - return product.equals(that.product) && replacementMode.equals(that.replacementMode) && Objects.equals(offerToken, that.offerToken) && Objects.equals(accountId, that.accountId) && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId) && Objects.equals(oldProduct, that.oldProduct) && Objects.equals(purchaseToken, that.purchaseToken); + return product.equals(that.product) + && replacementMode.equals(that.replacementMode) + && Objects.equals(offerToken, that.offerToken) + && Objects.equals(accountId, that.accountId) + && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId) + && Objects.equals(oldProduct, that.oldProduct) + && Objects.equals(purchaseToken, that.purchaseToken); } @Override public int hashCode() { - return Objects.hash(product, replacementMode, offerToken, accountId, obfuscatedProfileId, oldProduct, purchaseToken); + return Objects.hash( + product, + replacementMode, + offerToken, + accountId, + obfuscatedProfileId, + oldProduct, + purchaseToken); } public static final class Builder { @@ -1213,7 +1289,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.PricingPhase. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPricingPhase { private @NonNull Long billingCycleCount; @@ -1299,15 +1375,30 @@ public void setPriceCurrencyCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPricingPhase that = (PlatformPricingPhase) o; - return billingCycleCount.equals(that.billingCycleCount) && recurrenceMode.equals(that.recurrenceMode) && priceAmountMicros.equals(that.priceAmountMicros) && billingPeriod.equals(that.billingPeriod) && formattedPrice.equals(that.formattedPrice) && priceCurrencyCode.equals(that.priceCurrencyCode); + return billingCycleCount.equals(that.billingCycleCount) + && recurrenceMode.equals(that.recurrenceMode) + && priceAmountMicros.equals(that.priceAmountMicros) + && billingPeriod.equals(that.billingPeriod) + && formattedPrice.equals(that.formattedPrice) + && priceCurrencyCode.equals(that.priceCurrencyCode); } @Override public int hashCode() { - return Objects.hash(billingCycleCount, recurrenceMode, priceAmountMicros, billingPeriod, formattedPrice, priceCurrencyCode); + return Objects.hash( + billingCycleCount, + recurrenceMode, + priceAmountMicros, + billingPeriod, + formattedPrice, + priceCurrencyCode); } public static final class Builder { @@ -1405,9 +1496,9 @@ ArrayList toList() { /** * Pigeon version of Java Purchase. * - * See also PurchaseWrapper on the Dart side. + *

See also PurchaseWrapper on the Dart side. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchase { private @Nullable String orderId; @@ -1588,15 +1679,46 @@ public void setPendingPurchaseUpdate(@Nullable PlatformPendingPurchaseUpdate set @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPurchase that = (PlatformPurchase) o; - return Objects.equals(orderId, that.orderId) && packageName.equals(that.packageName) && purchaseTime.equals(that.purchaseTime) && purchaseToken.equals(that.purchaseToken) && signature.equals(that.signature) && products.equals(that.products) && isAutoRenewing.equals(that.isAutoRenewing) && originalJson.equals(that.originalJson) && developerPayload.equals(that.developerPayload) && isAcknowledged.equals(that.isAcknowledged) && quantity.equals(that.quantity) && purchaseState.equals(that.purchaseState) && Objects.equals(accountIdentifiers, that.accountIdentifiers) && Objects.equals(pendingPurchaseUpdate, that.pendingPurchaseUpdate); + return Objects.equals(orderId, that.orderId) + && packageName.equals(that.packageName) + && purchaseTime.equals(that.purchaseTime) + && purchaseToken.equals(that.purchaseToken) + && signature.equals(that.signature) + && products.equals(that.products) + && isAutoRenewing.equals(that.isAutoRenewing) + && originalJson.equals(that.originalJson) + && developerPayload.equals(that.developerPayload) + && isAcknowledged.equals(that.isAcknowledged) + && quantity.equals(that.quantity) + && purchaseState.equals(that.purchaseState) + && Objects.equals(accountIdentifiers, that.accountIdentifiers) + && Objects.equals(pendingPurchaseUpdate, that.pendingPurchaseUpdate); } @Override public int hashCode() { - return Objects.hash(orderId, packageName, purchaseTime, purchaseToken, signature, products, isAutoRenewing, originalJson, developerPayload, isAcknowledged, quantity, purchaseState, accountIdentifiers, pendingPurchaseUpdate); + return Objects.hash( + orderId, + packageName, + purchaseTime, + purchaseToken, + signature, + products, + isAutoRenewing, + originalJson, + developerPayload, + isAcknowledged, + quantity, + purchaseState, + accountIdentifiers, + pendingPurchaseUpdate); } public static final class Builder { @@ -1700,7 +1822,8 @@ public static final class Builder { private @Nullable PlatformAccountIdentifiers accountIdentifiers; @CanIgnoreReturnValue - public @NonNull Builder setAccountIdentifiers(@Nullable PlatformAccountIdentifiers setterArg) { + public @NonNull Builder setAccountIdentifiers( + @Nullable PlatformAccountIdentifiers setterArg) { this.accountIdentifiers = setterArg; return this; } @@ -1708,7 +1831,8 @@ public static final class Builder { private @Nullable PlatformPendingPurchaseUpdate pendingPurchaseUpdate; @CanIgnoreReturnValue - public @NonNull Builder setPendingPurchaseUpdate(@Nullable PlatformPendingPurchaseUpdate setterArg) { + public @NonNull Builder setPendingPurchaseUpdate( + @Nullable PlatformPendingPurchaseUpdate setterArg) { this.pendingPurchaseUpdate = setterArg; return this; } @@ -1790,9 +1914,9 @@ ArrayList toList() { /** * Pigeon version of Java Purchase. * - * See also PendingPurchaseUpdateWrapper on the Dart side. + *

See also PendingPurchaseUpdateWrapper on the Dart side. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPendingPurchaseUpdate { private @NonNull List products; @@ -1826,8 +1950,12 @@ public void setPurchaseToken(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPendingPurchaseUpdate that = (PlatformPendingPurchaseUpdate) o; return products.equals(that.products) && purchaseToken.equals(that.purchaseToken); } @@ -1871,7 +1999,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPendingPurchaseUpdate fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformPendingPurchaseUpdate fromList( + @NonNull ArrayList pigeonVar_list) { PlatformPendingPurchaseUpdate pigeonResult = new PlatformPendingPurchaseUpdate(); Object products = pigeonVar_list.get(0); pigeonResult.setProducts((List) products); @@ -1884,9 +2013,9 @@ ArrayList toList() { /** * Pigeon version of PurchaseHistoryRecord. * - * See also PurchaseHistoryRecordWrapper on the Dart side. + *

See also PurchaseHistoryRecordWrapper on the Dart side. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchaseHistoryRecord { private @NonNull Long quantity; @@ -1982,15 +2111,32 @@ public void setProducts(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPurchaseHistoryRecord that = (PlatformPurchaseHistoryRecord) o; - return quantity.equals(that.quantity) && purchaseTime.equals(that.purchaseTime) && Objects.equals(developerPayload, that.developerPayload) && originalJson.equals(that.originalJson) && purchaseToken.equals(that.purchaseToken) && signature.equals(that.signature) && products.equals(that.products); + return quantity.equals(that.quantity) + && purchaseTime.equals(that.purchaseTime) + && Objects.equals(developerPayload, that.developerPayload) + && originalJson.equals(that.originalJson) + && purchaseToken.equals(that.purchaseToken) + && signature.equals(that.signature) + && products.equals(that.products); } @Override public int hashCode() { - return Objects.hash(quantity, purchaseTime, developerPayload, originalJson, purchaseToken, signature, products); + return Objects.hash( + quantity, + purchaseTime, + developerPayload, + originalJson, + purchaseToken, + signature, + products); } public static final class Builder { @@ -2077,7 +2223,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPurchaseHistoryRecord fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformPurchaseHistoryRecord fromList( + @NonNull ArrayList pigeonVar_list) { PlatformPurchaseHistoryRecord pigeonResult = new PlatformPurchaseHistoryRecord(); Object quantity = pigeonVar_list.get(0); pigeonResult.setQuantity((Long) quantity); @@ -2098,10 +2245,10 @@ ArrayList toList() { } /** - * 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. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchaseHistoryResponse { private @NonNull PlatformBillingResult billingResult; @@ -2135,8 +2282,12 @@ public void setPurchases(@NonNull List setterArg) @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPurchaseHistoryResponse that = (PlatformPurchaseHistoryResponse) o; return billingResult.equals(that.billingResult) && purchases.equals(that.purchases); } @@ -2180,7 +2331,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPurchaseHistoryResponse fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformPurchaseHistoryResponse fromList( + @NonNull ArrayList pigeonVar_list) { PlatformPurchaseHistoryResponse pigeonResult = new PlatformPurchaseHistoryResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -2191,10 +2343,10 @@ ArrayList toList() { } /** - * 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. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchasesResponse { private @NonNull PlatformBillingResult billingResult; @@ -2228,8 +2380,12 @@ public void setPurchases(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPurchasesResponse that = (PlatformPurchasesResponse) o; return billingResult.equals(that.billingResult) && purchases.equals(that.purchases); } @@ -2286,7 +2442,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.SubscriptionOfferDetails. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformSubscriptionOfferDetails { private @NonNull String basePlanId; @@ -2366,15 +2522,25 @@ public void setInstallmentPlanDetails(@Nullable PlatformInstallmentPlanDetails s @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformSubscriptionOfferDetails that = (PlatformSubscriptionOfferDetails) o; - return basePlanId.equals(that.basePlanId) && Objects.equals(offerId, that.offerId) && offerToken.equals(that.offerToken) && offerTags.equals(that.offerTags) && pricingPhases.equals(that.pricingPhases) && Objects.equals(installmentPlanDetails, that.installmentPlanDetails); + return basePlanId.equals(that.basePlanId) + && Objects.equals(offerId, that.offerId) + && offerToken.equals(that.offerToken) + && offerTags.equals(that.offerTags) + && pricingPhases.equals(that.pricingPhases) + && Objects.equals(installmentPlanDetails, that.installmentPlanDetails); } @Override public int hashCode() { - return Objects.hash(basePlanId, offerId, offerToken, offerTags, pricingPhases, installmentPlanDetails); + return Objects.hash( + basePlanId, offerId, offerToken, offerTags, pricingPhases, installmentPlanDetails); } public static final class Builder { @@ -2422,7 +2588,8 @@ public static final class Builder { private @Nullable PlatformInstallmentPlanDetails installmentPlanDetails; @CanIgnoreReturnValue - public @NonNull Builder setInstallmentPlanDetails(@Nullable PlatformInstallmentPlanDetails setterArg) { + public @NonNull Builder setInstallmentPlanDetails( + @Nullable PlatformInstallmentPlanDetails setterArg) { this.installmentPlanDetails = setterArg; return this; } @@ -2451,7 +2618,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformSubscriptionOfferDetails fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformSubscriptionOfferDetails fromList( + @NonNull ArrayList pigeonVar_list) { PlatformSubscriptionOfferDetails pigeonResult = new PlatformSubscriptionOfferDetails(); Object basePlanId = pigeonVar_list.get(0); pigeonResult.setBasePlanId((String) basePlanId); @@ -2464,7 +2632,8 @@ ArrayList toList() { Object pricingPhases = pigeonVar_list.get(4); pigeonResult.setPricingPhases((List) pricingPhases); Object installmentPlanDetails = pigeonVar_list.get(5); - pigeonResult.setInstallmentPlanDetails((PlatformInstallmentPlanDetails) installmentPlanDetails); + pigeonResult.setInstallmentPlanDetails( + (PlatformInstallmentPlanDetails) installmentPlanDetails); return pigeonResult; } } @@ -2472,7 +2641,7 @@ ArrayList toList() { /** * Pigeon version of UserChoiceDetailsWrapper and Java UserChoiceDetails. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformUserChoiceDetails { private @Nullable String originalExternalTransactionId; @@ -2516,10 +2685,16 @@ public void setProducts(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformUserChoiceDetails that = (PlatformUserChoiceDetails) o; - return Objects.equals(originalExternalTransactionId, that.originalExternalTransactionId) && externalTransactionToken.equals(that.externalTransactionToken) && products.equals(that.products); + return Objects.equals(originalExternalTransactionId, that.originalExternalTransactionId) + && externalTransactionToken.equals(that.externalTransactionToken) + && products.equals(that.products); } @Override @@ -2586,7 +2761,7 @@ ArrayList toList() { /** * Pigeon version of UserChoiseDetails.Product. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformUserChoiceProduct { private @NonNull String id; @@ -2630,10 +2805,16 @@ public void setType(@NonNull PlatformProductType setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformUserChoiceProduct that = (PlatformUserChoiceProduct) o; - return id.equals(that.id) && Objects.equals(offerToken, that.offerToken) && type.equals(that.type); + return id.equals(that.id) + && Objects.equals(offerToken, that.offerToken) + && type.equals(that.type); } @Override @@ -2700,7 +2881,7 @@ ArrayList toList() { /** * Pigeon version of ProductDetails.InstallmentPlanDetails. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformInstallmentPlanDetails { private @NonNull Long commitmentPaymentsCount; @@ -2724,7 +2905,8 @@ public void setCommitmentPaymentsCount(@NonNull Long setterArg) { public void setSubsequentCommitmentPaymentsCount(@NonNull Long setterArg) { if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"subsequentCommitmentPaymentsCount\" is null."); + throw new IllegalStateException( + "Nonnull field \"subsequentCommitmentPaymentsCount\" is null."); } this.subsequentCommitmentPaymentsCount = setterArg; } @@ -2734,10 +2916,15 @@ public void setSubsequentCommitmentPaymentsCount(@NonNull Long setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformInstallmentPlanDetails that = (PlatformInstallmentPlanDetails) o; - return commitmentPaymentsCount.equals(that.commitmentPaymentsCount) && subsequentCommitmentPaymentsCount.equals(that.subsequentCommitmentPaymentsCount); + return commitmentPaymentsCount.equals(that.commitmentPaymentsCount) + && subsequentCommitmentPaymentsCount.equals(that.subsequentCommitmentPaymentsCount); } @Override @@ -2779,7 +2966,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformInstallmentPlanDetails fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformInstallmentPlanDetails fromList( + @NonNull ArrayList pigeonVar_list) { PlatformInstallmentPlanDetails pigeonResult = new PlatformInstallmentPlanDetails(); Object commitmentPaymentsCount = pigeonVar_list.get(0); pigeonResult.setCommitmentPaymentsCount((Long) commitmentPaymentsCount); @@ -2797,22 +2985,30 @@ private PigeonCodec() {} @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte) 129: { - Object value = readValue(buffer); - return value == null ? null : PlatformProductType.values()[((Long) value).intValue()]; - } - case (byte) 130: { - Object value = readValue(buffer); - return value == null ? null : PlatformBillingChoiceMode.values()[((Long) value).intValue()]; - } - case (byte) 131: { - Object value = readValue(buffer); - return value == null ? null : PlatformPurchaseState.values()[((Long) value).intValue()]; - } - case (byte) 132: { - Object value = readValue(buffer); - return value == null ? null : PlatformRecurrenceMode.values()[((Long) value).intValue()]; - } + case (byte) 129: + { + Object value = readValue(buffer); + return value == null ? null : PlatformProductType.values()[((Long) value).intValue()]; + } + case (byte) 130: + { + Object value = readValue(buffer); + return value == null + ? null + : PlatformBillingChoiceMode.values()[((Long) value).intValue()]; + } + case (byte) 131: + { + Object value = readValue(buffer); + return value == null ? null : PlatformPurchaseState.values()[((Long) value).intValue()]; + } + case (byte) 132: + { + Object value = readValue(buffer); + return value == null + ? null + : PlatformRecurrenceMode.values()[((Long) value).intValue()]; + } case (byte) 133: return PlatformQueryProduct.fromList((ArrayList) readValue(buffer)); case (byte) 134: @@ -2820,13 +3016,15 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { case (byte) 135: return PlatformBillingResult.fromList((ArrayList) readValue(buffer)); case (byte) 136: - return PlatformOneTimePurchaseOfferDetails.fromList((ArrayList) readValue(buffer)); + return PlatformOneTimePurchaseOfferDetails.fromList( + (ArrayList) readValue(buffer)); case (byte) 137: return PlatformProductDetails.fromList((ArrayList) readValue(buffer)); case (byte) 138: return PlatformProductDetailsResponse.fromList((ArrayList) readValue(buffer)); case (byte) 139: - return PlatformAlternativeBillingOnlyReportingDetailsResponse.fromList((ArrayList) readValue(buffer)); + return PlatformAlternativeBillingOnlyReportingDetailsResponse.fromList( + (ArrayList) readValue(buffer)); case (byte) 140: return PlatformBillingConfigResponse.fromList((ArrayList) readValue(buffer)); case (byte) 141: @@ -2890,7 +3088,8 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { writeValue(stream, ((PlatformProductDetailsResponse) value).toList()); } else if (value instanceof PlatformAlternativeBillingOnlyReportingDetailsResponse) { stream.write(139); - writeValue(stream, ((PlatformAlternativeBillingOnlyReportingDetailsResponse) value).toList()); + writeValue( + stream, ((PlatformAlternativeBillingOnlyReportingDetailsResponse) value).toList()); } else if (value instanceof PlatformBillingConfigResponse) { stream.write(140); writeValue(stream, ((PlatformBillingConfigResponse) value).toList()); @@ -2933,7 +3132,6 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { } } - /** Asynchronous error handling return type for non-nullable API method returns. */ public interface Result { /** Success case callback method for handling returns. */ @@ -2961,51 +3159,86 @@ public interface VoidResult { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InAppPurchaseApi { /** Wraps BillingClient#isReady. */ - @NonNull + @NonNull Boolean isReady(); /** Wraps BillingClient#startConnection(BillingClientStateListener). */ - void startConnection(@NonNull Long callbackHandle, @NonNull PlatformBillingChoiceMode billingMode, @NonNull Result result); + void startConnection( + @NonNull Long callbackHandle, + @NonNull PlatformBillingChoiceMode billingMode, + @NonNull Result result); /** Wraps BillingClient#endConnection(BillingClientStateListener). */ void endConnection(); - /** Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, BillingConfigResponseListener). */ + /** + * Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, + * BillingConfigResponseListener). + */ void getBillingConfigAsync(@NonNull Result result); /** Wraps BillingClient#launchBillingFlow(Activity, BillingFlowParams). */ - @NonNull + @NonNull PlatformBillingResult launchBillingFlow(@NonNull PlatformBillingFlowParams params); - /** Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, AcknowledgePurchaseResponseListener). */ - void acknowledgePurchase(@NonNull String purchaseToken, @NonNull Result result); + /** + * Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, + * AcknowledgePurchaseResponseListener). + */ + void acknowledgePurchase( + @NonNull String purchaseToken, @NonNull Result result); /** Wraps BillingClient#consumeAsync(ConsumeParams, ConsumeResponseListener). */ void consumeAsync(@NonNull String purchaseToken, @NonNull Result result); /** Wraps BillingClient#queryPurchasesAsync(QueryPurchaseParams, PurchaseResponseListener). */ - 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). */ - void queryProductDetailsAsync(@NonNull List products, @NonNull Result result); + 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). + */ + void queryProductDetailsAsync( + @NonNull List products, + @NonNull Result result); /** Wraps BillingClient#isFeatureSupported(String). */ - @NonNull + @NonNull Boolean isFeatureSupported(@NonNull String feature); /** Wraps BillingClient#isAlternativeBillingOnlyAvailableAsync(). */ void isAlternativeBillingOnlyAvailableAsync(@NonNull Result result); /** Wraps BillingClient#showAlternativeBillingOnlyInformationDialog(). */ void showAlternativeBillingOnlyInformationDialog(@NonNull Result result); - /** Wraps BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). */ - void createAlternativeBillingOnlyReportingDetailsAsync(@NonNull Result result); + /** + * Wraps + * BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). + */ + void createAlternativeBillingOnlyReportingDetailsAsync( + @NonNull Result result); /** The codec used by InAppPurchaseApi. */ static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } - /**Sets up an instance of `InAppPurchaseApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `InAppPurchaseApi` to handle messages through the `binaryMessenger`. + */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable InAppPurchaseApi api) { setUp(binaryMessenger, "", api); } - static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String messageChannelSuffix, @Nullable InAppPurchaseApi api) { + + static void setUp( + @NonNull BinaryMessenger binaryMessenger, + @NonNull String messageChannelSuffix, + @Nullable InAppPurchaseApi api) { messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3013,8 +3246,7 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String mess try { Boolean output = api.isReady(); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3026,7 +3258,10 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String mess { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3056,7 +3291,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3064,8 +3302,7 @@ public void error(Throwable error) { try { api.endConnection(); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3077,7 +3314,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3104,7 +3344,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3114,8 +3357,7 @@ public void error(Throwable error) { try { PlatformBillingResult output = api.launchBillingFlow(paramsArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3127,7 +3369,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3156,7 +3401,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3185,7 +3433,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3214,7 +3465,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3243,7 +3497,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3272,7 +3529,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3282,8 +3542,7 @@ public void error(Throwable error) { try { Boolean output = api.isFeatureSupported(featureArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3295,7 +3554,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3322,7 +3584,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3349,14 +3614,18 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList wrapped = new ArrayList<>(); Result resultCallback = new Result() { - public void success(PlatformAlternativeBillingOnlyReportingDetailsResponse result) { + public void success( + PlatformAlternativeBillingOnlyReportingDetailsResponse result) { wrapped.add(0, result); reply.reply(wrapped); } @@ -3383,79 +3652,90 @@ public static class InAppPurchaseCallbackApi { public InAppPurchaseCallbackApi(@NonNull BinaryMessenger argBinaryMessenger) { this(argBinaryMessenger, ""); } - public InAppPurchaseCallbackApi(@NonNull BinaryMessenger argBinaryMessenger, @NonNull String messageChannelSuffix) { + + public InAppPurchaseCallbackApi( + @NonNull BinaryMessenger argBinaryMessenger, @NonNull String messageChannelSuffix) { this.binaryMessenger = argBinaryMessenger; this.messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; } - /** - * Public interface for sending reply. - * The codec used by InAppPurchaseCallbackApi. - */ + /** Public interface for sending reply. The codec used by InAppPurchaseCallbackApi. */ static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } /** Called for BillingClientStateListener#onBillingServiceDisconnected(). */ - public void onBillingServiceDisconnected(@NonNull Long callbackHandleArg, @NonNull VoidResult result) { - final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected" + messageChannelSuffix; + public void onBillingServiceDisconnected( + @NonNull Long callbackHandleArg, @NonNull VoidResult result) { + final String channelName = + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected" + + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(callbackHandleArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error( + new FlutterError( + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } /** Called for PurchasesUpdatedListener#onPurchasesUpdated(BillingResult, List). */ - public void onPurchasesUpdated(@NonNull PlatformPurchasesResponse updateArg, @NonNull VoidResult result) { - final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated" + messageChannelSuffix; + public void onPurchasesUpdated( + @NonNull PlatformPurchasesResponse updateArg, @NonNull VoidResult result) { + final String channelName = + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated" + + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(updateArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error( + new FlutterError( + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } /** Called for UserChoiceBillingListener#userSelectedAlternativeBilling(UserChoiceDetails). */ - public void userSelectedalternativeBilling(@NonNull PlatformUserChoiceDetails detailsArg, @NonNull VoidResult result) { - final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling" + messageChannelSuffix; + public void userSelectedalternativeBilling( + @NonNull PlatformUserChoiceDetails detailsArg, @NonNull VoidResult result) { + final String channelName = + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling" + + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(detailsArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error( + new FlutterError( + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } } 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 92fd90546e82..0b71a08f2f52 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 @@ -244,7 +244,7 @@ static PlatformPurchaseState toPlatformPurchaseState(int state) { } static @Nullable PlatformPendingPurchaseUpdate fromPendingPurchaseUpdate( - @Nullable Purchase.PendingPurchaseUpdate pendingPurchaseUpdate) { + @Nullable Purchase.PendingPurchaseUpdate pendingPurchaseUpdate) { if (pendingPurchaseUpdate == null) { return null; } 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 5bc6555cdd0f..7f01ad183687 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 @@ -684,7 +684,7 @@ public void launchBillingFlow_ok_Proration() { String purchaseToken = "purchaseTokenFoo"; String accountId = "account"; int replacementMode = - BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.CHARGE_PRORATED_PRICE; + BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.CHARGE_PRORATED_PRICE; queryForProducts(unmodifiableList(asList(productId, oldProductId))); PlatformBillingFlowParams.Builder paramsBuilder = new PlatformBillingFlowParams.Builder(); paramsBuilder.setProduct(productId); 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 4e61be83e549..330f3a3668d1 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 @@ -288,14 +288,15 @@ private void assertSerialized(Purchase expected, Messages.PlatformPurchase seria Objects.requireNonNull(serialized.getAccountIdentifiers()).getObfuscatedProfileId()); } - private void assertSerialized(ProductDetails.InstallmentPlanDetails expected, - Messages.PlatformInstallmentPlanDetails serialized) { + private void assertSerialized( + ProductDetails.InstallmentPlanDetails expected, + Messages.PlatformInstallmentPlanDetails serialized) { assertEquals( - expected.getInstallmentPlanCommitmentPaymentsCount(), - serialized.getCommitmentPaymentsCount().intValue()); + expected.getInstallmentPlanCommitmentPaymentsCount(), + serialized.getCommitmentPaymentsCount().intValue()); assertEquals( - expected.getSubsequentInstallmentPlanCommitmentPaymentsCount(), - serialized.getSubsequentCommitmentPaymentsCount().intValue()); + expected.getSubsequentInstallmentPlanCommitmentPaymentsCount(), + serialized.getSubsequentCommitmentPaymentsCount().intValue()); } private String productTypeFromPlatform(Messages.PlatformProductType type) { From 4f17824d6183718d37f9c14b50004d9075d83cfd Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Tue, 3 Dec 2024 00:43:29 +0100 Subject: [PATCH 09/16] Adds support for pending prepaid plans Signed-off-by: Marcin Chudy --- .../in_app_purchase_android/CHANGELOG.md | 238 +++--- .../inapppurchase/BillingClientFactory.java | 5 +- .../BillingClientFactoryImpl.java | 12 +- .../plugins/inapppurchase/Messages.java | 768 +++++++----------- .../inapppurchase/MethodCallHandlerImpl.java | 3 +- .../BillingClientFactoryImplTest.java | 6 +- .../inapppurchase/MethodCallHandlerTest.java | 16 +- .../billing_client_manager.dart | 27 +- .../billing_client_wrapper.dart | 34 +- .../pending_purchases_params_wrapper.dart | 53 ++ .../pending_purchases_params_wrapper.g.dart | 13 + ...pp_purchase_android_platform_addition.dart | 26 - .../lib/src/messages.g.dart | 338 +++++--- .../lib/src/pigeon_converters.dart | 9 + .../pigeons/messages.dart | 14 +- .../billing_client_manager_test.dart | 40 +- .../billing_client_wrapper_test.dart | 14 +- .../billing_client_wrapper_test.mocks.dart | 4 + ...rchase_android_platform_addition_test.dart | 6 +- ...in_app_purchase_android_platform_test.dart | 10 +- 20 files changed, 830 insertions(+), 806 deletions(-) create mode 100644 packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/pending_purchases_params_wrapper.dart create mode 100644 packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/pending_purchases_params_wrapper.g.dart 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 bfa7d76bca0d..726c851f2e87 100644 --- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md @@ -1,386 +1,394 @@ +## 0.4.0 + +- Updates Google Play Billing Library to 7.1.1. +- **BREAKING CHANGE**: Removes the depracated `ProrationMode` enum. `ReplacementMode` should be used instead. +- **BREAKING CHANGE**: Removes the depracated `BillingClientWrapper.enablePendingPurchases`. +- Adds `installmentPlanDetails` to `SubscriptionOfferDetailsWrapper` +- Adds APIs to support pending transactions for subscription prepaid plans (`PendingPurchaseParams`). + ## 0.3.6+12 -* Updates README to remove contributor-focused documentation. +- Updates README to remove contributor-focused documentation. ## 0.3.6+11 -* Bumps androidx.annotation:annotation from 1.8.2 to 1.9.0. +- Bumps androidx.annotation:annotation from 1.8.2 to 1.9.0. ## 0.3.6+10 -* Updates Pigeon for non-nullable collection type support. +- Updates Pigeon for non-nullable collection type support. -## 0.3.6+9 +## 0.3.6+9A -* Updates Java compatibility version to 11. +- Updates Java compatibility version to 11. ## 0.3.6+8 -* Removes dependency on org.jetbrains.kotlin:kotlin-bom. -* Updates minimum supported SDK version to Flutter 3.24/Dart 3.5. +- Removes dependency on org.jetbrains.kotlin:kotlin-bom. +- Updates minimum supported SDK version to Flutter 3.24/Dart 3.5. ## 0.3.6+7 -* Sets `android.buildFeatures.buildConfig` to true for compatibility with AGP 8.0+. +- Sets `android.buildFeatures.buildConfig` to true for compatibility with AGP 8.0+. ## 0.3.6+6 -* Bumps androidx.annotation:annotation from 1.8.1 to 1.8.2. +- Bumps androidx.annotation:annotation from 1.8.1 to 1.8.2. ## 0.3.6+5 -* Bumps com.android.billingclient:billing from 6.1.0 to 6.2.0. +- Bumps com.android.billingclient:billing from 6.1.0 to 6.2.0. ## 0.3.6+4 -* Bumps androidx.annotation:annotation from 1.8.0 to 1.8.1. +- Bumps androidx.annotation:annotation from 1.8.0 to 1.8.1. ## 0.3.6+3 -* Updates lint checks to ignore NewerVersionAvailable. +- Updates lint checks to ignore NewerVersionAvailable. ## 0.3.6+2 -* Updates Android Gradle Plugin to 8.5.1. +- Updates Android Gradle Plugin to 8.5.1. ## 0.3.6+1 -* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. -* Removes support for apps using the v1 Android embedding. +- Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. +- Removes support for apps using the v1 Android embedding. ## 0.3.6 -* Introduces new `ReplacementMode` for Android's billing client as `ProrationMode` is being deprecated. +- Introduces new `ReplacementMode` for Android's billing client as `ProrationMode` is being deprecated. ## 0.3.5+2 -* Bumps androidx.annotation:annotation from 1.7.1 to 1.8.0. -* Updates minimum supported SDK version to Flutter 3.16/Dart 3.2. +- Bumps androidx.annotation:annotation from 1.7.1 to 1.8.0. +- Updates minimum supported SDK version to Flutter 3.16/Dart 3.2. ## 0.3.5+1 -* Updates example to use `countryCode` instead of deprecated `getCountryCode`. +- Updates example to use `countryCode` instead of deprecated `getCountryCode`. ## 0.3.5 -* Replaces `getCountryCode` with `countryCode`. +- Replaces `getCountryCode` with `countryCode`. ## 0.3.4+1 -* Adds documentation for UserChoice and Alternative Billing. +- Adds documentation for UserChoice and Alternative Billing. ## 0.3.4 -* Adds `countryCode` API. +- Adds `countryCode` API. ## 0.3.3+1 -* Moves alternative billing listener creation to BillingClientFactoryImpl. +- Moves alternative billing listener creation to BillingClientFactoryImpl. ## 0.3.3 -* Converts data objects in internal platform communication to Pigeon. -* Deprecates JSON serialization and deserialization for Billing Client wrapper +- Converts data objects in internal platform communication to Pigeon. +- Deprecates JSON serialization and deserialization for Billing Client wrapper objects. ## 0.3.2+1 -* Converts internal platform communication to Pigeon. +- Converts internal platform communication to Pigeon. ## 0.3.2 -* Adds UserChoiceBilling APIs to platform addition. -* Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. +- Adds UserChoiceBilling APIs to platform addition. +- Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. ## 0.3.1 -* Adds alternative-billing-only APIs to InAppPurchaseAndroidPlatformAddition. +- Adds alternative-billing-only APIs to InAppPurchaseAndroidPlatformAddition. ## 0.3.0+18 -* Adds new getCountryCode() method to InAppPurchaseAndroidPlatformAddition to get a customer's country code. -* Updates compileSdk version to 34. +- Adds new getCountryCode() method to InAppPurchaseAndroidPlatformAddition to get a customer's country code. +- Updates compileSdk version to 34. ## 0.3.0+17 -* Bumps androidx.annotation:annotation from 1.7.0 to 1.7.1. +- Bumps androidx.annotation:annotation from 1.7.0 to 1.7.1. ## 0.3.0+16 -* Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. -* Fixes new lint warnings. +- Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. +- Fixes new lint warnings. ## 0.3.0+15 -* Adds missing network error response code to BillingResponse enum. +- Adds missing network error response code to BillingResponse enum. ## 0.3.0+14 -* Updates annotations lib to 1.7.0. +- Updates annotations lib to 1.7.0. ## 0.3.0+13 -* Updates example code for current versions of Flutter. +- Updates example code for current versions of Flutter. ## 0.3.0+12 -* Adds pub topics to package metadata. -* Updates minimum supported SDK version to Flutter 3.7/Dart 2.19. +- Adds pub topics to package metadata. +- Updates minimum supported SDK version to Flutter 3.7/Dart 2.19. ## 0.3.0+11 -* Migrates `styleFrom` usage in examples off of deprecated `primary` and `onPrimary` parameters. +- Migrates `styleFrom` usage in examples off of deprecated `primary` and `onPrimary` parameters. ## 0.3.0+10 -* Bumps com.android.billingclient:billing from 6.0.0 to 6.0.1. +- Bumps com.android.billingclient:billing from 6.0.0 to 6.0.1. ## 0.3.0+9 -* Bumps com.android.billingclient:billing from 5.2.0 to 6.0.0. +- Bumps com.android.billingclient:billing from 5.2.0 to 6.0.0. ## 0.3.0+8 -* Adds a [guide for migrating](migration_guide.md) to [0.3.0](#0.3.0). +- Adds a [guide for migrating](migration_guide.md) to [0.3.0](#0.3.0). ## 0.3.0+7 -* Bumps org.mockito:mockito-core from 4.7.0 to 5.3.1. +- Bumps org.mockito:mockito-core from 4.7.0 to 5.3.1. ## 0.3.0+6 -* Bumps org.jetbrains.kotlin:kotlin-bom from 1.8.21 to 1.8.22. +- Bumps org.jetbrains.kotlin:kotlin-bom from 1.8.21 to 1.8.22. ## 0.3.0+5 -* Bumps org.jetbrains.kotlin:kotlin-bom from 1.8.0 to 1.8.21. +- Bumps org.jetbrains.kotlin:kotlin-bom from 1.8.0 to 1.8.21. ## 0.3.0+4 -* Fixes unawaited_futures violations. +- Fixes unawaited_futures violations. ## 0.3.0+3 -* Fixes Java lint issues. +- Fixes Java lint issues. ## 0.3.0+2 -* Removes obsolete null checks on non-nullable values. +- Removes obsolete null checks on non-nullable values. ## 0.3.0+1 -* Fixes misaligned method signature strings. +- Fixes misaligned method signature strings. ## 0.3.0 -* **BREAKING CHANGE**: Removes `launchPriceChangeConfirmationFlow` from `InAppPurchaseAndroidPlatform`. Price changes are now [handled by Google Play](https://developer.android.com/google/play/billing/subscriptions#price-change). -* Returns both base plans and offers when `queryProductDetailsAsync` is called. +- **BREAKING CHANGE**: Removes `launchPriceChangeConfirmationFlow` from `InAppPurchaseAndroidPlatform`. Price changes are now [handled by Google Play](https://developer.android.com/google/play/billing/subscriptions#price-change). +- Returns both base plans and offers when `queryProductDetailsAsync` is called. ## 0.2.5+5 -* Updates gradle, AGP and fixes some lint errors. +- Updates gradle, AGP and fixes some lint errors. ## 0.2.5+4 -* Fixes compatibility with AGP versions older than 4.2. +- Fixes compatibility with AGP versions older than 4.2. ## 0.2.5+3 -* Updates com.android.billingclient:billing from 5.1.0 to 5.2.0. +- Updates com.android.billingclient:billing from 5.1.0 to 5.2.0. ## 0.2.5+2 -* Updates androidx.annotation:annotation from 1.5.0 to 1.6.0. +- Updates androidx.annotation:annotation from 1.5.0 to 1.6.0. ## 0.2.5+1 -* Adds a namespace for compatibility with AGP 8.0. +- Adds a namespace for compatibility with AGP 8.0. ## 0.2.5 -* Fixes the management of `BillingClient` connection by handling `BillingResponse.serviceDisconnected`. -* Introduces `BillingClientManager`. -* Updates minimum Flutter version to 3.3. +- Fixes the management of `BillingClient` connection by handling `BillingResponse.serviceDisconnected`. +- Introduces `BillingClientManager`. +- Updates minimum Flutter version to 3.3. ## 0.2.4+3 -* Clarifies explanation of endorsement in README. -* Aligns Dart and Flutter SDK constraints. -* Updates compileSdkVersion to 33. +- Clarifies explanation of endorsement in README. +- Aligns Dart and Flutter SDK constraints. +- Updates compileSdkVersion to 33. ## 0.2.4+2 -* Updates links for the merge of flutter/plugins into flutter/packages. +- Updates links for the merge of flutter/plugins into flutter/packages. ## 0.2.4+1 -* Updates Google Play Billing Library to 5.1.0. -* Updates androidx.annotation to 1.5.0. +- Updates Google Play Billing Library to 5.1.0. +- Updates androidx.annotation to 1.5.0. ## 0.2.4 -* Updates minimum Flutter version to 3.0. -* Ignores a lint in the example app for backwards compatibility. +- Updates minimum Flutter version to 3.0. +- Ignores a lint in the example app for backwards compatibility. ## 0.2.3+9 -* Updates `androidx.test.espresso:espresso-core` to 3.5.1. +- Updates `androidx.test.espresso:espresso-core` to 3.5.1. ## 0.2.3+8 -* Updates code for stricter lint checks. +- Updates code for stricter lint checks. ## 0.2.3+7 -* Updates code for new analysis options. +- Updates code for new analysis options. ## 0.2.3+6 -* Updates android gradle plugin to 7.3.1. +- Updates android gradle plugin to 7.3.1. ## 0.2.3+5 -* Updates imports for `prefer_relative_imports`. +- Updates imports for `prefer_relative_imports`. ## 0.2.3+4 -* Updates minimum Flutter version to 2.10. -* Adds IMMEDIATE_AND_CHARGE_FULL_PRICE to the `ProrationMode`. +- Updates minimum Flutter version to 2.10. +- Adds IMMEDIATE_AND_CHARGE_FULL_PRICE to the `ProrationMode`. ## 0.2.3+3 -* Fixes avoid_redundant_argument_values lint warnings and minor typos. +- Fixes avoid_redundant_argument_values lint warnings and minor typos. ## 0.2.3+2 -* Fixes incorrect json key in `queryPurchasesAsync` that fixes restore purchases functionality. +- Fixes incorrect json key in `queryPurchasesAsync` that fixes restore purchases functionality. ## 0.2.3+1 -* Updates `json_serializable` to fix warnings in generated code. +- Updates `json_serializable` to fix warnings in generated code. ## 0.2.3 -* Upgrades Google Play Billing Library to 5.0 -* Migrates APIs to support breaking changes in new Google Play Billing API -* `PurchaseWrapper` and `PurchaseHistoryRecordWrapper` now handles `skus` a list of sku strings. `sku` is deprecated. +- Upgrades Google Play Billing Library to 5.0 +- Migrates APIs to support breaking changes in new Google Play Billing API +- `PurchaseWrapper` and `PurchaseHistoryRecordWrapper` now handles `skus` a list of sku strings. `sku` is deprecated. ## 0.2.2+8 -* Ignores deprecation warnings for upcoming styleFrom button API changes. +- Ignores deprecation warnings for upcoming styleFrom button API changes. ## 0.2.2+7 -* Updates references to the obsolete master branch. +- Updates references to the obsolete master branch. ## 0.2.2+6 -* Enables mocking models by changing overridden operator == parameter type from `dynamic` to `Object`. +- Enables mocking models by changing overridden operator == parameter type from `dynamic` to `Object`. ## 0.2.2+5 -* Minor fixes for new analysis options. +- Minor fixes for new analysis options. ## 0.2.2+4 -* Removes unnecessary imports. -* Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors +- Removes unnecessary imports. +- Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors lint warnings. ## 0.2.2+3 -* Migrates from `ui.hash*` to `Object.hash*`. -* Updates minimum Flutter version to 2.5.0. +- Migrates from `ui.hash*` to `Object.hash*`. +- Updates minimum Flutter version to 2.5.0. ## 0.2.2+2 -* Internal code cleanup for stricter analysis options. +- Internal code cleanup for stricter analysis options. ## 0.2.2+1 -* Removes the dependency on `meta`. +- Removes the dependency on `meta`. ## 0.2.2 -* Fixes the `purchaseStream` incorrectly reporting `PurchaseStatus.error` when user upgrades subscription by deferred proration mode. +- Fixes the `purchaseStream` incorrectly reporting `PurchaseStatus.error` when user upgrades subscription by deferred proration mode. ## 0.2.1 -* Deprecated the `InAppPurchaseAndroidPlatformAddition.enablePendingPurchases()` method and `InAppPurchaseAndroidPlatformAddition.enablePendingPurchase` property. Since Google Play no longer accepts App submissions that don't support pending purchases it is no longer necessary to acknowledge this through code. -* Updates example app Android compileSdkVersion to 31. +- Deprecated the `InAppPurchaseAndroidPlatformAddition.enablePendingPurchases()` method and `InAppPurchaseAndroidPlatformAddition.enablePendingPurchase` property. Since Google Play no longer accepts App submissions that don't support pending purchases it is no longer necessary to acknowledge this through code. +- Updates example app Android compileSdkVersion to 31. ## 0.2.0 -* BREAKING CHANGE : Refactor to handle new `PurchaseStatus` named `canceled`. This means developers +- BREAKING CHANGE : Refactor to handle new `PurchaseStatus` named `canceled`. This means developers can distinguish between an error and user cancellation. ## 0.1.6 -* Require Dart SDK >= 2.14. -* Update `json_annotation` dependency to `^4.3.0`. +- Require Dart SDK >= 2.14. +- Update `json_annotation` dependency to `^4.3.0`. ## 0.1.5+1 -* Fix a broken link in the README. +- Fix a broken link in the README. ## 0.1.5 -* Introduced the `SkuDetailsWrapper.introductoryPriceAmountMicros` field of the correct type (`int`) and deprecated the `SkuDetailsWrapper.introductoryPriceMicros` field. -* Update dev_dependency `build_runner` to ^2.0.0 and `json_serializable` to ^5.0.2. +- Introduced the `SkuDetailsWrapper.introductoryPriceAmountMicros` field of the correct type (`int`) and deprecated the `SkuDetailsWrapper.introductoryPriceMicros` field. +- Update dev_dependency `build_runner` to ^2.0.0 and `json_serializable` to ^5.0.2. ## 0.1.4+7 -* Ensure that the `SkuDetailsWrapper.introductoryPriceMicros` is populated correctly. +- Ensure that the `SkuDetailsWrapper.introductoryPriceMicros` is populated correctly. ## 0.1.4+6 -* Ensure that purchases correctly indicate whether they are acknowledged or not. The `PurchaseDetails.pendingCompletePurchase` field now correctly indicates if the purchase still needs to be completed. +- Ensure that purchases correctly indicate whether they are acknowledged or not. The `PurchaseDetails.pendingCompletePurchase` field now correctly indicates if the purchase still needs to be completed. ## 0.1.4+5 -* Add `implements` to pubspec. -* Updated Android lint settings. +- Add `implements` to pubspec. +- Updated Android lint settings. ## 0.1.4+4 -* Removed dependency on the `test` package. +- Removed dependency on the `test` package. ## 0.1.4+3 -* Updated installation instructions in README. +- Updated installation instructions in README. ## 0.1.4+2 -* Added price currency symbol to SkuDetailsWrapper. +- Added price currency symbol to SkuDetailsWrapper. ## 0.1.4+1 -* Fixed typos. +- Fixed typos. ## 0.1.4 -* Added support for launchPriceChangeConfirmationFlow in the BillingClientWrapper and in InAppPurchaseAndroidPlatformAddition. +- Added support for launchPriceChangeConfirmationFlow in the BillingClientWrapper and in InAppPurchaseAndroidPlatformAddition. ## 0.1.3+1 -* Add payment proxy. +- Add payment proxy. ## 0.1.3 -* Added support for isFeatureSupported in the BillingClientWrapper and in InAppPurchaseAndroidPlatformAddition. +- Added support for isFeatureSupported in the BillingClientWrapper and in InAppPurchaseAndroidPlatformAddition. ## 0.1.2 -* Added support for the obfuscatedAccountId and obfuscatedProfileId in the PurchaseWrapper. +- Added support for the obfuscatedAccountId and obfuscatedProfileId in the PurchaseWrapper. ## 0.1.1 -* Added support to request a list of active subscriptions and non-consumed one-time purchases on Android, through the `InAppPurchaseAndroidPlatformAddition.queryPastPurchases` method. +- Added support to request a list of active subscriptions and non-consumed one-time purchases on Android, through the `InAppPurchaseAndroidPlatformAddition.queryPastPurchases` method. ## 0.1.0+1 -* Migrate maven repository from jcenter to mavenCentral. +- Migrate maven repository from jcenter to mavenCentral. ## 0.1.0 -* Initial open-source release. +- Initial open-source release. diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactory.java b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactory.java index 979e54a37bbf..8d04ef35efa9 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactory.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactory.java @@ -7,6 +7,8 @@ import android.content.Context; import androidx.annotation.NonNull; import com.android.billingclient.api.BillingClient; +import com.android.billingclient.api.PendingPurchasesParams; + import io.flutter.plugins.inapppurchase.Messages.PlatformBillingChoiceMode; /** Responsible for creating a {@link BillingClient} object. */ @@ -24,5 +26,6 @@ interface BillingClientFactory { BillingClient createBillingClient( @NonNull Context context, @NonNull Messages.InAppPurchaseCallbackApi callbackApi, - PlatformBillingChoiceMode billingChoiceMode); + PlatformBillingChoiceMode billingChoiceMode, + Messages.PendingPurchasesParams pendingPurchasesParams); } diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java index 6aaa17b8c5e9..65eb971e06d7 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java @@ -22,11 +22,17 @@ final class BillingClientFactoryImpl implements BillingClientFactory { public BillingClient createBillingClient( @NonNull Context context, @NonNull Messages.InAppPurchaseCallbackApi callbackApi, - PlatformBillingChoiceMode billingChoiceMode) { + PlatformBillingChoiceMode billingChoiceMode, + Messages.PendingPurchasesParams pendingPurchasesParams) { + PendingPurchasesParams.Builder pendingPurchasesBuilder = PendingPurchasesParams.newBuilder() + .enableOneTimeProducts(); + if (pendingPurchasesParams != null && pendingPurchasesParams.getEnablePrepaidPlans()) { + pendingPurchasesBuilder.enablePrepaidPlans(); + } + BillingClient.Builder builder = BillingClient.newBuilder(context) - .enablePendingPurchases( - PendingPurchasesParams.newBuilder().enableOneTimeProducts().build()); + .enablePendingPurchases(pendingPurchasesBuilder.build()); switch (billingChoiceMode) { case ALTERNATIVE_BILLING_ONLY: // https://developer.android.com/google/play/billing/alternative/alternative-billing-without-user-choice-in-app 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 366524fd38c0..ab33dd96b1b8 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 @@ -21,8 +21,11 @@ import java.lang.annotation.Target; import java.nio.ByteBuffer; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; /** Generated class from Pigeon. */ @@ -38,7 +41,8 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) + { super(message); this.code = code; this.details = details; @@ -57,15 +61,14 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @NonNull protected static FlutterError createConnectionError(@NonNull String channelName) { - return new FlutterError( - "channel-error", "Unable to establish connection on channel: " + channelName + ".", ""); + return new FlutterError("channel-error", "Unable to establish connection on channel: " + channelName + ".", ""); } @Target(METHOD) @@ -89,7 +92,7 @@ public enum PlatformBillingChoiceMode { /** * Billing through google play. * - *

Default state. + * Default state. */ PLAY_BILLING_ONLY(0), /** Billing through app provided flow. */ @@ -133,7 +136,7 @@ public enum PlatformRecurrenceMode { /** * Pigeon version of Java QueryProductDetailsParams.Product. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformQueryProduct { private @NonNull String productId; @@ -167,12 +170,8 @@ public void setProductType(@NonNull PlatformProductType setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformQueryProduct that = (PlatformQueryProduct) o; return productId.equals(that.productId) && productType.equals(that.productType); } @@ -229,7 +228,7 @@ ArrayList toList() { /** * Pigeon version of Java AccountIdentifiers. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformAccountIdentifiers { private @Nullable String obfuscatedAccountId; @@ -254,15 +253,10 @@ public void setObfuscatedProfileId(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformAccountIdentifiers that = (PlatformAccountIdentifiers) o; - return Objects.equals(obfuscatedAccountId, that.obfuscatedAccountId) - && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId); + return Objects.equals(obfuscatedAccountId, that.obfuscatedAccountId) && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId); } @Override @@ -317,7 +311,7 @@ ArrayList toList() { /** * Pigeon version of Java BillingResult. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingResult { private @NonNull Long responseCode; @@ -351,12 +345,8 @@ public void setDebugMessage(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformBillingResult that = (PlatformBillingResult) o; return responseCode.equals(that.responseCode) && debugMessage.equals(that.debugMessage); } @@ -413,7 +403,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.OneTimePurchaseOfferDetails. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformOneTimePurchaseOfferDetails { private @NonNull Long priceAmountMicros; @@ -460,16 +450,10 @@ public void setPriceCurrencyCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformOneTimePurchaseOfferDetails that = (PlatformOneTimePurchaseOfferDetails) o; - return priceAmountMicros.equals(that.priceAmountMicros) - && formattedPrice.equals(that.formattedPrice) - && priceCurrencyCode.equals(that.priceCurrencyCode); + return priceAmountMicros.equals(that.priceAmountMicros) && formattedPrice.equals(that.formattedPrice) && priceCurrencyCode.equals(that.priceCurrencyCode); } @Override @@ -504,8 +488,7 @@ public static final class Builder { } public @NonNull PlatformOneTimePurchaseOfferDetails build() { - PlatformOneTimePurchaseOfferDetails pigeonReturn = - new PlatformOneTimePurchaseOfferDetails(); + PlatformOneTimePurchaseOfferDetails pigeonReturn = new PlatformOneTimePurchaseOfferDetails(); pigeonReturn.setPriceAmountMicros(priceAmountMicros); pigeonReturn.setFormattedPrice(formattedPrice); pigeonReturn.setPriceCurrencyCode(priceCurrencyCode); @@ -522,8 +505,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformOneTimePurchaseOfferDetails fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformOneTimePurchaseOfferDetails fromList(@NonNull ArrayList pigeonVar_list) { PlatformOneTimePurchaseOfferDetails pigeonResult = new PlatformOneTimePurchaseOfferDetails(); Object priceAmountMicros = pigeonVar_list.get(0); pigeonResult.setPriceAmountMicros((Long) priceAmountMicros); @@ -538,7 +520,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformProductDetails { private @NonNull String description; @@ -612,8 +594,7 @@ public void setTitle(@NonNull String setterArg) { return oneTimePurchaseOfferDetails; } - public void setOneTimePurchaseOfferDetails( - @Nullable PlatformOneTimePurchaseOfferDetails setterArg) { + public void setOneTimePurchaseOfferDetails(@Nullable PlatformOneTimePurchaseOfferDetails setterArg) { this.oneTimePurchaseOfferDetails = setterArg; } @@ -623,8 +604,7 @@ public void setOneTimePurchaseOfferDetails( return subscriptionOfferDetails; } - public void setSubscriptionOfferDetails( - @Nullable List setterArg) { + public void setSubscriptionOfferDetails(@Nullable List setterArg) { this.subscriptionOfferDetails = setterArg; } @@ -633,32 +613,15 @@ public void setSubscriptionOfferDetails( @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformProductDetails that = (PlatformProductDetails) o; - return description.equals(that.description) - && name.equals(that.name) - && productId.equals(that.productId) - && productType.equals(that.productType) - && title.equals(that.title) - && Objects.equals(oneTimePurchaseOfferDetails, that.oneTimePurchaseOfferDetails) - && Objects.equals(subscriptionOfferDetails, that.subscriptionOfferDetails); + return description.equals(that.description) && name.equals(that.name) && productId.equals(that.productId) && productType.equals(that.productType) && title.equals(that.title) && Objects.equals(oneTimePurchaseOfferDetails, that.oneTimePurchaseOfferDetails) && Objects.equals(subscriptionOfferDetails, that.subscriptionOfferDetails); } @Override public int hashCode() { - return Objects.hash( - description, - name, - productId, - productType, - title, - oneTimePurchaseOfferDetails, - subscriptionOfferDetails); + return Objects.hash(description, name, productId, productType, title, oneTimePurchaseOfferDetails, subscriptionOfferDetails); } public static final class Builder { @@ -706,8 +669,7 @@ public static final class Builder { private @Nullable PlatformOneTimePurchaseOfferDetails oneTimePurchaseOfferDetails; @CanIgnoreReturnValue - public @NonNull Builder setOneTimePurchaseOfferDetails( - @Nullable PlatformOneTimePurchaseOfferDetails setterArg) { + public @NonNull Builder setOneTimePurchaseOfferDetails(@Nullable PlatformOneTimePurchaseOfferDetails setterArg) { this.oneTimePurchaseOfferDetails = setterArg; return this; } @@ -715,8 +677,7 @@ public static final class Builder { private @Nullable List subscriptionOfferDetails; @CanIgnoreReturnValue - public @NonNull Builder setSubscriptionOfferDetails( - @Nullable List setterArg) { + public @NonNull Builder setSubscriptionOfferDetails(@Nullable List setterArg) { this.subscriptionOfferDetails = setterArg; return this; } @@ -760,20 +721,18 @@ ArrayList toList() { Object title = pigeonVar_list.get(4); pigeonResult.setTitle((String) title); Object oneTimePurchaseOfferDetails = pigeonVar_list.get(5); - pigeonResult.setOneTimePurchaseOfferDetails( - (PlatformOneTimePurchaseOfferDetails) oneTimePurchaseOfferDetails); + pigeonResult.setOneTimePurchaseOfferDetails((PlatformOneTimePurchaseOfferDetails) oneTimePurchaseOfferDetails); Object subscriptionOfferDetails = pigeonVar_list.get(6); - pigeonResult.setSubscriptionOfferDetails( - (List) subscriptionOfferDetails); + pigeonResult.setSubscriptionOfferDetails((List) subscriptionOfferDetails); return pigeonResult; } } /** - * 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. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformProductDetailsResponse { private @NonNull PlatformBillingResult billingResult; @@ -807,12 +766,8 @@ public void setProductDetails(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformProductDetailsResponse that = (PlatformProductDetailsResponse) o; return billingResult.equals(that.billingResult) && productDetails.equals(that.productDetails); } @@ -856,8 +811,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformProductDetailsResponse fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformProductDetailsResponse fromList(@NonNull ArrayList pigeonVar_list) { PlatformProductDetailsResponse pigeonResult = new PlatformProductDetailsResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -868,10 +822,11 @@ ArrayList toList() { } /** - * 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. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformAlternativeBillingOnlyReportingDetailsResponse { private @NonNull PlatformBillingResult billingResult; @@ -905,16 +860,10 @@ public void setExternalTransactionToken(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformAlternativeBillingOnlyReportingDetailsResponse that = - (PlatformAlternativeBillingOnlyReportingDetailsResponse) o; - return billingResult.equals(that.billingResult) - && externalTransactionToken.equals(that.externalTransactionToken); + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + PlatformAlternativeBillingOnlyReportingDetailsResponse that = (PlatformAlternativeBillingOnlyReportingDetailsResponse) o; + return billingResult.equals(that.billingResult) && externalTransactionToken.equals(that.externalTransactionToken); } @Override @@ -941,8 +890,7 @@ public static final class Builder { } public @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse build() { - PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonReturn = - new PlatformAlternativeBillingOnlyReportingDetailsResponse(); + PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonReturn = new PlatformAlternativeBillingOnlyReportingDetailsResponse(); pigeonReturn.setBillingResult(billingResult); pigeonReturn.setExternalTransactionToken(externalTransactionToken); return pigeonReturn; @@ -957,10 +905,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse fromList( - @NonNull ArrayList pigeonVar_list) { - PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonResult = - new PlatformAlternativeBillingOnlyReportingDetailsResponse(); + static @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse fromList(@NonNull ArrayList pigeonVar_list) { + PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonResult = new PlatformAlternativeBillingOnlyReportingDetailsResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); Object externalTransactionToken = pigeonVar_list.get(1); @@ -970,10 +916,10 @@ ArrayList toList() { } /** - * 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. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingConfigResponse { private @NonNull PlatformBillingResult billingResult; @@ -1007,12 +953,8 @@ public void setCountryCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformBillingConfigResponse that = (PlatformBillingConfigResponse) o; return billingResult.equals(that.billingResult) && countryCode.equals(that.countryCode); } @@ -1056,8 +998,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformBillingConfigResponse fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformBillingConfigResponse fromList(@NonNull ArrayList pigeonVar_list) { PlatformBillingConfigResponse pigeonResult = new PlatformBillingConfigResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -1070,7 +1011,7 @@ ArrayList toList() { /** * Pigeon version of Java BillingFlowParams. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingFlowParams { private @NonNull String product; @@ -1154,32 +1095,15 @@ public void setPurchaseToken(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformBillingFlowParams that = (PlatformBillingFlowParams) o; - return product.equals(that.product) - && replacementMode.equals(that.replacementMode) - && Objects.equals(offerToken, that.offerToken) - && Objects.equals(accountId, that.accountId) - && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId) - && Objects.equals(oldProduct, that.oldProduct) - && Objects.equals(purchaseToken, that.purchaseToken); + return product.equals(that.product) && replacementMode.equals(that.replacementMode) && Objects.equals(offerToken, that.offerToken) && Objects.equals(accountId, that.accountId) && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId) && Objects.equals(oldProduct, that.oldProduct) && Objects.equals(purchaseToken, that.purchaseToken); } @Override public int hashCode() { - return Objects.hash( - product, - replacementMode, - offerToken, - accountId, - obfuscatedProfileId, - oldProduct, - purchaseToken); + return Objects.hash(product, replacementMode, offerToken, accountId, obfuscatedProfileId, oldProduct, purchaseToken); } public static final class Builder { @@ -1289,7 +1213,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.PricingPhase. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPricingPhase { private @NonNull Long billingCycleCount; @@ -1375,30 +1299,15 @@ public void setPriceCurrencyCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPricingPhase that = (PlatformPricingPhase) o; - return billingCycleCount.equals(that.billingCycleCount) - && recurrenceMode.equals(that.recurrenceMode) - && priceAmountMicros.equals(that.priceAmountMicros) - && billingPeriod.equals(that.billingPeriod) - && formattedPrice.equals(that.formattedPrice) - && priceCurrencyCode.equals(that.priceCurrencyCode); + return billingCycleCount.equals(that.billingCycleCount) && recurrenceMode.equals(that.recurrenceMode) && priceAmountMicros.equals(that.priceAmountMicros) && billingPeriod.equals(that.billingPeriod) && formattedPrice.equals(that.formattedPrice) && priceCurrencyCode.equals(that.priceCurrencyCode); } @Override public int hashCode() { - return Objects.hash( - billingCycleCount, - recurrenceMode, - priceAmountMicros, - billingPeriod, - formattedPrice, - priceCurrencyCode); + return Objects.hash(billingCycleCount, recurrenceMode, priceAmountMicros, billingPeriod, formattedPrice, priceCurrencyCode); } public static final class Builder { @@ -1496,9 +1405,9 @@ ArrayList toList() { /** * Pigeon version of Java Purchase. * - *

See also PurchaseWrapper on the Dart side. + * See also PurchaseWrapper on the Dart side. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchase { private @Nullable String orderId; @@ -1679,46 +1588,15 @@ public void setPendingPurchaseUpdate(@Nullable PlatformPendingPurchaseUpdate set @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPurchase that = (PlatformPurchase) o; - return Objects.equals(orderId, that.orderId) - && packageName.equals(that.packageName) - && purchaseTime.equals(that.purchaseTime) - && purchaseToken.equals(that.purchaseToken) - && signature.equals(that.signature) - && products.equals(that.products) - && isAutoRenewing.equals(that.isAutoRenewing) - && originalJson.equals(that.originalJson) - && developerPayload.equals(that.developerPayload) - && isAcknowledged.equals(that.isAcknowledged) - && quantity.equals(that.quantity) - && purchaseState.equals(that.purchaseState) - && Objects.equals(accountIdentifiers, that.accountIdentifiers) - && Objects.equals(pendingPurchaseUpdate, that.pendingPurchaseUpdate); + return Objects.equals(orderId, that.orderId) && packageName.equals(that.packageName) && purchaseTime.equals(that.purchaseTime) && purchaseToken.equals(that.purchaseToken) && signature.equals(that.signature) && products.equals(that.products) && isAutoRenewing.equals(that.isAutoRenewing) && originalJson.equals(that.originalJson) && developerPayload.equals(that.developerPayload) && isAcknowledged.equals(that.isAcknowledged) && quantity.equals(that.quantity) && purchaseState.equals(that.purchaseState) && Objects.equals(accountIdentifiers, that.accountIdentifiers) && Objects.equals(pendingPurchaseUpdate, that.pendingPurchaseUpdate); } @Override public int hashCode() { - return Objects.hash( - orderId, - packageName, - purchaseTime, - purchaseToken, - signature, - products, - isAutoRenewing, - originalJson, - developerPayload, - isAcknowledged, - quantity, - purchaseState, - accountIdentifiers, - pendingPurchaseUpdate); + return Objects.hash(orderId, packageName, purchaseTime, purchaseToken, signature, products, isAutoRenewing, originalJson, developerPayload, isAcknowledged, quantity, purchaseState, accountIdentifiers, pendingPurchaseUpdate); } public static final class Builder { @@ -1822,8 +1700,7 @@ public static final class Builder { private @Nullable PlatformAccountIdentifiers accountIdentifiers; @CanIgnoreReturnValue - public @NonNull Builder setAccountIdentifiers( - @Nullable PlatformAccountIdentifiers setterArg) { + public @NonNull Builder setAccountIdentifiers(@Nullable PlatformAccountIdentifiers setterArg) { this.accountIdentifiers = setterArg; return this; } @@ -1831,8 +1708,7 @@ public static final class Builder { private @Nullable PlatformPendingPurchaseUpdate pendingPurchaseUpdate; @CanIgnoreReturnValue - public @NonNull Builder setPendingPurchaseUpdate( - @Nullable PlatformPendingPurchaseUpdate setterArg) { + public @NonNull Builder setPendingPurchaseUpdate(@Nullable PlatformPendingPurchaseUpdate setterArg) { this.pendingPurchaseUpdate = setterArg; return this; } @@ -1914,9 +1790,9 @@ ArrayList toList() { /** * Pigeon version of Java Purchase. * - *

See also PendingPurchaseUpdateWrapper on the Dart side. + * See also PendingPurchaseUpdateWrapper on the Dart side. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPendingPurchaseUpdate { private @NonNull List products; @@ -1950,12 +1826,8 @@ public void setPurchaseToken(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPendingPurchaseUpdate that = (PlatformPendingPurchaseUpdate) o; return products.equals(that.products) && purchaseToken.equals(that.purchaseToken); } @@ -1999,8 +1871,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPendingPurchaseUpdate fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformPendingPurchaseUpdate fromList(@NonNull ArrayList pigeonVar_list) { PlatformPendingPurchaseUpdate pigeonResult = new PlatformPendingPurchaseUpdate(); Object products = pigeonVar_list.get(0); pigeonResult.setProducts((List) products); @@ -2013,9 +1884,9 @@ ArrayList toList() { /** * Pigeon version of PurchaseHistoryRecord. * - *

See also PurchaseHistoryRecordWrapper on the Dart side. + * See also PurchaseHistoryRecordWrapper on the Dart side. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchaseHistoryRecord { private @NonNull Long quantity; @@ -2111,32 +1982,15 @@ public void setProducts(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPurchaseHistoryRecord that = (PlatformPurchaseHistoryRecord) o; - return quantity.equals(that.quantity) - && purchaseTime.equals(that.purchaseTime) - && Objects.equals(developerPayload, that.developerPayload) - && originalJson.equals(that.originalJson) - && purchaseToken.equals(that.purchaseToken) - && signature.equals(that.signature) - && products.equals(that.products); + return quantity.equals(that.quantity) && purchaseTime.equals(that.purchaseTime) && Objects.equals(developerPayload, that.developerPayload) && originalJson.equals(that.originalJson) && purchaseToken.equals(that.purchaseToken) && signature.equals(that.signature) && products.equals(that.products); } @Override public int hashCode() { - return Objects.hash( - quantity, - purchaseTime, - developerPayload, - originalJson, - purchaseToken, - signature, - products); + return Objects.hash(quantity, purchaseTime, developerPayload, originalJson, purchaseToken, signature, products); } public static final class Builder { @@ -2223,8 +2077,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPurchaseHistoryRecord fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformPurchaseHistoryRecord fromList(@NonNull ArrayList pigeonVar_list) { PlatformPurchaseHistoryRecord pigeonResult = new PlatformPurchaseHistoryRecord(); Object quantity = pigeonVar_list.get(0); pigeonResult.setQuantity((Long) quantity); @@ -2245,10 +2098,10 @@ ArrayList toList() { } /** - * 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. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchaseHistoryResponse { private @NonNull PlatformBillingResult billingResult; @@ -2282,12 +2135,8 @@ public void setPurchases(@NonNull List setterArg) @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPurchaseHistoryResponse that = (PlatformPurchaseHistoryResponse) o; return billingResult.equals(that.billingResult) && purchases.equals(that.purchases); } @@ -2331,8 +2180,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPurchaseHistoryResponse fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformPurchaseHistoryResponse fromList(@NonNull ArrayList pigeonVar_list) { PlatformPurchaseHistoryResponse pigeonResult = new PlatformPurchaseHistoryResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -2343,10 +2191,10 @@ ArrayList toList() { } /** - * 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. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchasesResponse { private @NonNull PlatformBillingResult billingResult; @@ -2380,12 +2228,8 @@ public void setPurchases(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformPurchasesResponse that = (PlatformPurchasesResponse) o; return billingResult.equals(that.billingResult) && purchases.equals(that.purchases); } @@ -2442,7 +2286,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.SubscriptionOfferDetails. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformSubscriptionOfferDetails { private @NonNull String basePlanId; @@ -2522,25 +2366,15 @@ public void setInstallmentPlanDetails(@Nullable PlatformInstallmentPlanDetails s @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformSubscriptionOfferDetails that = (PlatformSubscriptionOfferDetails) o; - return basePlanId.equals(that.basePlanId) - && Objects.equals(offerId, that.offerId) - && offerToken.equals(that.offerToken) - && offerTags.equals(that.offerTags) - && pricingPhases.equals(that.pricingPhases) - && Objects.equals(installmentPlanDetails, that.installmentPlanDetails); + return basePlanId.equals(that.basePlanId) && Objects.equals(offerId, that.offerId) && offerToken.equals(that.offerToken) && offerTags.equals(that.offerTags) && pricingPhases.equals(that.pricingPhases) && Objects.equals(installmentPlanDetails, that.installmentPlanDetails); } @Override public int hashCode() { - return Objects.hash( - basePlanId, offerId, offerToken, offerTags, pricingPhases, installmentPlanDetails); + return Objects.hash(basePlanId, offerId, offerToken, offerTags, pricingPhases, installmentPlanDetails); } public static final class Builder { @@ -2588,8 +2422,7 @@ public static final class Builder { private @Nullable PlatformInstallmentPlanDetails installmentPlanDetails; @CanIgnoreReturnValue - public @NonNull Builder setInstallmentPlanDetails( - @Nullable PlatformInstallmentPlanDetails setterArg) { + public @NonNull Builder setInstallmentPlanDetails(@Nullable PlatformInstallmentPlanDetails setterArg) { this.installmentPlanDetails = setterArg; return this; } @@ -2618,8 +2451,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformSubscriptionOfferDetails fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformSubscriptionOfferDetails fromList(@NonNull ArrayList pigeonVar_list) { PlatformSubscriptionOfferDetails pigeonResult = new PlatformSubscriptionOfferDetails(); Object basePlanId = pigeonVar_list.get(0); pigeonResult.setBasePlanId((String) basePlanId); @@ -2632,8 +2464,7 @@ ArrayList toList() { Object pricingPhases = pigeonVar_list.get(4); pigeonResult.setPricingPhases((List) pricingPhases); Object installmentPlanDetails = pigeonVar_list.get(5); - pigeonResult.setInstallmentPlanDetails( - (PlatformInstallmentPlanDetails) installmentPlanDetails); + pigeonResult.setInstallmentPlanDetails((PlatformInstallmentPlanDetails) installmentPlanDetails); return pigeonResult; } } @@ -2641,7 +2472,7 @@ ArrayList toList() { /** * Pigeon version of UserChoiceDetailsWrapper and Java UserChoiceDetails. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformUserChoiceDetails { private @Nullable String originalExternalTransactionId; @@ -2685,16 +2516,10 @@ public void setProducts(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformUserChoiceDetails that = (PlatformUserChoiceDetails) o; - return Objects.equals(originalExternalTransactionId, that.originalExternalTransactionId) - && externalTransactionToken.equals(that.externalTransactionToken) - && products.equals(that.products); + return Objects.equals(originalExternalTransactionId, that.originalExternalTransactionId) && externalTransactionToken.equals(that.externalTransactionToken) && products.equals(that.products); } @Override @@ -2761,7 +2586,7 @@ ArrayList toList() { /** * Pigeon version of UserChoiseDetails.Product. * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformUserChoiceProduct { private @NonNull String id; @@ -2805,16 +2630,10 @@ public void setType(@NonNull PlatformProductType setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformUserChoiceProduct that = (PlatformUserChoiceProduct) o; - return id.equals(that.id) - && Objects.equals(offerToken, that.offerToken) - && type.equals(that.type); + return id.equals(that.id) && Objects.equals(offerToken, that.offerToken) && type.equals(that.type); } @Override @@ -2880,8 +2699,9 @@ ArrayList toList() { /** * Pigeon version of ProductDetails.InstallmentPlanDetails. + * https://developer.android.com/reference/com/android/billingclient/api/PendingPurchasesParams.Builder#enableOneTimeProducts() * - *

Generated class from Pigeon that represents data sent in messages. + * Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformInstallmentPlanDetails { private @NonNull Long commitmentPaymentsCount; @@ -2905,8 +2725,7 @@ public void setCommitmentPaymentsCount(@NonNull Long setterArg) { public void setSubsequentCommitmentPaymentsCount(@NonNull Long setterArg) { if (setterArg == null) { - throw new IllegalStateException( - "Nonnull field \"subsequentCommitmentPaymentsCount\" is null."); + throw new IllegalStateException("Nonnull field \"subsequentCommitmentPaymentsCount\" is null."); } this.subsequentCommitmentPaymentsCount = setterArg; } @@ -2916,15 +2735,10 @@ public void setSubsequentCommitmentPaymentsCount(@NonNull Long setterArg) { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } PlatformInstallmentPlanDetails that = (PlatformInstallmentPlanDetails) o; - return commitmentPaymentsCount.equals(that.commitmentPaymentsCount) - && subsequentCommitmentPaymentsCount.equals(that.subsequentCommitmentPaymentsCount); + return commitmentPaymentsCount.equals(that.commitmentPaymentsCount) && subsequentCommitmentPaymentsCount.equals(that.subsequentCommitmentPaymentsCount); } @Override @@ -2966,8 +2780,7 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformInstallmentPlanDetails fromList( - @NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformInstallmentPlanDetails fromList(@NonNull ArrayList pigeonVar_list) { PlatformInstallmentPlanDetails pigeonResult = new PlatformInstallmentPlanDetails(); Object commitmentPaymentsCount = pigeonVar_list.get(0); pigeonResult.setCommitmentPaymentsCount((Long) commitmentPaymentsCount); @@ -2977,6 +2790,73 @@ ArrayList toList() { } } + /** + * Pigeon version of Java PendingPurchasesParams. + * + * Generated class from Pigeon that represents data sent in messages. + */ + public static final class PendingPurchasesParams { + private @NonNull Boolean enablePrepaidPlans; + + public @NonNull Boolean getEnablePrepaidPlans() { + return enablePrepaidPlans; + } + + public void setEnablePrepaidPlans(@NonNull Boolean setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"enablePrepaidPlans\" is null."); + } + this.enablePrepaidPlans = setterArg; + } + + /** Constructor is non-public to enforce null safety; use Builder. */ + PendingPurchasesParams() {} + + @Override + public boolean equals(Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + PendingPurchasesParams that = (PendingPurchasesParams) o; + return enablePrepaidPlans.equals(that.enablePrepaidPlans); + } + + @Override + public int hashCode() { + return Objects.hash(enablePrepaidPlans); + } + + public static final class Builder { + + private @Nullable Boolean enablePrepaidPlans; + + @CanIgnoreReturnValue + public @NonNull Builder setEnablePrepaidPlans(@NonNull Boolean setterArg) { + this.enablePrepaidPlans = setterArg; + return this; + } + + public @NonNull PendingPurchasesParams build() { + PendingPurchasesParams pigeonReturn = new PendingPurchasesParams(); + pigeonReturn.setEnablePrepaidPlans(enablePrepaidPlans); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList<>(1); + toListResult.add(enablePrepaidPlans); + return toListResult; + } + + static @NonNull PendingPurchasesParams fromList(@NonNull ArrayList pigeonVar_list) { + PendingPurchasesParams pigeonResult = new PendingPurchasesParams(); + Object enablePrepaidPlans = pigeonVar_list.get(0); + pigeonResult.setEnablePrepaidPlans((Boolean) enablePrepaidPlans); + return pigeonResult; + } + } + private static class PigeonCodec extends StandardMessageCodec { public static final PigeonCodec INSTANCE = new PigeonCodec(); @@ -2985,30 +2865,22 @@ private PigeonCodec() {} @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte) 129: - { - Object value = readValue(buffer); - return value == null ? null : PlatformProductType.values()[((Long) value).intValue()]; - } - case (byte) 130: - { - Object value = readValue(buffer); - return value == null - ? null - : PlatformBillingChoiceMode.values()[((Long) value).intValue()]; - } - case (byte) 131: - { - Object value = readValue(buffer); - return value == null ? null : PlatformPurchaseState.values()[((Long) value).intValue()]; - } - case (byte) 132: - { - Object value = readValue(buffer); - return value == null - ? null - : PlatformRecurrenceMode.values()[((Long) value).intValue()]; - } + case (byte) 129: { + Object value = readValue(buffer); + return value == null ? null : PlatformProductType.values()[((Long) value).intValue()]; + } + case (byte) 130: { + Object value = readValue(buffer); + return value == null ? null : PlatformBillingChoiceMode.values()[((Long) value).intValue()]; + } + case (byte) 131: { + Object value = readValue(buffer); + return value == null ? null : PlatformPurchaseState.values()[((Long) value).intValue()]; + } + case (byte) 132: { + Object value = readValue(buffer); + return value == null ? null : PlatformRecurrenceMode.values()[((Long) value).intValue()]; + } case (byte) 133: return PlatformQueryProduct.fromList((ArrayList) readValue(buffer)); case (byte) 134: @@ -3016,15 +2888,13 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { case (byte) 135: return PlatformBillingResult.fromList((ArrayList) readValue(buffer)); case (byte) 136: - return PlatformOneTimePurchaseOfferDetails.fromList( - (ArrayList) readValue(buffer)); + return PlatformOneTimePurchaseOfferDetails.fromList((ArrayList) readValue(buffer)); case (byte) 137: return PlatformProductDetails.fromList((ArrayList) readValue(buffer)); case (byte) 138: return PlatformProductDetailsResponse.fromList((ArrayList) readValue(buffer)); case (byte) 139: - return PlatformAlternativeBillingOnlyReportingDetailsResponse.fromList( - (ArrayList) readValue(buffer)); + return PlatformAlternativeBillingOnlyReportingDetailsResponse.fromList((ArrayList) readValue(buffer)); case (byte) 140: return PlatformBillingConfigResponse.fromList((ArrayList) readValue(buffer)); case (byte) 141: @@ -3049,6 +2919,8 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { return PlatformUserChoiceProduct.fromList((ArrayList) readValue(buffer)); case (byte) 151: return PlatformInstallmentPlanDetails.fromList((ArrayList) readValue(buffer)); + case (byte) 152: + return PendingPurchasesParams.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); } @@ -3088,8 +2960,7 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { writeValue(stream, ((PlatformProductDetailsResponse) value).toList()); } else if (value instanceof PlatformAlternativeBillingOnlyReportingDetailsResponse) { stream.write(139); - writeValue( - stream, ((PlatformAlternativeBillingOnlyReportingDetailsResponse) value).toList()); + writeValue(stream, ((PlatformAlternativeBillingOnlyReportingDetailsResponse) value).toList()); } else if (value instanceof PlatformBillingConfigResponse) { stream.write(140); writeValue(stream, ((PlatformBillingConfigResponse) value).toList()); @@ -3126,12 +2997,16 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { } else if (value instanceof PlatformInstallmentPlanDetails) { stream.write(151); writeValue(stream, ((PlatformInstallmentPlanDetails) value).toList()); + } else if (value instanceof PendingPurchasesParams) { + stream.write(152); + writeValue(stream, ((PendingPurchasesParams) value).toList()); } else { super.writeValue(stream, value); } } } + /** Asynchronous error handling return type for non-nullable API method returns. */ public interface Result { /** Success case callback method for handling returns. */ @@ -3159,86 +3034,51 @@ public interface VoidResult { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InAppPurchaseApi { /** Wraps BillingClient#isReady. */ - @NonNull + @NonNull Boolean isReady(); /** Wraps BillingClient#startConnection(BillingClientStateListener). */ - void startConnection( - @NonNull Long callbackHandle, - @NonNull PlatformBillingChoiceMode billingMode, - @NonNull Result result); + void startConnection(@NonNull Long callbackHandle, @NonNull PlatformBillingChoiceMode billingMode, @NonNull PendingPurchasesParams pendingPurchasesParams, @NonNull Result result); /** Wraps BillingClient#endConnection(BillingClientStateListener). */ void endConnection(); - /** - * Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, - * BillingConfigResponseListener). - */ + /** Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, BillingConfigResponseListener). */ void getBillingConfigAsync(@NonNull Result result); /** Wraps BillingClient#launchBillingFlow(Activity, BillingFlowParams). */ - @NonNull + @NonNull PlatformBillingResult launchBillingFlow(@NonNull PlatformBillingFlowParams params); - /** - * Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, - * AcknowledgePurchaseResponseListener). - */ - void acknowledgePurchase( - @NonNull String purchaseToken, @NonNull Result result); + /** Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, AcknowledgePurchaseResponseListener). */ + void acknowledgePurchase(@NonNull String purchaseToken, @NonNull Result result); /** Wraps BillingClient#consumeAsync(ConsumeParams, ConsumeResponseListener). */ void consumeAsync(@NonNull String purchaseToken, @NonNull Result result); /** Wraps BillingClient#queryPurchasesAsync(QueryPurchaseParams, PurchaseResponseListener). */ - 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). - */ - void queryProductDetailsAsync( - @NonNull List products, - @NonNull Result result); + 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). */ + void queryProductDetailsAsync(@NonNull List products, @NonNull Result result); /** Wraps BillingClient#isFeatureSupported(String). */ - @NonNull + @NonNull Boolean isFeatureSupported(@NonNull String feature); /** Wraps BillingClient#isAlternativeBillingOnlyAvailableAsync(). */ void isAlternativeBillingOnlyAvailableAsync(@NonNull Result result); /** Wraps BillingClient#showAlternativeBillingOnlyInformationDialog(). */ void showAlternativeBillingOnlyInformationDialog(@NonNull Result result); - /** - * Wraps - * BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). - */ - void createAlternativeBillingOnlyReportingDetailsAsync( - @NonNull Result result); + /** Wraps BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). */ + void createAlternativeBillingOnlyReportingDetailsAsync(@NonNull Result result); /** The codec used by InAppPurchaseApi. */ static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } - /** - * Sets up an instance of `InAppPurchaseApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `InAppPurchaseApi` to handle messages through the `binaryMessenger`. */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable InAppPurchaseApi api) { setUp(binaryMessenger, "", api); } - - static void setUp( - @NonNull BinaryMessenger binaryMessenger, - @NonNull String messageChannelSuffix, - @Nullable InAppPurchaseApi api) { + static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String messageChannelSuffix, @Nullable InAppPurchaseApi api) { messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3246,7 +3086,8 @@ static void setUp( try { Boolean output = api.isReady(); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3258,10 +3099,7 @@ static void setUp( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3269,6 +3107,7 @@ static void setUp( ArrayList args = (ArrayList) message; Long callbackHandleArg = (Long) args.get(0); PlatformBillingChoiceMode billingModeArg = (PlatformBillingChoiceMode) args.get(1); + PendingPurchasesParams pendingPurchasesParamsArg = (PendingPurchasesParams) args.get(2); Result resultCallback = new Result() { public void success(PlatformBillingResult result) { @@ -3282,7 +3121,7 @@ public void error(Throwable error) { } }; - api.startConnection(callbackHandleArg, billingModeArg, resultCallback); + api.startConnection(callbackHandleArg, billingModeArg, pendingPurchasesParamsArg, resultCallback); }); } else { channel.setMessageHandler(null); @@ -3291,10 +3130,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3302,7 +3138,8 @@ public void error(Throwable error) { try { api.endConnection(); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3314,10 +3151,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3344,10 +3178,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3357,7 +3188,8 @@ public void error(Throwable error) { try { PlatformBillingResult output = api.launchBillingFlow(paramsArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3369,10 +3201,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3401,10 +3230,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3433,10 +3259,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3465,10 +3288,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3497,10 +3317,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3529,10 +3346,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3542,7 +3356,8 @@ public void error(Throwable error) { try { Boolean output = api.isFeatureSupported(featureArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3554,10 +3369,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3584,10 +3396,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3614,18 +3423,14 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync" - + messageChannelSuffix, - getCodec()); + binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList wrapped = new ArrayList<>(); Result resultCallback = new Result() { - public void success( - PlatformAlternativeBillingOnlyReportingDetailsResponse result) { + public void success(PlatformAlternativeBillingOnlyReportingDetailsResponse result) { wrapped.add(0, result); reply.reply(wrapped); } @@ -3652,90 +3457,79 @@ public static class InAppPurchaseCallbackApi { public InAppPurchaseCallbackApi(@NonNull BinaryMessenger argBinaryMessenger) { this(argBinaryMessenger, ""); } - - public InAppPurchaseCallbackApi( - @NonNull BinaryMessenger argBinaryMessenger, @NonNull String messageChannelSuffix) { + public InAppPurchaseCallbackApi(@NonNull BinaryMessenger argBinaryMessenger, @NonNull String messageChannelSuffix) { this.binaryMessenger = argBinaryMessenger; this.messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; } - /** Public interface for sending reply. The codec used by InAppPurchaseCallbackApi. */ + /** + * Public interface for sending reply. + * The codec used by InAppPurchaseCallbackApi. + */ static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } /** Called for BillingClientStateListener#onBillingServiceDisconnected(). */ - public void onBillingServiceDisconnected( - @NonNull Long callbackHandleArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected" - + messageChannelSuffix; + public void onBillingServiceDisconnected(@NonNull Long callbackHandleArg, @NonNull VoidResult result) { + final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected" + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(callbackHandleArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } /** Called for PurchasesUpdatedListener#onPurchasesUpdated(BillingResult, List). */ - public void onPurchasesUpdated( - @NonNull PlatformPurchasesResponse updateArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated" - + messageChannelSuffix; + public void onPurchasesUpdated(@NonNull PlatformPurchasesResponse updateArg, @NonNull VoidResult result) { + final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated" + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(updateArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } /** Called for UserChoiceBillingListener#userSelectedAlternativeBilling(UserChoiceDetails). */ - public void userSelectedalternativeBilling( - @NonNull PlatformUserChoiceDetails detailsArg, @NonNull VoidResult result) { - final String channelName = - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling" - + messageChannelSuffix; + public void userSelectedalternativeBilling(@NonNull PlatformUserChoiceDetails detailsArg, @NonNull VoidResult result) { + final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling" + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>( + binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(detailsArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error( - new FlutterError( - (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } } 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 a56729e64783..6552c294e66b 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 @@ -423,10 +423,11 @@ public void queryPurchaseHistoryAsync( public void startConnection( @NonNull Long handle, @NonNull PlatformBillingChoiceMode billingMode, + @NonNull Messages.PendingPurchasesParams pendingPurchasesParams, @NonNull Result result) { if (billingClient == null) { billingClient = - billingClientFactory.createBillingClient(applicationContext, callbackApi, billingMode); + billingClientFactory.createBillingClient(applicationContext, callbackApi, billingMode, pendingPurchasesParams); } try { diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImplTest.java b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImplTest.java index d1c91fb8219c..d7b03af2b264 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImplTest.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImplTest.java @@ -55,7 +55,7 @@ public void playBillingOnly() { // No logic to verify just ensure creation works. BillingClient client = factory.createBillingClient( - context, mockCallbackApi, PlatformBillingChoiceMode.PLAY_BILLING_ONLY); + context, mockCallbackApi, PlatformBillingChoiceMode.PLAY_BILLING_ONLY, null); assertNotNull(client); } @@ -64,7 +64,7 @@ public void alternativeBillingOnly() { // No logic to verify just ensure creation works. BillingClient client = factory.createBillingClient( - context, mockCallbackApi, PlatformBillingChoiceMode.ALTERNATIVE_BILLING_ONLY); + context, mockCallbackApi, PlatformBillingChoiceMode.ALTERNATIVE_BILLING_ONLY, null); assertNotNull(client); } @@ -78,7 +78,7 @@ public void userChoiceBilling() { final BillingClient billingClient = factory.createBillingClient( - context, mockCallbackApi, PlatformBillingChoiceMode.USER_CHOICE_BILLING); + context, mockCallbackApi, PlatformBillingChoiceMode.USER_CHOICE_BILLING, null); UserChoiceDetails details = mock(UserChoiceDetails.class); final String externalTransactionToken = "someLongTokenId1234"; 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 7f01ad183687..b47762afa30b 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 @@ -110,15 +110,16 @@ public void setUp() { openMocks = MockitoAnnotations.openMocks(this); // Use the same client no matter if alternative billing is enabled or not. when(factory.createBillingClient( - context, mockCallbackApi, PlatformBillingChoiceMode.PLAY_BILLING_ONLY)) + context, mockCallbackApi, PlatformBillingChoiceMode.PLAY_BILLING_ONLY, null)) .thenReturn(mockBillingClient); when(factory.createBillingClient( - context, mockCallbackApi, PlatformBillingChoiceMode.ALTERNATIVE_BILLING_ONLY)) + context, mockCallbackApi, PlatformBillingChoiceMode.ALTERNATIVE_BILLING_ONLY, null)) .thenReturn(mockBillingClient); when(factory.createBillingClient( any(Context.class), any(InAppPurchaseCallbackApi.class), - eq(PlatformBillingChoiceMode.USER_CHOICE_BILLING))) + eq(PlatformBillingChoiceMode.USER_CHOICE_BILLING), + eq(null))) .thenReturn(mockBillingClient); methodChannelHandler = new MethodCallHandlerImpl(activity, context, mockCallbackApi, factory); when(mockActivityPluginBinding.getActivity()).thenReturn(activity); @@ -161,7 +162,7 @@ public void startConnection() { mockStartConnection(PlatformBillingChoiceMode.PLAY_BILLING_ONLY); verify(platformBillingResult, never()).success(any()); verify(factory, times(1)) - .createBillingClient(context, mockCallbackApi, PlatformBillingChoiceMode.PLAY_BILLING_ONLY); + .createBillingClient(context, mockCallbackApi, PlatformBillingChoiceMode.PLAY_BILLING_ONLY, null); BillingResult billingResult = buildBillingResult(); captor.getValue().onBillingSetupFinished(billingResult); @@ -180,7 +181,7 @@ public void startConnectionAlternativeBillingOnly() { verify(platformBillingResult, never()).success(any()); verify(factory, times(1)) .createBillingClient( - context, mockCallbackApi, PlatformBillingChoiceMode.ALTERNATIVE_BILLING_ONLY); + context, mockCallbackApi, PlatformBillingChoiceMode.ALTERNATIVE_BILLING_ONLY, null); BillingResult billingResult = buildBillingResult(); captor.getValue().onBillingSetupFinished(billingResult); @@ -202,7 +203,8 @@ public void startConnectionUserChoiceBilling() { .createBillingClient( any(Context.class), any(InAppPurchaseCallbackApi.class), - eq(PlatformBillingChoiceMode.USER_CHOICE_BILLING)); + eq(PlatformBillingChoiceMode.USER_CHOICE_BILLING), + any(Messages.PendingPurchasesParams.class)); BillingResult billingResult = BillingResult.newBuilder() @@ -223,7 +225,7 @@ public void userChoiceBillingOnSecondConnection() { mockStartConnection(PlatformBillingChoiceMode.PLAY_BILLING_ONLY); verify(platformBillingResult, never()).success(any()); verify(factory, times(1)) - .createBillingClient(context, mockCallbackApi, PlatformBillingChoiceMode.PLAY_BILLING_ONLY); + .createBillingClient(context, mockCallbackApi, PlatformBillingChoiceMode.PLAY_BILLING_ONLY, Messages.PendingPurchasesParams()); BillingResult billingResult1 = BillingResult.newBuilder() diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_manager.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_manager.dart index 8e265dbdcee8..0c63080686a4 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_manager.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_client_manager.dart @@ -8,6 +8,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; import 'billing_client_wrapper.dart'; +import 'pending_purchases_params_wrapper.dart'; import 'purchase_wrapper.dart'; import 'user_choice_details_wrapper.dart'; @@ -44,6 +45,8 @@ class BillingClientManager { BillingClientManager( {@visibleForTesting BillingClientFactory? billingClientFactory}) : _billingChoiceMode = BillingChoiceMode.playBillingOnly, + _pendingPurchasesParams = + const PendingPurchasesParamsWrapper(enablePrepaidPlans: false), _billingClientFactory = billingClientFactory ?? _createBillingClient { _connect(); } @@ -85,6 +88,7 @@ class BillingClientManager { BillingChoiceMode _billingChoiceMode; final BillingClientFactory _billingClientFactory; + PendingPurchasesParamsWrapper _pendingPurchasesParams; bool _isConnecting = false; bool _isDisposed = false; @@ -161,9 +165,14 @@ class BillingClientManager { Future reconnectWithBillingChoiceMode( BillingChoiceMode billingChoiceMode) async { _billingChoiceMode = billingChoiceMode; - // Ends connection and triggers OnBillingServiceDisconnected, which causes reconnect. - await client.endConnection(); - await _connect(); + await _reconnect(); + } + + /// Ends connection to [BillingClient] and reconnects with [pendingPurchasesParams]. + Future reconnectWithPendingPurchasesParams( + PendingPurchasesParamsWrapper pendingPurchasesParams) async { + _pendingPurchasesParams = pendingPurchasesParams; + await _reconnect(); } // If disposed, does nothing. @@ -179,13 +188,21 @@ class BillingClientManager { _isConnecting = true; _readyFuture = Future.sync(() async { await client.startConnection( - onBillingServiceDisconnected: _connect, - billingChoiceMode: _billingChoiceMode); + onBillingServiceDisconnected: _connect, + billingChoiceMode: _billingChoiceMode, + pendingPurchasesParams: _pendingPurchasesParams, + ); _isConnecting = false; }); return _readyFuture; } + Future _reconnect() async { + // Ends connection and triggers OnBillingServiceDisconnected, which causes reconnect. + await client.endConnection(); + await _connect(); + } + void _onPurchasesUpdated(PurchasesResultWrapper event) { if (_isDisposed) { return; 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 41ff39a2adea..c72c2b520899 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 @@ -11,6 +11,7 @@ import '../../billing_client_wrappers.dart'; import '../messages.g.dart'; import '../pigeon_converters.dart'; import 'billing_config_wrapper.dart'; +import 'pending_purchases_params_wrapper.dart'; part 'billing_client_wrapper.g.dart'; @@ -81,18 +82,6 @@ class BillingClient { return _hostApi.isReady(); } - /// Enable the [BillingClientWrapper] to handle pending purchases. - /// - /// **Deprecation warning:** it is no longer required to call - /// [enablePendingPurchases] when initializing your application. - @Deprecated( - 'The requirement to call `enablePendingPurchases()` has become obsolete ' - "since Google Play no longer accepts app submissions that don't support " - 'pending purchases.') - void enablePendingPurchases() { - // No-op, until it is time to completely remove this method from the API. - } - /// Calls /// [`BillingClient#startConnection(BillingClientStateListener)`](https://developer.android.com/reference/com/android/billingclient/api/BillingClient.html#startconnection) /// to create and connect a `BillingClient` instance. @@ -103,14 +92,23 @@ class BillingClient { /// /// This triggers the creation of a new `BillingClient` instance in Java if /// one doesn't already exist. - Future startConnection( - {required OnBillingServiceDisconnected onBillingServiceDisconnected, - BillingChoiceMode billingChoiceMode = - BillingChoiceMode.playBillingOnly}) async { + Future startConnection({ + required OnBillingServiceDisconnected onBillingServiceDisconnected, + BillingChoiceMode billingChoiceMode = BillingChoiceMode.playBillingOnly, + PendingPurchasesParamsWrapper? pendingPurchasesParams, + }) async { hostCallbackHandler.disconnectCallbacks.add(onBillingServiceDisconnected); - return resultWrapperFromPlatform(await _hostApi.startConnection( + return resultWrapperFromPlatform( + await _hostApi.startConnection( hostCallbackHandler.disconnectCallbacks.length - 1, - platformBillingChoiceMode(billingChoiceMode))); + platformBillingChoiceMode(billingChoiceMode), + switch (pendingPurchasesParams) { + final PendingPurchasesParamsWrapper params? => + pendingPurchasesParamsFromWrapper(params), + null => PendingPurchasesParams(enablePrepaidPlans: false) + }, + ), + ); } /// Calls diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/pending_purchases_params_wrapper.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/pending_purchases_params_wrapper.dart new file mode 100644 index 000000000000..e97ccdfa8e44 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/pending_purchases_params_wrapper.dart @@ -0,0 +1,53 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/foundation.dart'; +import 'package:json_annotation/json_annotation.dart'; + +// WARNING: Changes to `@JsonSerializable` classes need to be reflected in the +// below generated file. Run `flutter packages pub run build_runner watch` to +// rebuild and watch for further changes. +part 'pending_purchases_params_wrapper.g.dart'; + +/// Dart wrapper around [`com.android.billingclient.api.PendingPurchasesParams`](https://developer.android.com/reference/com/android/billingclient/api/PendingPurchasesParams). +/// +/// Represents the parameters to enable pending purchases. +@JsonSerializable() +@immutable +class PendingPurchasesParamsWrapper { + /// Creates a [PendingPurchasesParamsWrapper]. + const PendingPurchasesParamsWrapper({ + required this.enablePrepaidPlans, + }); + + /// Factory for creating a [PendingPurchasesParamsWrapper] from a [Map]. + @Deprecated('JSON serialization is not intended for public use, and will ' + 'be removed in a future version.') + factory PendingPurchasesParamsWrapper.fromJson(Map map) => + _$PendingPurchasesParamsWrapperFromJson(map); + + /// Enables pending purchase for prepaid plans. + /// + /// Handling pending purchases for prepaid plans is different from one-time products. + /// Your application will need to be updated to ensure subscription entitlements are + /// managed correctly with pending transactions. + /// To learn more see https://developer.android.com/google/play/billing/subscriptions#pending. + @JsonKey(defaultValue: false) + final bool enablePrepaidPlans; + + @override + bool operator ==(Object other) { + if (other.runtimeType != runtimeType) { + return false; + } + + return other is PendingPurchasesParamsWrapper && + other.enablePrepaidPlans == enablePrepaidPlans; + } + + @override + int get hashCode { + return enablePrepaidPlans.hashCode; + } +} diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/pending_purchases_params_wrapper.g.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/pending_purchases_params_wrapper.g.dart new file mode 100644 index 000000000000..491b63f61e63 --- /dev/null +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/pending_purchases_params_wrapper.g.dart @@ -0,0 +1,13 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'pending_purchases_params_wrapper.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PendingPurchasesParamsWrapper _$PendingPurchasesParamsWrapperFromJson( + Map json) => + PendingPurchasesParamsWrapper( + enablePrepaidPlans: json['enablePrepaidPlans'] as bool? ?? false, + ); diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart index aa2f473d2638..cc94285eb98f 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart @@ -31,32 +31,6 @@ class InAppPurchaseAndroidPlatformAddition late final Stream userChoiceDetailsStream = _userChoiceDetailsStreamController.stream; - /// Whether pending purchase is enabled. - /// - /// **Deprecation warning:** it is no longer required to call - /// [enablePendingPurchases] when initializing your application. From now on - /// this is handled internally and the [enablePendingPurchase] property will - /// always return `true`. - /// - /// See also [enablePendingPurchases] for more on pending purchases. - @Deprecated( - 'The requirement to call `enablePendingPurchases()` has become obsolete ' - "since Google Play no longer accepts app submissions that don't support " - 'pending purchases.') - static bool get enablePendingPurchase => true; - - /// Enable the [InAppPurchaseConnection] to handle pending purchases. - /// - /// **Deprecation warning:** it is no longer required to call - /// [enablePendingPurchases] when initializing your application. - @Deprecated( - 'The requirement to call `enablePendingPurchases()` has become obsolete ' - "since Google Play no longer accepts app submissions that don't support " - 'pending purchases.') - static void enablePendingPurchases() { - // No-op, until it is time to completely remove this method from the API. - } - final BillingClientManager _billingClientManager; /// Mark that the user has consumed a product. 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 123ad0a37ce7..39d1ba2ff990 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 @@ -18,7 +18,8 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -40,8 +41,10 @@ enum PlatformBillingChoiceMode { /// /// Default state. playBillingOnly, + /// Billing through app provided flow. alternativeBillingOnly, + /// Users can choose Play billing or alternative billing. userChoiceBilling, } @@ -219,8 +222,10 @@ class PlatformProductDetails { productId: result[2]! as String, productType: result[3]! as PlatformProductType, title: result[4]! as String, - oneTimePurchaseOfferDetails: result[5] as PlatformOneTimePurchaseOfferDetails?, - subscriptionOfferDetails: (result[6] as List?)?.cast(), + oneTimePurchaseOfferDetails: + result[5] as PlatformOneTimePurchaseOfferDetails?, + subscriptionOfferDetails: (result[6] as List?) + ?.cast(), ); } } @@ -248,7 +253,8 @@ class PlatformProductDetailsResponse { result as List; return PlatformProductDetailsResponse( billingResult: result[0]! as PlatformBillingResult, - productDetails: (result[1] as List?)!.cast(), + productDetails: + (result[1] as List?)!.cast(), ); } } @@ -273,7 +279,8 @@ class PlatformAlternativeBillingOnlyReportingDetailsResponse { ]; } - static PlatformAlternativeBillingOnlyReportingDetailsResponse decode(Object result) { + static PlatformAlternativeBillingOnlyReportingDetailsResponse decode( + Object result) { result as List; return PlatformAlternativeBillingOnlyReportingDetailsResponse( billingResult: result[0]! as PlatformBillingResult, @@ -604,7 +611,8 @@ class PlatformPurchaseHistoryResponse { result as List; return PlatformPurchaseHistoryResponse( billingResult: result[0]! as PlatformBillingResult, - purchases: (result[1] as List?)!.cast(), + purchases: + (result[1] as List?)!.cast(), ); } } @@ -678,7 +686,8 @@ class PlatformSubscriptionOfferDetails { offerId: result[1] as String?, offerToken: result[2]! as String, offerTags: (result[3] as List?)!.cast(), - pricingPhases: (result[4] as List?)!.cast(), + pricingPhases: + (result[4] as List?)!.cast(), installmentPlanDetails: result[5] as PlatformInstallmentPlanDetails?, ); } @@ -711,7 +720,8 @@ class PlatformUserChoiceDetails { return PlatformUserChoiceDetails( originalExternalTransactionId: result[0] as String?, externalTransactionToken: result[1]! as String, - products: (result[2] as List?)!.cast(), + products: + (result[2] as List?)!.cast(), ); } } @@ -749,6 +759,7 @@ class PlatformUserChoiceProduct { } /// Pigeon version of ProductDetails.InstallmentPlanDetails. +/// https://developer.android.com/reference/com/android/billingclient/api/PendingPurchasesParams.Builder#enableOneTimeProducts() class PlatformInstallmentPlanDetails { PlatformInstallmentPlanDetails({ required this.commitmentPaymentsCount, @@ -775,6 +786,27 @@ class PlatformInstallmentPlanDetails { } } +/// Pigeon version of Java PendingPurchasesParams. +class PendingPurchasesParams { + PendingPurchasesParams({ + required this.enablePrepaidPlans, + }); + + bool enablePrepaidPlans; + + Object encode() { + return [ + enablePrepaidPlans, + ]; + } + + static PendingPurchasesParams decode(Object result) { + result as List; + return PendingPurchasesParams( + enablePrepaidPlans: result[0]! as bool, + ); + } +} class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @@ -783,75 +815,79 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is PlatformProductType) { + } else if (value is PlatformProductType) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is PlatformBillingChoiceMode) { + } else if (value is PlatformBillingChoiceMode) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is PlatformPurchaseState) { + } else if (value is PlatformPurchaseState) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is PlatformRecurrenceMode) { + } else if (value is PlatformRecurrenceMode) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is PlatformQueryProduct) { + } else if (value is PlatformQueryProduct) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is PlatformAccountIdentifiers) { + } else if (value is PlatformAccountIdentifiers) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is PlatformBillingResult) { + } else if (value is PlatformBillingResult) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else if (value is PlatformOneTimePurchaseOfferDetails) { + } else if (value is PlatformOneTimePurchaseOfferDetails) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is PlatformProductDetails) { + } else if (value is PlatformProductDetails) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else if (value is PlatformProductDetailsResponse) { + } else if (value is PlatformProductDetailsResponse) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is PlatformAlternativeBillingOnlyReportingDetailsResponse) { + } else if (value + is PlatformAlternativeBillingOnlyReportingDetailsResponse) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is PlatformBillingConfigResponse) { + } else if (value is PlatformBillingConfigResponse) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is PlatformBillingFlowParams) { + } else if (value is PlatformBillingFlowParams) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else if (value is PlatformPricingPhase) { + } else if (value is PlatformPricingPhase) { buffer.putUint8(142); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchase) { + } else if (value is PlatformPurchase) { buffer.putUint8(143); writeValue(buffer, value.encode()); - } else if (value is PlatformPendingPurchaseUpdate) { + } else if (value is PlatformPendingPurchaseUpdate) { buffer.putUint8(144); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchaseHistoryRecord) { + } else if (value is PlatformPurchaseHistoryRecord) { buffer.putUint8(145); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchaseHistoryResponse) { + } else if (value is PlatformPurchaseHistoryResponse) { buffer.putUint8(146); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchasesResponse) { + } else if (value is PlatformPurchasesResponse) { buffer.putUint8(147); writeValue(buffer, value.encode()); - } else if (value is PlatformSubscriptionOfferDetails) { + } else if (value is PlatformSubscriptionOfferDetails) { buffer.putUint8(148); writeValue(buffer, value.encode()); - } else if (value is PlatformUserChoiceDetails) { + } else if (value is PlatformUserChoiceDetails) { buffer.putUint8(149); writeValue(buffer, value.encode()); - } else if (value is PlatformUserChoiceProduct) { + } else if (value is PlatformUserChoiceProduct) { buffer.putUint8(150); writeValue(buffer, value.encode()); - } else if (value is PlatformInstallmentPlanDetails) { + } else if (value is PlatformInstallmentPlanDetails) { buffer.putUint8(151); writeValue(buffer, value.encode()); + } else if (value is PendingPurchasesParams) { + buffer.putUint8(152); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -860,56 +896,59 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformProductType.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformBillingChoiceMode.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformPurchaseState.values[value]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformRecurrenceMode.values[value]; - case 133: + case 133: return PlatformQueryProduct.decode(readValue(buffer)!); - case 134: + case 134: return PlatformAccountIdentifiers.decode(readValue(buffer)!); - case 135: + case 135: return PlatformBillingResult.decode(readValue(buffer)!); - case 136: + case 136: return PlatformOneTimePurchaseOfferDetails.decode(readValue(buffer)!); - case 137: + case 137: return PlatformProductDetails.decode(readValue(buffer)!); - case 138: + case 138: return PlatformProductDetailsResponse.decode(readValue(buffer)!); - case 139: - return PlatformAlternativeBillingOnlyReportingDetailsResponse.decode(readValue(buffer)!); - case 140: + case 139: + return PlatformAlternativeBillingOnlyReportingDetailsResponse.decode( + readValue(buffer)!); + case 140: return PlatformBillingConfigResponse.decode(readValue(buffer)!); - case 141: + case 141: return PlatformBillingFlowParams.decode(readValue(buffer)!); - case 142: + case 142: return PlatformPricingPhase.decode(readValue(buffer)!); - case 143: + case 143: return PlatformPurchase.decode(readValue(buffer)!); - case 144: + case 144: return PlatformPendingPurchaseUpdate.decode(readValue(buffer)!); - case 145: + case 145: return PlatformPurchaseHistoryRecord.decode(readValue(buffer)!); - case 146: + case 146: return PlatformPurchaseHistoryResponse.decode(readValue(buffer)!); - case 147: + case 147: return PlatformPurchasesResponse.decode(readValue(buffer)!); - case 148: + case 148: return PlatformSubscriptionOfferDetails.decode(readValue(buffer)!); - case 149: + case 149: return PlatformUserChoiceDetails.decode(readValue(buffer)!); - case 150: + case 150: return PlatformUserChoiceProduct.decode(readValue(buffer)!); - case 151: + case 151: return PlatformInstallmentPlanDetails.decode(readValue(buffer)!); + case 152: + return PendingPurchasesParams.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -920,9 +959,11 @@ 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 = ''}) + InAppPurchaseApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -931,8 +972,10 @@ class InAppPurchaseApi { /// Wraps BillingClient#isReady. Future isReady() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -958,15 +1001,21 @@ class InAppPurchaseApi { } /// Wraps BillingClient#startConnection(BillingClientStateListener). - Future startConnection(int callbackHandle, PlatformBillingChoiceMode billingMode) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + Future startConnection( + int callbackHandle, + PlatformBillingChoiceMode billingMode, + PendingPurchasesParams pendingPurchasesParams) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([callbackHandle, billingMode]) as List?; + final List? pigeonVar_replyList = await pigeonVar_channel.send( + [callbackHandle, billingMode, pendingPurchasesParams]) + as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -987,8 +1036,10 @@ class InAppPurchaseApi { /// Wraps BillingClient#endConnection(BillingClientStateListener). Future endConnection() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1010,8 +1061,10 @@ class InAppPurchaseApi { /// Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, BillingConfigResponseListener). Future getBillingConfigAsync() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1037,9 +1090,12 @@ class InAppPurchaseApi { } /// Wraps BillingClient#launchBillingFlow(Activity, BillingFlowParams). - Future launchBillingFlow(PlatformBillingFlowParams params) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + Future launchBillingFlow( + PlatformBillingFlowParams params) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1065,15 +1121,18 @@ class InAppPurchaseApi { } /// Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, AcknowledgePurchaseResponseListener). - Future acknowledgePurchase(String purchaseToken) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + Future acknowledgePurchase( + String purchaseToken) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([purchaseToken]) as List?; + final List? pigeonVar_replyList = await pigeonVar_channel + .send([purchaseToken]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -1094,14 +1153,16 @@ class InAppPurchaseApi { /// Wraps BillingClient#consumeAsync(ConsumeParams, ConsumeResponseListener). Future consumeAsync(String purchaseToken) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([purchaseToken]) as List?; + final List? pigeonVar_replyList = await pigeonVar_channel + .send([purchaseToken]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -1121,9 +1182,12 @@ class InAppPurchaseApi { } /// Wraps BillingClient#queryPurchasesAsync(QueryPurchaseParams, PurchaseResponseListener). - Future queryPurchasesAsync(PlatformProductType productType) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + Future queryPurchasesAsync( + PlatformProductType productType) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1149,9 +1213,12 @@ 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( + 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, @@ -1177,9 +1244,12 @@ class InAppPurchaseApi { } /// Wraps BillingClient#queryProductDetailsAsync(QueryProductDetailsParams, ProductDetailsResponseListener). - Future queryProductDetailsAsync(List products) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + Future queryProductDetailsAsync( + List products) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1206,8 +1276,10 @@ class InAppPurchaseApi { /// Wraps BillingClient#isFeatureSupported(String). Future isFeatureSupported(String feature) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1234,8 +1306,10 @@ class InAppPurchaseApi { /// Wraps BillingClient#isAlternativeBillingOnlyAvailableAsync(). Future isAlternativeBillingOnlyAvailableAsync() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1261,9 +1335,12 @@ class InAppPurchaseApi { } /// Wraps BillingClient#showAlternativeBillingOnlyInformationDialog(). - Future showAlternativeBillingOnlyInformationDialog() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + Future + showAlternativeBillingOnlyInformationDialog() async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1289,9 +1366,12 @@ class InAppPurchaseApi { } /// Wraps BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). - Future createAlternativeBillingOnlyReportingDetailsAsync() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + Future + createAlternativeBillingOnlyReportingDetailsAsync() async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1312,7 +1392,8 @@ class InAppPurchaseApi { message: 'Host platform returned null value for non-null return value.', ); } else { - return (pigeonVar_replyList[0] as PlatformAlternativeBillingOnlyReportingDetailsResponse?)!; + return (pigeonVar_replyList[0] + as PlatformAlternativeBillingOnlyReportingDetailsResponse?)!; } } } @@ -1329,18 +1410,26 @@ 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 BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected was null.'); + 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected was null.'); final List args = (message as List?)!; final int? arg_callbackHandle = (args[0] as int?); assert(arg_callbackHandle != null, @@ -1350,24 +1439,29 @@ 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 BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + '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 { assert(message != null, - 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated was null.'); + 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated was null.'); final List args = (message as List?)!; - final PlatformPurchasesResponse? arg_update = (args[0] as PlatformPurchasesResponse?); + final PlatformPurchasesResponse? arg_update = + (args[0] as PlatformPurchasesResponse?); assert(arg_update != null, 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated was null, expected non-null PlatformPurchasesResponse.'); try { @@ -1375,24 +1469,29 @@ 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 BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + '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 { assert(message != null, - 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling was null.'); + 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling was null.'); final List args = (message as List?)!; - final PlatformUserChoiceDetails? arg_details = (args[0] as PlatformUserChoiceDetails?); + final PlatformUserChoiceDetails? arg_details = + (args[0] as PlatformUserChoiceDetails?); assert(arg_details != null, 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling was null, expected non-null PlatformUserChoiceDetails.'); try { @@ -1400,8 +1499,9 @@ 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())); } }); } 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 97a441789091..efe8c7b1080e 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 @@ -4,6 +4,7 @@ import '../billing_client_wrappers.dart'; import 'billing_client_wrappers/billing_config_wrapper.dart'; +import 'billing_client_wrappers/pending_purchases_params_wrapper.dart'; import 'messages.g.dart'; /// Converts a [BillingChoiceMode] to the Pigeon equivalent. @@ -268,3 +269,11 @@ InstallmentPlanDetailsWrapper? installmentPlanDetailsFromPlatform( details.subsequentCommitmentPaymentsCount, ); } + +/// Converts a [PendingPurchasesParamsWrapper] to its Pigeon equivalent. +PendingPurchasesParams pendingPurchasesParamsFromWrapper( + PendingPurchasesParamsWrapper params) { + return PendingPurchasesParams( + enablePrepaidPlans: params.enablePrepaidPlans, + ); +} 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 883db968eb93..ec0e82936e65 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 @@ -296,6 +296,7 @@ class PlatformUserChoiceProduct { } /// Pigeon version of ProductDetails.InstallmentPlanDetails. +/// https://developer.android.com/reference/com/android/billingclient/api/PendingPurchasesParams.Builder#enableOneTimeProducts() class PlatformInstallmentPlanDetails { PlatformInstallmentPlanDetails({ required this.commitmentPaymentsCount, @@ -306,6 +307,15 @@ class PlatformInstallmentPlanDetails { final int subsequentCommitmentPaymentsCount; } +/// Pigeon version of PendingPurchaseParamsWrapper. +class PendingPurchasesParams { + PendingPurchasesParams({ + required this.enablePrepaidPlans, + }); + + final bool enablePrepaidPlans; +} + /// Pigeon version of Java BillingClient.ProductType. enum PlatformProductType { inapp, @@ -348,7 +358,9 @@ abstract class InAppPurchaseApi { /// Wraps BillingClient#startConnection(BillingClientStateListener). @async PlatformBillingResult startConnection( - int callbackHandle, PlatformBillingChoiceMode billingMode); + int callbackHandle, + PlatformBillingChoiceMode billingMode, + PendingPurchasesParams pendingPurchasesParams); /// Wraps BillingClient#endConnection(BillingClientStateListener). void endConnection(); diff --git a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_manager_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_manager_test.dart index 1c72d02f99e5..aec6bf1e4580 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_manager_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_manager_test.dart @@ -7,6 +7,7 @@ import 'dart:async'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:in_app_purchase_android/billing_client_wrappers.dart'; +import 'package:in_app_purchase_android/src/billing_client_wrappers/pending_purchases_params_wrapper.dart'; import 'package:in_app_purchase_android/src/messages.g.dart'; import 'package:mockito/mockito.dart'; @@ -21,7 +22,7 @@ void main() { setUp(() { WidgetsFlutterBinding.ensureInitialized(); mockApi = MockInAppPurchaseApi(); - when(mockApi.startConnection(any, any)).thenAnswer( + when(mockApi.startConnection(any, any, any)).thenAnswer( (_) async => PlatformBillingResult(responseCode: 0, debugMessage: '')); manager = BillingClientManager( billingClientFactory: (PurchasesUpdatedListener listener, @@ -32,12 +33,12 @@ void main() { group('BillingClientWrapper', () { test('connects on initialization', () { - verify(mockApi.startConnection(any, any)).called(1); + verify(mockApi.startConnection(any, any, any)).called(1); }); test('waits for connection before executing the operations', () async { final Completer connectedCompleter = Completer(); - when(mockApi.startConnection(any, any)).thenAnswer((_) async { + when(mockApi.startConnection(any, any, any)).thenAnswer((_) async { connectedCompleter.complete(); return PlatformBillingResult(responseCode: 0, debugMessage: ''); }); @@ -64,7 +65,7 @@ void main() { await manager.runWithClientNonRetryable((_) async {}); manager.client.hostCallbackHandler.onBillingServiceDisconnected(0); - verify(mockApi.startConnection(any, any)).called(2); + verify(mockApi.startConnection(any, any, any)).called(2); }); test('re-connects when host calls reconnectWithBillingChoiceMode', @@ -83,11 +84,36 @@ void main() { manager.client.hostCallbackHandler.onBillingServiceDisconnected(0); // Verify that after connection ended reconnect was called. final VerificationResult result = - verify(mockApi.startConnection(any, captureAny)); + verify(mockApi.startConnection(any, captureAny, any)); expect(result.captured.single, PlatformBillingChoiceMode.alternativeBillingOnly); }); + test('re-connects when host calls reconnectWithPendingPurchasesParams', + () async { + // Ensures all asynchronous connected code finishes. + await manager.runWithClientNonRetryable((_) async {}); + + await manager.reconnectWithPendingPurchasesParams( + const PendingPurchasesParamsWrapper(enablePrepaidPlans: true)); + // Verify that connection was ended. + verify(mockApi.endConnection()).called(1); + + clearInteractions(mockApi); + + /// Fake the disconnect that we would expect from a endConnectionCall. + manager.client.hostCallbackHandler.onBillingServiceDisconnected(0); + // Verify that after connection ended reconnect was called. + final VerificationResult result = + verify(mockApi.startConnection(any, any, captureAny)); + expect( + result.captured.single, + isA().having( + (PendingPurchasesParams params) => params.enablePrepaidPlans, + 'enablePrepaidPlans', + true)); + }); + test( 're-connects when operation returns BillingResponse.serviceDisconnected', () async { @@ -104,7 +130,7 @@ void main() { ); }, ); - verify(mockApi.startConnection(any, any)).called(1); + verify(mockApi.startConnection(any, any, any)).called(1); expect(timesCalled, equals(2)); expect(result.responseCode, equals(BillingResponse.ok)); }, @@ -113,7 +139,7 @@ void main() { test('does not re-connect when disposed', () { clearInteractions(mockApi); manager.dispose(); - verifyNever(mockApi.startConnection(any, any)); + verifyNever(mockApi.startConnection(any, any, any)); verify(mockApi.endConnection()).called(1); }); 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 18208350d86d..593e6e703ea5 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 @@ -39,7 +39,7 @@ void main() { setUp(() { mockApi = MockInAppPurchaseApi(); - when(mockApi.startConnection(any, any)).thenAnswer( + when(mockApi.startConnection(any, any, any)).thenAnswer( (_) async => PlatformBillingResult(responseCode: 0, debugMessage: '')); billingClient = BillingClient( (PurchasesResultWrapper _) {}, (UserChoiceDetailsWrapper _) {}, @@ -81,7 +81,7 @@ void main() { test('returns BillingResultWrapper', () async { const String debugMessage = 'dummy message'; const BillingResponse responseCode = BillingResponse.developerError; - when(mockApi.startConnection(any, any)).thenAnswer( + when(mockApi.startConnection(any, any, any)).thenAnswer( (_) async => PlatformBillingResult( responseCode: const BillingResponseConverter().toJson(responseCode), debugMessage: debugMessage, @@ -100,9 +100,11 @@ void main() { await billingClient.startConnection(onBillingServiceDisconnected: () {}); final VerificationResult result = - verify(mockApi.startConnection(captureAny, captureAny)); + verify(mockApi.startConnection(captureAny, captureAny, captureAny)); expect(result.captured[0], 0); expect(result.captured[1], PlatformBillingChoiceMode.playBillingOnly); + expect( + result.captured[2], PendingPurchasesParams(enablePrepaidPlans: true)); }); test('passes billingChoiceMode alternativeBillingOnly when set', () async { @@ -110,7 +112,8 @@ void main() { onBillingServiceDisconnected: () {}, billingChoiceMode: BillingChoiceMode.alternativeBillingOnly); - expect(verify(mockApi.startConnection(any, captureAny)).captured.first, + expect( + verify(mockApi.startConnection(any, captureAny, any)).captured.first, PlatformBillingChoiceMode.alternativeBillingOnly); }); @@ -125,7 +128,8 @@ void main() { onBillingServiceDisconnected: () {}, billingChoiceMode: BillingChoiceMode.alternativeBillingOnly); - expect(verify(mockApi.startConnection(any, captureAny)).captured.first, + expect( + verify(mockApi.startConnection(any, captureAny, any)).captured.first, PlatformBillingChoiceMode.alternativeBillingOnly); const UserChoiceDetailsWrapper expected = UserChoiceDetailsWrapper( diff --git a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.mocks.dart b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.mocks.dart index 5a93a96f9754..810f389c80f5 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.mocks.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/billing_client_wrappers/billing_client_wrapper_test.mocks.dart @@ -120,6 +120,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { _i4.Future<_i2.PlatformBillingResult> startConnection( int? callbackHandle, _i2.PlatformBillingChoiceMode? billingMode, + _i2.PendingPurchasesParams? pendingPurchasesParams, ) => (super.noSuchMethod( Invocation.method( @@ -127,6 +128,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [ callbackHandle, billingMode, + pendingPurchasesParams, ], ), returnValue: _i4.Future<_i2.PlatformBillingResult>.value( @@ -137,6 +139,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [ callbackHandle, billingMode, + pendingPurchasesParams, ], ), )), @@ -148,6 +151,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [ callbackHandle, billingMode, + pendingPurchasesParams, ], ), )), diff --git a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_addition_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_addition_test.dart index a9c76ab5afef..17e7d28d6f04 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_addition_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_addition_test.dart @@ -27,7 +27,7 @@ void main() { setUp(() { widgets.WidgetsFlutterBinding.ensureInitialized(); mockApi = MockInAppPurchaseApi(); - when(mockApi.startConnection(any, any)).thenAnswer( + when(mockApi.startConnection(any, any, any)).thenAnswer( (_) async => PlatformBillingResult(responseCode: 0, debugMessage: '')); manager = BillingClientManager( billingClientFactory: (PurchasesUpdatedListener listener, @@ -80,7 +80,7 @@ void main() { manager.client.hostCallbackHandler.onBillingServiceDisconnected(0); // Verify that after connection ended reconnect was called. final VerificationResult result = - verify(mockApi.startConnection(any, captureAny)); + verify(mockApi.startConnection(any, captureAny, any)); expect(result.callCount, equals(2)); expect(result.captured.last, PlatformBillingChoiceMode.alternativeBillingOnly); @@ -95,7 +95,7 @@ void main() { manager.client.hostCallbackHandler.onBillingServiceDisconnected(0); // Verify that after connection ended reconnect was called. final VerificationResult result = - verify(mockApi.startConnection(any, captureAny)); + verify(mockApi.startConnection(any, captureAny, any)); expect(result.callCount, equals(2)); expect(result.captured.last, PlatformBillingChoiceMode.playBillingOnly); }); 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 34b974cdae45..6d0c19344140 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 @@ -30,7 +30,7 @@ void main() { widgets.WidgetsFlutterBinding.ensureInitialized(); mockApi = MockInAppPurchaseApi(); - when(mockApi.startConnection(any, any)).thenAnswer( + when(mockApi.startConnection(any, any, any)).thenAnswer( (_) async => PlatformBillingResult(responseCode: 0, debugMessage: '')); iapAndroidPlatform = InAppPurchaseAndroidPlatform( manager: BillingClientManager( @@ -45,13 +45,13 @@ void main() { group('connection management', () { test('connects on initialization', () { //await iapAndroidPlatform.isAvailable(); - verify(mockApi.startConnection(any, any)).called(1); + verify(mockApi.startConnection(any, any, any)).called(1); }); test('re-connects when client sends onBillingServiceDisconnected', () { iapAndroidPlatform.billingClientManager.client.hostCallbackHandler .onBillingServiceDisconnected(0); - verify(mockApi.startConnection(any, any)).called(2); + verify(mockApi.startConnection(any, any, any)).called(2); }); test( @@ -63,7 +63,7 @@ void main() { .toJson(BillingResponse.serviceDisconnected), debugMessage: 'disconnected'), ); - when(mockApi.startConnection(any, any)).thenAnswer((_) async { + when(mockApi.startConnection(any, any, any)).thenAnswer((_) async { // Change the acknowledgePurchase response to success for the next call. when(mockApi.acknowledgePurchase(any)).thenAnswer( (_) async => PlatformBillingResult( @@ -79,7 +79,7 @@ void main() { final BillingResultWrapper result = await iapAndroidPlatform.completePurchase(purchase); verify(mockApi.acknowledgePurchase(any)).called(2); - verify(mockApi.startConnection(any, any)).called(2); + verify(mockApi.startConnection(any, any, any)).called(2); expect(result.responseCode, equals(BillingResponse.ok)); }); }); From 6a063bdc719aac8c6c901bbed2026e9706dc3780 Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Tue, 3 Dec 2024 00:46:13 +0100 Subject: [PATCH 10/16] Fix CHANGELOG formatting Signed-off-by: Marcin Chudy --- .../in_app_purchase_android/CHANGELOG.md | 240 +++++++++--------- 1 file changed, 120 insertions(+), 120 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 726c851f2e87..ca949e024df3 100644 --- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md @@ -1,394 +1,394 @@ ## 0.4.0 -- Updates Google Play Billing Library to 7.1.1. -- **BREAKING CHANGE**: Removes the depracated `ProrationMode` enum. `ReplacementMode` should be used instead. -- **BREAKING CHANGE**: Removes the depracated `BillingClientWrapper.enablePendingPurchases`. -- Adds `installmentPlanDetails` to `SubscriptionOfferDetailsWrapper` -- Adds APIs to support pending transactions for subscription prepaid plans (`PendingPurchaseParams`). +* Updates Google Play Billing Library to 7.1.1. +* **BREAKING CHANGE**: Removes the depracated `ProrationMode` enum. `ReplacementMode` should be used instead. +* **BREAKING CHANGE**: Removes the depracated `BillingClientWrapper.enablePendingPurchases`. +* Adds `installmentPlanDetails` to `SubscriptionOfferDetailsWrapper` +* Adds APIs to support pending transactions for subscription prepaid plans (`PendingPurchaseParams`). ## 0.3.6+12 -- Updates README to remove contributor-focused documentation. +* Updates README to remove contributor-focused documentation. ## 0.3.6+11 -- Bumps androidx.annotation:annotation from 1.8.2 to 1.9.0. +* Bumps androidx.annotation:annotation from 1.8.2 to 1.9.0. ## 0.3.6+10 -- Updates Pigeon for non-nullable collection type support. +* Updates Pigeon for non-nullable collection type support. -## 0.3.6+9A +## 0.3.6+9 -- Updates Java compatibility version to 11. +* Updates Java compatibility version to 11. ## 0.3.6+8 -- Removes dependency on org.jetbrains.kotlin:kotlin-bom. -- Updates minimum supported SDK version to Flutter 3.24/Dart 3.5. +* Removes dependency on org.jetbrains.kotlin:kotlin-bom. +* Updates minimum supported SDK version to Flutter 3.24/Dart 3.5. ## 0.3.6+7 -- Sets `android.buildFeatures.buildConfig` to true for compatibility with AGP 8.0+. +* Sets `android.buildFeatures.buildConfig` to true for compatibility with AGP 8.0+. ## 0.3.6+6 -- Bumps androidx.annotation:annotation from 1.8.1 to 1.8.2. +* Bumps androidx.annotation:annotation from 1.8.1 to 1.8.2. ## 0.3.6+5 -- Bumps com.android.billingclient:billing from 6.1.0 to 6.2.0. +* Bumps com.android.billingclient:billing from 6.1.0 to 6.2.0. ## 0.3.6+4 -- Bumps androidx.annotation:annotation from 1.8.0 to 1.8.1. +* Bumps androidx.annotation:annotation from 1.8.0 to 1.8.1. ## 0.3.6+3 -- Updates lint checks to ignore NewerVersionAvailable. +* Updates lint checks to ignore NewerVersionAvailable. ## 0.3.6+2 -- Updates Android Gradle Plugin to 8.5.1. +* Updates Android Gradle Plugin to 8.5.1. ## 0.3.6+1 -- Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. -- Removes support for apps using the v1 Android embedding. +* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. +* Removes support for apps using the v1 Android embedding. ## 0.3.6 -- Introduces new `ReplacementMode` for Android's billing client as `ProrationMode` is being deprecated. +* Introduces new `ReplacementMode` for Android's billing client as `ProrationMode` is being deprecated. ## 0.3.5+2 -- Bumps androidx.annotation:annotation from 1.7.1 to 1.8.0. -- Updates minimum supported SDK version to Flutter 3.16/Dart 3.2. +* Bumps androidx.annotation:annotation from 1.7.1 to 1.8.0. +* Updates minimum supported SDK version to Flutter 3.16/Dart 3.2. ## 0.3.5+1 -- Updates example to use `countryCode` instead of deprecated `getCountryCode`. +* Updates example to use `countryCode` instead of deprecated `getCountryCode`. ## 0.3.5 -- Replaces `getCountryCode` with `countryCode`. +* Replaces `getCountryCode` with `countryCode`. ## 0.3.4+1 -- Adds documentation for UserChoice and Alternative Billing. +* Adds documentation for UserChoice and Alternative Billing. ## 0.3.4 -- Adds `countryCode` API. +* Adds `countryCode` API. ## 0.3.3+1 -- Moves alternative billing listener creation to BillingClientFactoryImpl. +* Moves alternative billing listener creation to BillingClientFactoryImpl. ## 0.3.3 -- Converts data objects in internal platform communication to Pigeon. -- Deprecates JSON serialization and deserialization for Billing Client wrapper +* Converts data objects in internal platform communication to Pigeon. +* Deprecates JSON serialization and deserialization for Billing Client wrapper objects. ## 0.3.2+1 -- Converts internal platform communication to Pigeon. +* Converts internal platform communication to Pigeon. ## 0.3.2 -- Adds UserChoiceBilling APIs to platform addition. -- Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. +* Adds UserChoiceBilling APIs to platform addition. +* Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. ## 0.3.1 -- Adds alternative-billing-only APIs to InAppPurchaseAndroidPlatformAddition. +* Adds alternative-billing-only APIs to InAppPurchaseAndroidPlatformAddition. ## 0.3.0+18 -- Adds new getCountryCode() method to InAppPurchaseAndroidPlatformAddition to get a customer's country code. -- Updates compileSdk version to 34. +* Adds new getCountryCode() method to InAppPurchaseAndroidPlatformAddition to get a customer's country code. +* Updates compileSdk version to 34. ## 0.3.0+17 -- Bumps androidx.annotation:annotation from 1.7.0 to 1.7.1. +* Bumps androidx.annotation:annotation from 1.7.0 to 1.7.1. ## 0.3.0+16 -- Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. -- Fixes new lint warnings. +* Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. +* Fixes new lint warnings. ## 0.3.0+15 -- Adds missing network error response code to BillingResponse enum. +* Adds missing network error response code to BillingResponse enum. ## 0.3.0+14 -- Updates annotations lib to 1.7.0. +* Updates annotations lib to 1.7.0. ## 0.3.0+13 -- Updates example code for current versions of Flutter. +* Updates example code for current versions of Flutter. ## 0.3.0+12 -- Adds pub topics to package metadata. -- Updates minimum supported SDK version to Flutter 3.7/Dart 2.19. +* Adds pub topics to package metadata. +* Updates minimum supported SDK version to Flutter 3.7/Dart 2.19. ## 0.3.0+11 -- Migrates `styleFrom` usage in examples off of deprecated `primary` and `onPrimary` parameters. +* Migrates `styleFrom` usage in examples off of deprecated `primary` and `onPrimary` parameters. ## 0.3.0+10 -- Bumps com.android.billingclient:billing from 6.0.0 to 6.0.1. +* Bumps com.android.billingclient:billing from 6.0.0 to 6.0.1. ## 0.3.0+9 -- Bumps com.android.billingclient:billing from 5.2.0 to 6.0.0. +* Bumps com.android.billingclient:billing from 5.2.0 to 6.0.0. ## 0.3.0+8 -- Adds a [guide for migrating](migration_guide.md) to [0.3.0](#0.3.0). +* Adds a [guide for migrating](migration_guide.md) to [0.3.0](#0.3.0). ## 0.3.0+7 -- Bumps org.mockito:mockito-core from 4.7.0 to 5.3.1. +* Bumps org.mockito:mockito-core from 4.7.0 to 5.3.1. ## 0.3.0+6 -- Bumps org.jetbrains.kotlin:kotlin-bom from 1.8.21 to 1.8.22. +* Bumps org.jetbrains.kotlin:kotlin-bom from 1.8.21 to 1.8.22. ## 0.3.0+5 -- Bumps org.jetbrains.kotlin:kotlin-bom from 1.8.0 to 1.8.21. +* Bumps org.jetbrains.kotlin:kotlin-bom from 1.8.0 to 1.8.21. ## 0.3.0+4 -- Fixes unawaited_futures violations. +* Fixes unawaited_futures violations. ## 0.3.0+3 -- Fixes Java lint issues. +* Fixes Java lint issues. ## 0.3.0+2 -- Removes obsolete null checks on non-nullable values. +* Removes obsolete null checks on non-nullable values. ## 0.3.0+1 -- Fixes misaligned method signature strings. +* Fixes misaligned method signature strings. ## 0.3.0 -- **BREAKING CHANGE**: Removes `launchPriceChangeConfirmationFlow` from `InAppPurchaseAndroidPlatform`. Price changes are now [handled by Google Play](https://developer.android.com/google/play/billing/subscriptions#price-change). -- Returns both base plans and offers when `queryProductDetailsAsync` is called. +* **BREAKING CHANGE**: Removes `launchPriceChangeConfirmationFlow` from `InAppPurchaseAndroidPlatform`. Price changes are now [handled by Google Play](https://developer.android.com/google/play/billing/subscriptions#price-change). +* Returns both base plans and offers when `queryProductDetailsAsync` is called. ## 0.2.5+5 -- Updates gradle, AGP and fixes some lint errors. +* Updates gradle, AGP and fixes some lint errors. ## 0.2.5+4 -- Fixes compatibility with AGP versions older than 4.2. +* Fixes compatibility with AGP versions older than 4.2. ## 0.2.5+3 -- Updates com.android.billingclient:billing from 5.1.0 to 5.2.0. +* Updates com.android.billingclient:billing from 5.1.0 to 5.2.0. ## 0.2.5+2 -- Updates androidx.annotation:annotation from 1.5.0 to 1.6.0. +* Updates androidx.annotation:annotation from 1.5.0 to 1.6.0. ## 0.2.5+1 -- Adds a namespace for compatibility with AGP 8.0. +* Adds a namespace for compatibility with AGP 8.0. ## 0.2.5 -- Fixes the management of `BillingClient` connection by handling `BillingResponse.serviceDisconnected`. -- Introduces `BillingClientManager`. -- Updates minimum Flutter version to 3.3. +* Fixes the management of `BillingClient` connection by handling `BillingResponse.serviceDisconnected`. +* Introduces `BillingClientManager`. +* Updates minimum Flutter version to 3.3. ## 0.2.4+3 -- Clarifies explanation of endorsement in README. -- Aligns Dart and Flutter SDK constraints. -- Updates compileSdkVersion to 33. +* Clarifies explanation of endorsement in README. +* Aligns Dart and Flutter SDK constraints. +* Updates compileSdkVersion to 33. ## 0.2.4+2 -- Updates links for the merge of flutter/plugins into flutter/packages. +* Updates links for the merge of flutter/plugins into flutter/packages. ## 0.2.4+1 -- Updates Google Play Billing Library to 5.1.0. -- Updates androidx.annotation to 1.5.0. +* Updates Google Play Billing Library to 5.1.0. +* Updates androidx.annotation to 1.5.0. ## 0.2.4 -- Updates minimum Flutter version to 3.0. -- Ignores a lint in the example app for backwards compatibility. +* Updates minimum Flutter version to 3.0. +* Ignores a lint in the example app for backwards compatibility. ## 0.2.3+9 -- Updates `androidx.test.espresso:espresso-core` to 3.5.1. +* Updates `androidx.test.espresso:espresso-core` to 3.5.1. ## 0.2.3+8 -- Updates code for stricter lint checks. +* Updates code for stricter lint checks. ## 0.2.3+7 -- Updates code for new analysis options. +* Updates code for new analysis options. ## 0.2.3+6 -- Updates android gradle plugin to 7.3.1. +* Updates android gradle plugin to 7.3.1. ## 0.2.3+5 -- Updates imports for `prefer_relative_imports`. +* Updates imports for `prefer_relative_imports`. ## 0.2.3+4 -- Updates minimum Flutter version to 2.10. -- Adds IMMEDIATE_AND_CHARGE_FULL_PRICE to the `ProrationMode`. +* Updates minimum Flutter version to 2.10. +* Adds IMMEDIATE_AND_CHARGE_FULL_PRICE to the `ProrationMode`. ## 0.2.3+3 -- Fixes avoid_redundant_argument_values lint warnings and minor typos. +* Fixes avoid_redundant_argument_values lint warnings and minor typos. ## 0.2.3+2 -- Fixes incorrect json key in `queryPurchasesAsync` that fixes restore purchases functionality. +* Fixes incorrect json key in `queryPurchasesAsync` that fixes restore purchases functionality. ## 0.2.3+1 -- Updates `json_serializable` to fix warnings in generated code. +* Updates `json_serializable` to fix warnings in generated code. ## 0.2.3 -- Upgrades Google Play Billing Library to 5.0 -- Migrates APIs to support breaking changes in new Google Play Billing API -- `PurchaseWrapper` and `PurchaseHistoryRecordWrapper` now handles `skus` a list of sku strings. `sku` is deprecated. +* Upgrades Google Play Billing Library to 5.0 +* Migrates APIs to support breaking changes in new Google Play Billing API +* `PurchaseWrapper` and `PurchaseHistoryRecordWrapper` now handles `skus` a list of sku strings. `sku` is deprecated. ## 0.2.2+8 -- Ignores deprecation warnings for upcoming styleFrom button API changes. +* Ignores deprecation warnings for upcoming styleFrom button API changes. ## 0.2.2+7 -- Updates references to the obsolete master branch. +* Updates references to the obsolete master branch. ## 0.2.2+6 -- Enables mocking models by changing overridden operator == parameter type from `dynamic` to `Object`. +* Enables mocking models by changing overridden operator == parameter type from `dynamic` to `Object`. ## 0.2.2+5 -- Minor fixes for new analysis options. +* Minor fixes for new analysis options. ## 0.2.2+4 -- Removes unnecessary imports. -- Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors +* Removes unnecessary imports. +* Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors lint warnings. ## 0.2.2+3 -- Migrates from `ui.hash*` to `Object.hash*`. -- Updates minimum Flutter version to 2.5.0. +* Migrates from `ui.hash*` to `Object.hash*`. +* Updates minimum Flutter version to 2.5.0. ## 0.2.2+2 -- Internal code cleanup for stricter analysis options. +* Internal code cleanup for stricter analysis options. ## 0.2.2+1 -- Removes the dependency on `meta`. +* Removes the dependency on `meta`. ## 0.2.2 -- Fixes the `purchaseStream` incorrectly reporting `PurchaseStatus.error` when user upgrades subscription by deferred proration mode. +* Fixes the `purchaseStream` incorrectly reporting `PurchaseStatus.error` when user upgrades subscription by deferred proration mode. ## 0.2.1 -- Deprecated the `InAppPurchaseAndroidPlatformAddition.enablePendingPurchases()` method and `InAppPurchaseAndroidPlatformAddition.enablePendingPurchase` property. Since Google Play no longer accepts App submissions that don't support pending purchases it is no longer necessary to acknowledge this through code. -- Updates example app Android compileSdkVersion to 31. +* Deprecated the `InAppPurchaseAndroidPlatformAddition.enablePendingPurchases()` method and `InAppPurchaseAndroidPlatformAddition.enablePendingPurchase` property. Since Google Play no longer accepts App submissions that don't support pending purchases it is no longer necessary to acknowledge this through code. +* Updates example app Android compileSdkVersion to 31. ## 0.2.0 -- BREAKING CHANGE : Refactor to handle new `PurchaseStatus` named `canceled`. This means developers +* BREAKING CHANGE : Refactor to handle new `PurchaseStatus` named `canceled`. This means developers can distinguish between an error and user cancellation. ## 0.1.6 -- Require Dart SDK >= 2.14. -- Update `json_annotation` dependency to `^4.3.0`. +* Require Dart SDK >= 2.14. +* Update `json_annotation` dependency to `^4.3.0`. ## 0.1.5+1 -- Fix a broken link in the README. +* Fix a broken link in the README. ## 0.1.5 -- Introduced the `SkuDetailsWrapper.introductoryPriceAmountMicros` field of the correct type (`int`) and deprecated the `SkuDetailsWrapper.introductoryPriceMicros` field. -- Update dev_dependency `build_runner` to ^2.0.0 and `json_serializable` to ^5.0.2. +* Introduced the `SkuDetailsWrapper.introductoryPriceAmountMicros` field of the correct type (`int`) and deprecated the `SkuDetailsWrapper.introductoryPriceMicros` field. +* Update dev_dependency `build_runner` to ^2.0.0 and `json_serializable` to ^5.0.2. ## 0.1.4+7 -- Ensure that the `SkuDetailsWrapper.introductoryPriceMicros` is populated correctly. +* Ensure that the `SkuDetailsWrapper.introductoryPriceMicros` is populated correctly. ## 0.1.4+6 -- Ensure that purchases correctly indicate whether they are acknowledged or not. The `PurchaseDetails.pendingCompletePurchase` field now correctly indicates if the purchase still needs to be completed. +* Ensure that purchases correctly indicate whether they are acknowledged or not. The `PurchaseDetails.pendingCompletePurchase` field now correctly indicates if the purchase still needs to be completed. ## 0.1.4+5 -- Add `implements` to pubspec. -- Updated Android lint settings. +* Add `implements` to pubspec. +* Updated Android lint settings. ## 0.1.4+4 -- Removed dependency on the `test` package. +* Removed dependency on the `test` package. ## 0.1.4+3 -- Updated installation instructions in README. +* Updated installation instructions in README. ## 0.1.4+2 -- Added price currency symbol to SkuDetailsWrapper. +* Added price currency symbol to SkuDetailsWrapper. ## 0.1.4+1 -- Fixed typos. +* Fixed typos. ## 0.1.4 -- Added support for launchPriceChangeConfirmationFlow in the BillingClientWrapper and in InAppPurchaseAndroidPlatformAddition. +* Added support for launchPriceChangeConfirmationFlow in the BillingClientWrapper and in InAppPurchaseAndroidPlatformAddition. ## 0.1.3+1 -- Add payment proxy. +* Add payment proxy. ## 0.1.3 -- Added support for isFeatureSupported in the BillingClientWrapper and in InAppPurchaseAndroidPlatformAddition. +* Added support for isFeatureSupported in the BillingClientWrapper and in InAppPurchaseAndroidPlatformAddition. ## 0.1.2 -- Added support for the obfuscatedAccountId and obfuscatedProfileId in the PurchaseWrapper. +* Added support for the obfuscatedAccountId and obfuscatedProfileId in the PurchaseWrapper. ## 0.1.1 -- Added support to request a list of active subscriptions and non-consumed one-time purchases on Android, through the `InAppPurchaseAndroidPlatformAddition.queryPastPurchases` method. +* Added support to request a list of active subscriptions and non-consumed one-time purchases on Android, through the `InAppPurchaseAndroidPlatformAddition.queryPastPurchases` method. ## 0.1.0+1 -- Migrate maven repository from jcenter to mavenCentral. +* Migrate maven repository from jcenter to mavenCentral. ## 0.1.0 -- Initial open-source release. +* Initial open-source release. From 4941488f956b970ef45c36e9ff333f93f07a9e8a Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Tue, 3 Dec 2024 01:27:58 +0100 Subject: [PATCH 11/16] Add native tests and fix formatting Signed-off-by: Marcin Chudy --- .../inapppurchase/BillingClientFactory.java | 2 - .../BillingClientFactoryImpl.java | 13 +- .../plugins/inapppurchase/Messages.java | 709 ++++++++++++------ .../inapppurchase/MethodCallHandlerImpl.java | 3 +- .../BillingClientFactoryImplTest.java | 11 + .../inapppurchase/MethodCallHandlerTest.java | 97 ++- .../billing_client_wrapper_test.dart | 22 +- 7 files changed, 617 insertions(+), 240 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactory.java b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactory.java index 8d04ef35efa9..56e6f8c39654 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactory.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactory.java @@ -7,8 +7,6 @@ import android.content.Context; import androidx.annotation.NonNull; import com.android.billingclient.api.BillingClient; -import com.android.billingclient.api.PendingPurchasesParams; - import io.flutter.plugins.inapppurchase.Messages.PlatformBillingChoiceMode; /** Responsible for creating a {@link BillingClient} object. */ diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java index 65eb971e06d7..4b567c847f00 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java @@ -24,15 +24,14 @@ public BillingClient createBillingClient( @NonNull Messages.InAppPurchaseCallbackApi callbackApi, PlatformBillingChoiceMode billingChoiceMode, Messages.PendingPurchasesParams pendingPurchasesParams) { - PendingPurchasesParams.Builder pendingPurchasesBuilder = PendingPurchasesParams.newBuilder() - .enableOneTimeProducts(); - if (pendingPurchasesParams != null && pendingPurchasesParams.getEnablePrepaidPlans()) { - pendingPurchasesBuilder.enablePrepaidPlans(); - } + PendingPurchasesParams.Builder pendingPurchasesBuilder = + PendingPurchasesParams.newBuilder().enableOneTimeProducts(); + if (pendingPurchasesParams != null && pendingPurchasesParams.getEnablePrepaidPlans()) { + pendingPurchasesBuilder.enablePrepaidPlans(); + } BillingClient.Builder builder = - BillingClient.newBuilder(context) - .enablePendingPurchases(pendingPurchasesBuilder.build()); + BillingClient.newBuilder(context).enablePendingPurchases(pendingPurchasesBuilder.build()); switch (billingChoiceMode) { case ALTERNATIVE_BILLING_ONLY: // https://developer.android.com/google/play/billing/alternative/alternative-billing-without-user-choice-in-app 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 ab33dd96b1b8..240c8b1dc81b 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 @@ -21,11 +21,8 @@ import java.lang.annotation.Target; import java.nio.ByteBuffer; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Objects; /** Generated class from Pigeon. */ @@ -41,8 +38,7 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) - { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { super(message); this.code = code; this.details = details; @@ -61,14 +57,15 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @NonNull protected static FlutterError createConnectionError(@NonNull String channelName) { - return new FlutterError("channel-error", "Unable to establish connection on channel: " + channelName + ".", ""); + return new FlutterError( + "channel-error", "Unable to establish connection on channel: " + channelName + ".", ""); } @Target(METHOD) @@ -92,7 +89,7 @@ public enum PlatformBillingChoiceMode { /** * Billing through google play. * - * Default state. + *

Default state. */ PLAY_BILLING_ONLY(0), /** Billing through app provided flow. */ @@ -136,7 +133,7 @@ public enum PlatformRecurrenceMode { /** * Pigeon version of Java QueryProductDetailsParams.Product. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformQueryProduct { private @NonNull String productId; @@ -170,8 +167,12 @@ public void setProductType(@NonNull PlatformProductType setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformQueryProduct that = (PlatformQueryProduct) o; return productId.equals(that.productId) && productType.equals(that.productType); } @@ -228,7 +229,7 @@ ArrayList toList() { /** * Pigeon version of Java AccountIdentifiers. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformAccountIdentifiers { private @Nullable String obfuscatedAccountId; @@ -253,10 +254,15 @@ public void setObfuscatedProfileId(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformAccountIdentifiers that = (PlatformAccountIdentifiers) o; - return Objects.equals(obfuscatedAccountId, that.obfuscatedAccountId) && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId); + return Objects.equals(obfuscatedAccountId, that.obfuscatedAccountId) + && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId); } @Override @@ -311,7 +317,7 @@ ArrayList toList() { /** * Pigeon version of Java BillingResult. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingResult { private @NonNull Long responseCode; @@ -345,8 +351,12 @@ public void setDebugMessage(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformBillingResult that = (PlatformBillingResult) o; return responseCode.equals(that.responseCode) && debugMessage.equals(that.debugMessage); } @@ -403,7 +413,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.OneTimePurchaseOfferDetails. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformOneTimePurchaseOfferDetails { private @NonNull Long priceAmountMicros; @@ -450,10 +460,16 @@ public void setPriceCurrencyCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformOneTimePurchaseOfferDetails that = (PlatformOneTimePurchaseOfferDetails) o; - return priceAmountMicros.equals(that.priceAmountMicros) && formattedPrice.equals(that.formattedPrice) && priceCurrencyCode.equals(that.priceCurrencyCode); + return priceAmountMicros.equals(that.priceAmountMicros) + && formattedPrice.equals(that.formattedPrice) + && priceCurrencyCode.equals(that.priceCurrencyCode); } @Override @@ -488,7 +504,8 @@ public static final class Builder { } public @NonNull PlatformOneTimePurchaseOfferDetails build() { - PlatformOneTimePurchaseOfferDetails pigeonReturn = new PlatformOneTimePurchaseOfferDetails(); + PlatformOneTimePurchaseOfferDetails pigeonReturn = + new PlatformOneTimePurchaseOfferDetails(); pigeonReturn.setPriceAmountMicros(priceAmountMicros); pigeonReturn.setFormattedPrice(formattedPrice); pigeonReturn.setPriceCurrencyCode(priceCurrencyCode); @@ -505,7 +522,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformOneTimePurchaseOfferDetails fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformOneTimePurchaseOfferDetails fromList( + @NonNull ArrayList pigeonVar_list) { PlatformOneTimePurchaseOfferDetails pigeonResult = new PlatformOneTimePurchaseOfferDetails(); Object priceAmountMicros = pigeonVar_list.get(0); pigeonResult.setPriceAmountMicros((Long) priceAmountMicros); @@ -520,7 +538,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformProductDetails { private @NonNull String description; @@ -594,7 +612,8 @@ public void setTitle(@NonNull String setterArg) { return oneTimePurchaseOfferDetails; } - public void setOneTimePurchaseOfferDetails(@Nullable PlatformOneTimePurchaseOfferDetails setterArg) { + public void setOneTimePurchaseOfferDetails( + @Nullable PlatformOneTimePurchaseOfferDetails setterArg) { this.oneTimePurchaseOfferDetails = setterArg; } @@ -604,7 +623,8 @@ public void setOneTimePurchaseOfferDetails(@Nullable PlatformOneTimePurchaseOffe return subscriptionOfferDetails; } - public void setSubscriptionOfferDetails(@Nullable List setterArg) { + public void setSubscriptionOfferDetails( + @Nullable List setterArg) { this.subscriptionOfferDetails = setterArg; } @@ -613,15 +633,32 @@ public void setSubscriptionOfferDetails(@Nullable List subscriptionOfferDetails; @CanIgnoreReturnValue - public @NonNull Builder setSubscriptionOfferDetails(@Nullable List setterArg) { + public @NonNull Builder setSubscriptionOfferDetails( + @Nullable List setterArg) { this.subscriptionOfferDetails = setterArg; return this; } @@ -721,18 +760,20 @@ ArrayList toList() { Object title = pigeonVar_list.get(4); pigeonResult.setTitle((String) title); Object oneTimePurchaseOfferDetails = pigeonVar_list.get(5); - pigeonResult.setOneTimePurchaseOfferDetails((PlatformOneTimePurchaseOfferDetails) oneTimePurchaseOfferDetails); + pigeonResult.setOneTimePurchaseOfferDetails( + (PlatformOneTimePurchaseOfferDetails) oneTimePurchaseOfferDetails); Object subscriptionOfferDetails = pigeonVar_list.get(6); - pigeonResult.setSubscriptionOfferDetails((List) subscriptionOfferDetails); + pigeonResult.setSubscriptionOfferDetails( + (List) subscriptionOfferDetails); return pigeonResult; } } /** - * 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. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformProductDetailsResponse { private @NonNull PlatformBillingResult billingResult; @@ -766,8 +807,12 @@ public void setProductDetails(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformProductDetailsResponse that = (PlatformProductDetailsResponse) o; return billingResult.equals(that.billingResult) && productDetails.equals(that.productDetails); } @@ -811,7 +856,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformProductDetailsResponse fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformProductDetailsResponse fromList( + @NonNull ArrayList pigeonVar_list) { PlatformProductDetailsResponse pigeonResult = new PlatformProductDetailsResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -822,11 +868,10 @@ ArrayList toList() { } /** - * 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. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformAlternativeBillingOnlyReportingDetailsResponse { private @NonNull PlatformBillingResult billingResult; @@ -860,10 +905,16 @@ public void setExternalTransactionToken(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } - PlatformAlternativeBillingOnlyReportingDetailsResponse that = (PlatformAlternativeBillingOnlyReportingDetailsResponse) o; - return billingResult.equals(that.billingResult) && externalTransactionToken.equals(that.externalTransactionToken); + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PlatformAlternativeBillingOnlyReportingDetailsResponse that = + (PlatformAlternativeBillingOnlyReportingDetailsResponse) o; + return billingResult.equals(that.billingResult) + && externalTransactionToken.equals(that.externalTransactionToken); } @Override @@ -890,7 +941,8 @@ public static final class Builder { } public @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse build() { - PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonReturn = new PlatformAlternativeBillingOnlyReportingDetailsResponse(); + PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonReturn = + new PlatformAlternativeBillingOnlyReportingDetailsResponse(); pigeonReturn.setBillingResult(billingResult); pigeonReturn.setExternalTransactionToken(externalTransactionToken); return pigeonReturn; @@ -905,8 +957,10 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse fromList(@NonNull ArrayList pigeonVar_list) { - PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonResult = new PlatformAlternativeBillingOnlyReportingDetailsResponse(); + static @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse fromList( + @NonNull ArrayList pigeonVar_list) { + PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonResult = + new PlatformAlternativeBillingOnlyReportingDetailsResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); Object externalTransactionToken = pigeonVar_list.get(1); @@ -916,10 +970,10 @@ ArrayList toList() { } /** - * 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. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingConfigResponse { private @NonNull PlatformBillingResult billingResult; @@ -953,8 +1007,12 @@ public void setCountryCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformBillingConfigResponse that = (PlatformBillingConfigResponse) o; return billingResult.equals(that.billingResult) && countryCode.equals(that.countryCode); } @@ -998,7 +1056,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformBillingConfigResponse fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformBillingConfigResponse fromList( + @NonNull ArrayList pigeonVar_list) { PlatformBillingConfigResponse pigeonResult = new PlatformBillingConfigResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -1011,7 +1070,7 @@ ArrayList toList() { /** * Pigeon version of Java BillingFlowParams. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformBillingFlowParams { private @NonNull String product; @@ -1095,15 +1154,32 @@ public void setPurchaseToken(@Nullable String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformBillingFlowParams that = (PlatformBillingFlowParams) o; - return product.equals(that.product) && replacementMode.equals(that.replacementMode) && Objects.equals(offerToken, that.offerToken) && Objects.equals(accountId, that.accountId) && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId) && Objects.equals(oldProduct, that.oldProduct) && Objects.equals(purchaseToken, that.purchaseToken); + return product.equals(that.product) + && replacementMode.equals(that.replacementMode) + && Objects.equals(offerToken, that.offerToken) + && Objects.equals(accountId, that.accountId) + && Objects.equals(obfuscatedProfileId, that.obfuscatedProfileId) + && Objects.equals(oldProduct, that.oldProduct) + && Objects.equals(purchaseToken, that.purchaseToken); } @Override public int hashCode() { - return Objects.hash(product, replacementMode, offerToken, accountId, obfuscatedProfileId, oldProduct, purchaseToken); + return Objects.hash( + product, + replacementMode, + offerToken, + accountId, + obfuscatedProfileId, + oldProduct, + purchaseToken); } public static final class Builder { @@ -1213,7 +1289,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.PricingPhase. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPricingPhase { private @NonNull Long billingCycleCount; @@ -1299,15 +1375,30 @@ public void setPriceCurrencyCode(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPricingPhase that = (PlatformPricingPhase) o; - return billingCycleCount.equals(that.billingCycleCount) && recurrenceMode.equals(that.recurrenceMode) && priceAmountMicros.equals(that.priceAmountMicros) && billingPeriod.equals(that.billingPeriod) && formattedPrice.equals(that.formattedPrice) && priceCurrencyCode.equals(that.priceCurrencyCode); + return billingCycleCount.equals(that.billingCycleCount) + && recurrenceMode.equals(that.recurrenceMode) + && priceAmountMicros.equals(that.priceAmountMicros) + && billingPeriod.equals(that.billingPeriod) + && formattedPrice.equals(that.formattedPrice) + && priceCurrencyCode.equals(that.priceCurrencyCode); } @Override public int hashCode() { - return Objects.hash(billingCycleCount, recurrenceMode, priceAmountMicros, billingPeriod, formattedPrice, priceCurrencyCode); + return Objects.hash( + billingCycleCount, + recurrenceMode, + priceAmountMicros, + billingPeriod, + formattedPrice, + priceCurrencyCode); } public static final class Builder { @@ -1405,9 +1496,9 @@ ArrayList toList() { /** * Pigeon version of Java Purchase. * - * See also PurchaseWrapper on the Dart side. + *

See also PurchaseWrapper on the Dart side. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchase { private @Nullable String orderId; @@ -1588,15 +1679,46 @@ public void setPendingPurchaseUpdate(@Nullable PlatformPendingPurchaseUpdate set @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPurchase that = (PlatformPurchase) o; - return Objects.equals(orderId, that.orderId) && packageName.equals(that.packageName) && purchaseTime.equals(that.purchaseTime) && purchaseToken.equals(that.purchaseToken) && signature.equals(that.signature) && products.equals(that.products) && isAutoRenewing.equals(that.isAutoRenewing) && originalJson.equals(that.originalJson) && developerPayload.equals(that.developerPayload) && isAcknowledged.equals(that.isAcknowledged) && quantity.equals(that.quantity) && purchaseState.equals(that.purchaseState) && Objects.equals(accountIdentifiers, that.accountIdentifiers) && Objects.equals(pendingPurchaseUpdate, that.pendingPurchaseUpdate); + return Objects.equals(orderId, that.orderId) + && packageName.equals(that.packageName) + && purchaseTime.equals(that.purchaseTime) + && purchaseToken.equals(that.purchaseToken) + && signature.equals(that.signature) + && products.equals(that.products) + && isAutoRenewing.equals(that.isAutoRenewing) + && originalJson.equals(that.originalJson) + && developerPayload.equals(that.developerPayload) + && isAcknowledged.equals(that.isAcknowledged) + && quantity.equals(that.quantity) + && purchaseState.equals(that.purchaseState) + && Objects.equals(accountIdentifiers, that.accountIdentifiers) + && Objects.equals(pendingPurchaseUpdate, that.pendingPurchaseUpdate); } @Override public int hashCode() { - return Objects.hash(orderId, packageName, purchaseTime, purchaseToken, signature, products, isAutoRenewing, originalJson, developerPayload, isAcknowledged, quantity, purchaseState, accountIdentifiers, pendingPurchaseUpdate); + return Objects.hash( + orderId, + packageName, + purchaseTime, + purchaseToken, + signature, + products, + isAutoRenewing, + originalJson, + developerPayload, + isAcknowledged, + quantity, + purchaseState, + accountIdentifiers, + pendingPurchaseUpdate); } public static final class Builder { @@ -1700,7 +1822,8 @@ public static final class Builder { private @Nullable PlatformAccountIdentifiers accountIdentifiers; @CanIgnoreReturnValue - public @NonNull Builder setAccountIdentifiers(@Nullable PlatformAccountIdentifiers setterArg) { + public @NonNull Builder setAccountIdentifiers( + @Nullable PlatformAccountIdentifiers setterArg) { this.accountIdentifiers = setterArg; return this; } @@ -1708,7 +1831,8 @@ public static final class Builder { private @Nullable PlatformPendingPurchaseUpdate pendingPurchaseUpdate; @CanIgnoreReturnValue - public @NonNull Builder setPendingPurchaseUpdate(@Nullable PlatformPendingPurchaseUpdate setterArg) { + public @NonNull Builder setPendingPurchaseUpdate( + @Nullable PlatformPendingPurchaseUpdate setterArg) { this.pendingPurchaseUpdate = setterArg; return this; } @@ -1790,9 +1914,9 @@ ArrayList toList() { /** * Pigeon version of Java Purchase. * - * See also PendingPurchaseUpdateWrapper on the Dart side. + *

See also PendingPurchaseUpdateWrapper on the Dart side. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPendingPurchaseUpdate { private @NonNull List products; @@ -1826,8 +1950,12 @@ public void setPurchaseToken(@NonNull String setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPendingPurchaseUpdate that = (PlatformPendingPurchaseUpdate) o; return products.equals(that.products) && purchaseToken.equals(that.purchaseToken); } @@ -1871,7 +1999,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPendingPurchaseUpdate fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformPendingPurchaseUpdate fromList( + @NonNull ArrayList pigeonVar_list) { PlatformPendingPurchaseUpdate pigeonResult = new PlatformPendingPurchaseUpdate(); Object products = pigeonVar_list.get(0); pigeonResult.setProducts((List) products); @@ -1884,9 +2013,9 @@ ArrayList toList() { /** * Pigeon version of PurchaseHistoryRecord. * - * See also PurchaseHistoryRecordWrapper on the Dart side. + *

See also PurchaseHistoryRecordWrapper on the Dart side. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchaseHistoryRecord { private @NonNull Long quantity; @@ -1982,15 +2111,32 @@ public void setProducts(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPurchaseHistoryRecord that = (PlatformPurchaseHistoryRecord) o; - return quantity.equals(that.quantity) && purchaseTime.equals(that.purchaseTime) && Objects.equals(developerPayload, that.developerPayload) && originalJson.equals(that.originalJson) && purchaseToken.equals(that.purchaseToken) && signature.equals(that.signature) && products.equals(that.products); + return quantity.equals(that.quantity) + && purchaseTime.equals(that.purchaseTime) + && Objects.equals(developerPayload, that.developerPayload) + && originalJson.equals(that.originalJson) + && purchaseToken.equals(that.purchaseToken) + && signature.equals(that.signature) + && products.equals(that.products); } @Override public int hashCode() { - return Objects.hash(quantity, purchaseTime, developerPayload, originalJson, purchaseToken, signature, products); + return Objects.hash( + quantity, + purchaseTime, + developerPayload, + originalJson, + purchaseToken, + signature, + products); } public static final class Builder { @@ -2077,7 +2223,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPurchaseHistoryRecord fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformPurchaseHistoryRecord fromList( + @NonNull ArrayList pigeonVar_list) { PlatformPurchaseHistoryRecord pigeonResult = new PlatformPurchaseHistoryRecord(); Object quantity = pigeonVar_list.get(0); pigeonResult.setQuantity((Long) quantity); @@ -2098,10 +2245,10 @@ ArrayList toList() { } /** - * 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. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchaseHistoryResponse { private @NonNull PlatformBillingResult billingResult; @@ -2135,8 +2282,12 @@ public void setPurchases(@NonNull List setterArg) @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPurchaseHistoryResponse that = (PlatformPurchaseHistoryResponse) o; return billingResult.equals(that.billingResult) && purchases.equals(that.purchases); } @@ -2180,7 +2331,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPurchaseHistoryResponse fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformPurchaseHistoryResponse fromList( + @NonNull ArrayList pigeonVar_list) { PlatformPurchaseHistoryResponse pigeonResult = new PlatformPurchaseHistoryResponse(); Object billingResult = pigeonVar_list.get(0); pigeonResult.setBillingResult((PlatformBillingResult) billingResult); @@ -2191,10 +2343,10 @@ ArrayList toList() { } /** - * 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. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformPurchasesResponse { private @NonNull PlatformBillingResult billingResult; @@ -2228,8 +2380,12 @@ public void setPurchases(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformPurchasesResponse that = (PlatformPurchasesResponse) o; return billingResult.equals(that.billingResult) && purchases.equals(that.purchases); } @@ -2286,7 +2442,7 @@ ArrayList toList() { /** * Pigeon version of Java ProductDetails.SubscriptionOfferDetails. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformSubscriptionOfferDetails { private @NonNull String basePlanId; @@ -2366,15 +2522,25 @@ public void setInstallmentPlanDetails(@Nullable PlatformInstallmentPlanDetails s @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformSubscriptionOfferDetails that = (PlatformSubscriptionOfferDetails) o; - return basePlanId.equals(that.basePlanId) && Objects.equals(offerId, that.offerId) && offerToken.equals(that.offerToken) && offerTags.equals(that.offerTags) && pricingPhases.equals(that.pricingPhases) && Objects.equals(installmentPlanDetails, that.installmentPlanDetails); + return basePlanId.equals(that.basePlanId) + && Objects.equals(offerId, that.offerId) + && offerToken.equals(that.offerToken) + && offerTags.equals(that.offerTags) + && pricingPhases.equals(that.pricingPhases) + && Objects.equals(installmentPlanDetails, that.installmentPlanDetails); } @Override public int hashCode() { - return Objects.hash(basePlanId, offerId, offerToken, offerTags, pricingPhases, installmentPlanDetails); + return Objects.hash( + basePlanId, offerId, offerToken, offerTags, pricingPhases, installmentPlanDetails); } public static final class Builder { @@ -2422,7 +2588,8 @@ public static final class Builder { private @Nullable PlatformInstallmentPlanDetails installmentPlanDetails; @CanIgnoreReturnValue - public @NonNull Builder setInstallmentPlanDetails(@Nullable PlatformInstallmentPlanDetails setterArg) { + public @NonNull Builder setInstallmentPlanDetails( + @Nullable PlatformInstallmentPlanDetails setterArg) { this.installmentPlanDetails = setterArg; return this; } @@ -2451,7 +2618,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformSubscriptionOfferDetails fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformSubscriptionOfferDetails fromList( + @NonNull ArrayList pigeonVar_list) { PlatformSubscriptionOfferDetails pigeonResult = new PlatformSubscriptionOfferDetails(); Object basePlanId = pigeonVar_list.get(0); pigeonResult.setBasePlanId((String) basePlanId); @@ -2464,7 +2632,8 @@ ArrayList toList() { Object pricingPhases = pigeonVar_list.get(4); pigeonResult.setPricingPhases((List) pricingPhases); Object installmentPlanDetails = pigeonVar_list.get(5); - pigeonResult.setInstallmentPlanDetails((PlatformInstallmentPlanDetails) installmentPlanDetails); + pigeonResult.setInstallmentPlanDetails( + (PlatformInstallmentPlanDetails) installmentPlanDetails); return pigeonResult; } } @@ -2472,7 +2641,7 @@ ArrayList toList() { /** * Pigeon version of UserChoiceDetailsWrapper and Java UserChoiceDetails. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformUserChoiceDetails { private @Nullable String originalExternalTransactionId; @@ -2516,10 +2685,16 @@ public void setProducts(@NonNull List setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformUserChoiceDetails that = (PlatformUserChoiceDetails) o; - return Objects.equals(originalExternalTransactionId, that.originalExternalTransactionId) && externalTransactionToken.equals(that.externalTransactionToken) && products.equals(that.products); + return Objects.equals(originalExternalTransactionId, that.originalExternalTransactionId) + && externalTransactionToken.equals(that.externalTransactionToken) + && products.equals(that.products); } @Override @@ -2586,7 +2761,7 @@ ArrayList toList() { /** * Pigeon version of UserChoiseDetails.Product. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformUserChoiceProduct { private @NonNull String id; @@ -2630,10 +2805,16 @@ public void setType(@NonNull PlatformProductType setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformUserChoiceProduct that = (PlatformUserChoiceProduct) o; - return id.equals(that.id) && Objects.equals(offerToken, that.offerToken) && type.equals(that.type); + return id.equals(that.id) + && Objects.equals(offerToken, that.offerToken) + && type.equals(that.type); } @Override @@ -2701,7 +2882,7 @@ ArrayList toList() { * Pigeon version of ProductDetails.InstallmentPlanDetails. * https://developer.android.com/reference/com/android/billingclient/api/PendingPurchasesParams.Builder#enableOneTimeProducts() * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PlatformInstallmentPlanDetails { private @NonNull Long commitmentPaymentsCount; @@ -2725,7 +2906,8 @@ public void setCommitmentPaymentsCount(@NonNull Long setterArg) { public void setSubsequentCommitmentPaymentsCount(@NonNull Long setterArg) { if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"subsequentCommitmentPaymentsCount\" is null."); + throw new IllegalStateException( + "Nonnull field \"subsequentCommitmentPaymentsCount\" is null."); } this.subsequentCommitmentPaymentsCount = setterArg; } @@ -2735,10 +2917,15 @@ public void setSubsequentCommitmentPaymentsCount(@NonNull Long setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PlatformInstallmentPlanDetails that = (PlatformInstallmentPlanDetails) o; - return commitmentPaymentsCount.equals(that.commitmentPaymentsCount) && subsequentCommitmentPaymentsCount.equals(that.subsequentCommitmentPaymentsCount); + return commitmentPaymentsCount.equals(that.commitmentPaymentsCount) + && subsequentCommitmentPaymentsCount.equals(that.subsequentCommitmentPaymentsCount); } @Override @@ -2780,7 +2967,8 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformInstallmentPlanDetails fromList(@NonNull ArrayList pigeonVar_list) { + static @NonNull PlatformInstallmentPlanDetails fromList( + @NonNull ArrayList pigeonVar_list) { PlatformInstallmentPlanDetails pigeonResult = new PlatformInstallmentPlanDetails(); Object commitmentPaymentsCount = pigeonVar_list.get(0); pigeonResult.setCommitmentPaymentsCount((Long) commitmentPaymentsCount); @@ -2793,7 +2981,7 @@ ArrayList toList() { /** * Pigeon version of Java PendingPurchasesParams. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class PendingPurchasesParams { private @NonNull Boolean enablePrepaidPlans; @@ -2814,8 +3002,12 @@ public void setEnablePrepaidPlans(@NonNull Boolean setterArg) { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) { return false; } + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } PendingPurchasesParams that = (PendingPurchasesParams) o; return enablePrepaidPlans.equals(that.enablePrepaidPlans); } @@ -2865,22 +3057,30 @@ private PigeonCodec() {} @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte) 129: { - Object value = readValue(buffer); - return value == null ? null : PlatformProductType.values()[((Long) value).intValue()]; - } - case (byte) 130: { - Object value = readValue(buffer); - return value == null ? null : PlatformBillingChoiceMode.values()[((Long) value).intValue()]; - } - case (byte) 131: { - Object value = readValue(buffer); - return value == null ? null : PlatformPurchaseState.values()[((Long) value).intValue()]; - } - case (byte) 132: { - Object value = readValue(buffer); - return value == null ? null : PlatformRecurrenceMode.values()[((Long) value).intValue()]; - } + case (byte) 129: + { + Object value = readValue(buffer); + return value == null ? null : PlatformProductType.values()[((Long) value).intValue()]; + } + case (byte) 130: + { + Object value = readValue(buffer); + return value == null + ? null + : PlatformBillingChoiceMode.values()[((Long) value).intValue()]; + } + case (byte) 131: + { + Object value = readValue(buffer); + return value == null ? null : PlatformPurchaseState.values()[((Long) value).intValue()]; + } + case (byte) 132: + { + Object value = readValue(buffer); + return value == null + ? null + : PlatformRecurrenceMode.values()[((Long) value).intValue()]; + } case (byte) 133: return PlatformQueryProduct.fromList((ArrayList) readValue(buffer)); case (byte) 134: @@ -2888,13 +3088,15 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { case (byte) 135: return PlatformBillingResult.fromList((ArrayList) readValue(buffer)); case (byte) 136: - return PlatformOneTimePurchaseOfferDetails.fromList((ArrayList) readValue(buffer)); + return PlatformOneTimePurchaseOfferDetails.fromList( + (ArrayList) readValue(buffer)); case (byte) 137: return PlatformProductDetails.fromList((ArrayList) readValue(buffer)); case (byte) 138: return PlatformProductDetailsResponse.fromList((ArrayList) readValue(buffer)); case (byte) 139: - return PlatformAlternativeBillingOnlyReportingDetailsResponse.fromList((ArrayList) readValue(buffer)); + return PlatformAlternativeBillingOnlyReportingDetailsResponse.fromList( + (ArrayList) readValue(buffer)); case (byte) 140: return PlatformBillingConfigResponse.fromList((ArrayList) readValue(buffer)); case (byte) 141: @@ -2960,7 +3162,8 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { writeValue(stream, ((PlatformProductDetailsResponse) value).toList()); } else if (value instanceof PlatformAlternativeBillingOnlyReportingDetailsResponse) { stream.write(139); - writeValue(stream, ((PlatformAlternativeBillingOnlyReportingDetailsResponse) value).toList()); + writeValue( + stream, ((PlatformAlternativeBillingOnlyReportingDetailsResponse) value).toList()); } else if (value instanceof PlatformBillingConfigResponse) { stream.write(140); writeValue(stream, ((PlatformBillingConfigResponse) value).toList()); @@ -3006,7 +3209,6 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { } } - /** Asynchronous error handling return type for non-nullable API method returns. */ public interface Result { /** Success case callback method for handling returns. */ @@ -3034,51 +3236,87 @@ public interface VoidResult { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InAppPurchaseApi { /** Wraps BillingClient#isReady. */ - @NonNull + @NonNull Boolean isReady(); /** Wraps BillingClient#startConnection(BillingClientStateListener). */ - void startConnection(@NonNull Long callbackHandle, @NonNull PlatformBillingChoiceMode billingMode, @NonNull PendingPurchasesParams pendingPurchasesParams, @NonNull Result result); + void startConnection( + @NonNull Long callbackHandle, + @NonNull PlatformBillingChoiceMode billingMode, + @NonNull PendingPurchasesParams pendingPurchasesParams, + @NonNull Result result); /** Wraps BillingClient#endConnection(BillingClientStateListener). */ void endConnection(); - /** Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, BillingConfigResponseListener). */ + /** + * Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, + * BillingConfigResponseListener). + */ void getBillingConfigAsync(@NonNull Result result); /** Wraps BillingClient#launchBillingFlow(Activity, BillingFlowParams). */ - @NonNull + @NonNull PlatformBillingResult launchBillingFlow(@NonNull PlatformBillingFlowParams params); - /** Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, AcknowledgePurchaseResponseListener). */ - void acknowledgePurchase(@NonNull String purchaseToken, @NonNull Result result); + /** + * Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, + * AcknowledgePurchaseResponseListener). + */ + void acknowledgePurchase( + @NonNull String purchaseToken, @NonNull Result result); /** Wraps BillingClient#consumeAsync(ConsumeParams, ConsumeResponseListener). */ void consumeAsync(@NonNull String purchaseToken, @NonNull Result result); /** Wraps BillingClient#queryPurchasesAsync(QueryPurchaseParams, PurchaseResponseListener). */ - 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). */ - void queryProductDetailsAsync(@NonNull List products, @NonNull Result result); + 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). + */ + void queryProductDetailsAsync( + @NonNull List products, + @NonNull Result result); /** Wraps BillingClient#isFeatureSupported(String). */ - @NonNull + @NonNull Boolean isFeatureSupported(@NonNull String feature); /** Wraps BillingClient#isAlternativeBillingOnlyAvailableAsync(). */ void isAlternativeBillingOnlyAvailableAsync(@NonNull Result result); /** Wraps BillingClient#showAlternativeBillingOnlyInformationDialog(). */ void showAlternativeBillingOnlyInformationDialog(@NonNull Result result); - /** Wraps BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). */ - void createAlternativeBillingOnlyReportingDetailsAsync(@NonNull Result result); + /** + * Wraps + * BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). + */ + void createAlternativeBillingOnlyReportingDetailsAsync( + @NonNull Result result); /** The codec used by InAppPurchaseApi. */ static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } - /**Sets up an instance of `InAppPurchaseApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `InAppPurchaseApi` to handle messages through the `binaryMessenger`. + */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable InAppPurchaseApi api) { setUp(binaryMessenger, "", api); } - static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String messageChannelSuffix, @Nullable InAppPurchaseApi api) { + + static void setUp( + @NonNull BinaryMessenger binaryMessenger, + @NonNull String messageChannelSuffix, + @Nullable InAppPurchaseApi api) { messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3086,8 +3324,7 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String mess try { Boolean output = api.isReady(); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3099,7 +3336,10 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String mess { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3107,7 +3347,8 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String mess ArrayList args = (ArrayList) message; Long callbackHandleArg = (Long) args.get(0); PlatformBillingChoiceMode billingModeArg = (PlatformBillingChoiceMode) args.get(1); - PendingPurchasesParams pendingPurchasesParamsArg = (PendingPurchasesParams) args.get(2); + PendingPurchasesParams pendingPurchasesParamsArg = + (PendingPurchasesParams) args.get(2); Result resultCallback = new Result() { public void success(PlatformBillingResult result) { @@ -3121,7 +3362,8 @@ public void error(Throwable error) { } }; - api.startConnection(callbackHandleArg, billingModeArg, pendingPurchasesParamsArg, resultCallback); + api.startConnection( + callbackHandleArg, billingModeArg, pendingPurchasesParamsArg, resultCallback); }); } else { channel.setMessageHandler(null); @@ -3130,7 +3372,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3138,8 +3383,7 @@ public void error(Throwable error) { try { api.endConnection(); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3151,7 +3395,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3178,7 +3425,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3188,8 +3438,7 @@ public void error(Throwable error) { try { PlatformBillingResult output = api.launchBillingFlow(paramsArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3201,7 +3450,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3230,7 +3482,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3259,7 +3514,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3288,7 +3546,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3317,7 +3578,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3346,7 +3610,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3356,8 +3623,7 @@ public void error(Throwable error) { try { Boolean output = api.isFeatureSupported(featureArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { wrapped = wrapError(exception); } reply.reply(wrapped); @@ -3369,7 +3635,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3396,7 +3665,10 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3423,14 +3695,18 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync" + messageChannelSuffix, getCodec()); + binaryMessenger, + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync" + + messageChannelSuffix, + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList wrapped = new ArrayList<>(); Result resultCallback = new Result() { - public void success(PlatformAlternativeBillingOnlyReportingDetailsResponse result) { + public void success( + PlatformAlternativeBillingOnlyReportingDetailsResponse result) { wrapped.add(0, result); reply.reply(wrapped); } @@ -3457,79 +3733,90 @@ public static class InAppPurchaseCallbackApi { public InAppPurchaseCallbackApi(@NonNull BinaryMessenger argBinaryMessenger) { this(argBinaryMessenger, ""); } - public InAppPurchaseCallbackApi(@NonNull BinaryMessenger argBinaryMessenger, @NonNull String messageChannelSuffix) { + + public InAppPurchaseCallbackApi( + @NonNull BinaryMessenger argBinaryMessenger, @NonNull String messageChannelSuffix) { this.binaryMessenger = argBinaryMessenger; this.messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; } - /** - * Public interface for sending reply. - * The codec used by InAppPurchaseCallbackApi. - */ + /** Public interface for sending reply. The codec used by InAppPurchaseCallbackApi. */ static @NonNull MessageCodec getCodec() { return PigeonCodec.INSTANCE; } /** Called for BillingClientStateListener#onBillingServiceDisconnected(). */ - public void onBillingServiceDisconnected(@NonNull Long callbackHandleArg, @NonNull VoidResult result) { - final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected" + messageChannelSuffix; + public void onBillingServiceDisconnected( + @NonNull Long callbackHandleArg, @NonNull VoidResult result) { + final String channelName = + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected" + + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(callbackHandleArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error( + new FlutterError( + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } /** Called for PurchasesUpdatedListener#onPurchasesUpdated(BillingResult, List). */ - public void onPurchasesUpdated(@NonNull PlatformPurchasesResponse updateArg, @NonNull VoidResult result) { - final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated" + messageChannelSuffix; + public void onPurchasesUpdated( + @NonNull PlatformPurchasesResponse updateArg, @NonNull VoidResult result) { + final String channelName = + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated" + + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(updateArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error( + new FlutterError( + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } /** Called for UserChoiceBillingListener#userSelectedAlternativeBilling(UserChoiceDetails). */ - public void userSelectedalternativeBilling(@NonNull PlatformUserChoiceDetails detailsArg, @NonNull VoidResult result) { - final String channelName = "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling" + messageChannelSuffix; + public void userSelectedalternativeBilling( + @NonNull PlatformUserChoiceDetails detailsArg, @NonNull VoidResult result) { + final String channelName = + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling" + + messageChannelSuffix; BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, channelName, getCodec()); + new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( new ArrayList<>(Collections.singletonList(detailsArg)), channelReply -> { if (channelReply instanceof List) { List listReply = (List) channelReply; if (listReply.size() > 1) { - result.error(new FlutterError((String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); + result.error( + new FlutterError( + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } - } else { + } else { result.error(createConnectionError(channelName)); - } + } }); } } 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 6552c294e66b..9cc8b370ac20 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 @@ -427,7 +427,8 @@ public void startConnection( @NonNull Result result) { if (billingClient == null) { billingClient = - billingClientFactory.createBillingClient(applicationContext, callbackApi, billingMode, pendingPurchasesParams); + billingClientFactory.createBillingClient( + applicationContext, callbackApi, billingMode, pendingPurchasesParams); } try { diff --git a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImplTest.java b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImplTest.java index d7b03af2b264..50265bab2315 100644 --- a/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImplTest.java +++ b/packages/in_app_purchase/in_app_purchase_android/android/src/test/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImplTest.java @@ -98,6 +98,17 @@ public void userChoiceBilling() { assertTrue(callbackCaptor.getValue().getProducts().isEmpty()); } + @Test + public void pendingPurchasesForPrepaidPlans() { + // No logic to verify just ensure creation works. + Messages.PendingPurchasesParams params = + new Messages.PendingPurchasesParams.Builder().setEnablePrepaidPlans(true).build(); + BillingClient client = + factory.createBillingClient( + context, mockCallbackApi, PlatformBillingChoiceMode.PLAY_BILLING_ONLY, params); + assertNotNull(client); + } + @After public void tearDown() throws Exception { openMocks.close(); 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 b47762afa30b..597425a957a5 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 @@ -103,23 +103,33 @@ public class MethodCallHandlerTest { @Mock Context context; @Mock ActivityPluginBinding mockActivityPluginBinding; + private final Messages.PendingPurchasesParams defaultPendingPurchasesParams = + new Messages.PendingPurchasesParams.Builder().setEnablePrepaidPlans(false).build(); + private final Long DEFAULT_HANDLE = 1L; @Before public void setUp() { openMocks = MockitoAnnotations.openMocks(this); + // Use the same client no matter if alternative billing is enabled or not. when(factory.createBillingClient( - context, mockCallbackApi, PlatformBillingChoiceMode.PLAY_BILLING_ONLY, null)) + context, + mockCallbackApi, + PlatformBillingChoiceMode.PLAY_BILLING_ONLY, + defaultPendingPurchasesParams)) .thenReturn(mockBillingClient); when(factory.createBillingClient( - context, mockCallbackApi, PlatformBillingChoiceMode.ALTERNATIVE_BILLING_ONLY, null)) + context, + mockCallbackApi, + PlatformBillingChoiceMode.ALTERNATIVE_BILLING_ONLY, + defaultPendingPurchasesParams)) .thenReturn(mockBillingClient); when(factory.createBillingClient( any(Context.class), any(InAppPurchaseCallbackApi.class), eq(PlatformBillingChoiceMode.USER_CHOICE_BILLING), - eq(null))) + any(Messages.PendingPurchasesParams.class))) .thenReturn(mockBillingClient); methodChannelHandler = new MethodCallHandlerImpl(activity, context, mockCallbackApi, factory); when(mockActivityPluginBinding.getActivity()).thenReturn(activity); @@ -159,10 +169,15 @@ public void isReady_clientDisconnected() { @Test public void startConnection() { ArgumentCaptor captor = - mockStartConnection(PlatformBillingChoiceMode.PLAY_BILLING_ONLY); + mockStartConnection( + PlatformBillingChoiceMode.PLAY_BILLING_ONLY, defaultPendingPurchasesParams); verify(platformBillingResult, never()).success(any()); verify(factory, times(1)) - .createBillingClient(context, mockCallbackApi, PlatformBillingChoiceMode.PLAY_BILLING_ONLY, null); + .createBillingClient( + context, + mockCallbackApi, + PlatformBillingChoiceMode.PLAY_BILLING_ONLY, + defaultPendingPurchasesParams); BillingResult billingResult = buildBillingResult(); captor.getValue().onBillingSetupFinished(billingResult); @@ -177,11 +192,15 @@ public void startConnection() { @Test public void startConnectionAlternativeBillingOnly() { ArgumentCaptor captor = - mockStartConnection(PlatformBillingChoiceMode.ALTERNATIVE_BILLING_ONLY); + mockStartConnection( + PlatformBillingChoiceMode.ALTERNATIVE_BILLING_ONLY, defaultPendingPurchasesParams); verify(platformBillingResult, never()).success(any()); verify(factory, times(1)) .createBillingClient( - context, mockCallbackApi, PlatformBillingChoiceMode.ALTERNATIVE_BILLING_ONLY, null); + context, + mockCallbackApi, + PlatformBillingChoiceMode.ALTERNATIVE_BILLING_ONLY, + defaultPendingPurchasesParams); BillingResult billingResult = buildBillingResult(); captor.getValue().onBillingSetupFinished(billingResult); @@ -193,10 +212,33 @@ public void startConnectionAlternativeBillingOnly() { verify(platformBillingResult, never()).error(any()); } + @Test + public void startConnectionPendingPurchasesPrepaidPlans() { + Messages.PendingPurchasesParams pendingPurchasesParams = + new Messages.PendingPurchasesParams.Builder().setEnablePrepaidPlans(true).build(); + ArgumentCaptor captor = + mockStartConnection(PlatformBillingChoiceMode.USER_CHOICE_BILLING, pendingPurchasesParams); + verify(platformBillingResult, never()).success(any()); + verify(factory, times(1)) + .createBillingClient( + context, + mockCallbackApi, + PlatformBillingChoiceMode.USER_CHOICE_BILLING, + pendingPurchasesParams); + + BillingResult billingResult = buildBillingResult(); + captor.getValue().onBillingSetupFinished(billingResult); + + ArgumentCaptor resultCaptor = + ArgumentCaptor.forClass(PlatformBillingResult.class); + verify(platformBillingResult, times(1)).success(resultCaptor.capture()); + } + @Test public void startConnectionUserChoiceBilling() { ArgumentCaptor captor = - mockStartConnection(PlatformBillingChoiceMode.USER_CHOICE_BILLING); + mockStartConnection( + PlatformBillingChoiceMode.USER_CHOICE_BILLING, defaultPendingPurchasesParams); verify(platformBillingResult, never()).success(any()); verify(factory, times(1)) @@ -222,10 +264,15 @@ public void startConnectionUserChoiceBilling() { public void userChoiceBillingOnSecondConnection() { // First connection. ArgumentCaptor captor1 = - mockStartConnection(PlatformBillingChoiceMode.PLAY_BILLING_ONLY); + mockStartConnection( + PlatformBillingChoiceMode.PLAY_BILLING_ONLY, defaultPendingPurchasesParams); verify(platformBillingResult, never()).success(any()); verify(factory, times(1)) - .createBillingClient(context, mockCallbackApi, PlatformBillingChoiceMode.PLAY_BILLING_ONLY, Messages.PendingPurchasesParams()); + .createBillingClient( + context, + mockCallbackApi, + PlatformBillingChoiceMode.PLAY_BILLING_ONLY, + defaultPendingPurchasesParams); BillingResult billingResult1 = BillingResult.newBuilder() @@ -249,13 +296,15 @@ public void userChoiceBillingOnSecondConnection() { // Second connection. ArgumentCaptor captor2 = - mockStartConnection(PlatformBillingChoiceMode.USER_CHOICE_BILLING); + mockStartConnection( + PlatformBillingChoiceMode.USER_CHOICE_BILLING, defaultPendingPurchasesParams); verify(platformBillingResult, never()).success(any()); verify(factory, times(1)) .createBillingClient( any(Context.class), any(InAppPurchaseCallbackApi.class), - eq(PlatformBillingChoiceMode.USER_CHOICE_BILLING)); + eq(PlatformBillingChoiceMode.USER_CHOICE_BILLING), + eq(defaultPendingPurchasesParams)); BillingResult billingResult2 = BillingResult.newBuilder() @@ -274,7 +323,10 @@ public void startConnection_multipleCalls() { doNothing().when(mockBillingClient).startConnection(captor.capture()); methodChannelHandler.startConnection( - DEFAULT_HANDLE, PlatformBillingChoiceMode.PLAY_BILLING_ONLY, platformBillingResult); + DEFAULT_HANDLE, + PlatformBillingChoiceMode.PLAY_BILLING_ONLY, + defaultPendingPurchasesParams, + platformBillingResult); verify(platformBillingResult, never()).success(any()); BillingResult billingResult1 = buildBillingResult(); BillingResult billingResult2 = @@ -481,7 +533,10 @@ public void endConnection() { @SuppressWarnings("unchecked") final Messages.Result mockResult = mock(Messages.Result.class); methodChannelHandler.startConnection( - disconnectCallbackHandle, PlatformBillingChoiceMode.PLAY_BILLING_ONLY, mockResult); + disconnectCallbackHandle, + PlatformBillingChoiceMode.PLAY_BILLING_ONLY, + defaultPendingPurchasesParams, + mockResult); final BillingClientStateListener stateListener = captor.getValue(); // Disconnect the connected client @@ -1073,7 +1128,8 @@ public void isFutureSupported_false() { *

Defaults to play billing only which is the default. */ private ArgumentCaptor mockStartConnection() { - return mockStartConnection(PlatformBillingChoiceMode.PLAY_BILLING_ONLY); + return mockStartConnection( + PlatformBillingChoiceMode.PLAY_BILLING_ONLY, defaultPendingPurchasesParams); } /** @@ -1081,12 +1137,14 @@ private ArgumentCaptor mockStartConnection() { * Messages.Result)} with startup params. */ private ArgumentCaptor mockStartConnection( - PlatformBillingChoiceMode billingChoiceMode) { + PlatformBillingChoiceMode billingChoiceMode, + Messages.PendingPurchasesParams pendingPurchasesParams) { ArgumentCaptor captor = ArgumentCaptor.forClass(BillingClientStateListener.class); doNothing().when(mockBillingClient).startConnection(captor.capture()); - methodChannelHandler.startConnection(DEFAULT_HANDLE, billingChoiceMode, platformBillingResult); + methodChannelHandler.startConnection( + DEFAULT_HANDLE, billingChoiceMode, pendingPurchasesParams, platformBillingResult); return captor; } @@ -1094,7 +1152,10 @@ private void establishConnectedBillingClient() { @SuppressWarnings("unchecked") final Messages.Result mockResult = mock(Messages.Result.class); methodChannelHandler.startConnection( - DEFAULT_HANDLE, PlatformBillingChoiceMode.PLAY_BILLING_ONLY, mockResult); + DEFAULT_HANDLE, + PlatformBillingChoiceMode.PLAY_BILLING_ONLY, + defaultPendingPurchasesParams, + mockResult); } private void queryForProducts(List productIdList) { 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 593e6e703ea5..27f274564446 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 @@ -7,6 +7,7 @@ import 'dart:async'; import 'package:flutter_test/flutter_test.dart'; import 'package:in_app_purchase_android/billing_client_wrappers.dart'; import 'package:in_app_purchase_android/src/billing_client_wrappers/billing_config_wrapper.dart'; +import 'package:in_app_purchase_android/src/billing_client_wrappers/pending_purchases_params_wrapper.dart'; import 'package:in_app_purchase_android/src/messages.g.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -104,7 +105,11 @@ void main() { expect(result.captured[0], 0); expect(result.captured[1], PlatformBillingChoiceMode.playBillingOnly); expect( - result.captured[2], PendingPurchasesParams(enablePrepaidPlans: true)); + result.captured[2], + isA().having( + (PendingPurchasesParams params) => params.enablePrepaidPlans, + 'enablePrepaidPlans', + false)); }); test('passes billingChoiceMode alternativeBillingOnly when set', () async { @@ -151,6 +156,21 @@ void main() { expect(await completer.future, expected); }); + test('passes pendingPurchasesParams when set', () async { + await billingClient.startConnection( + onBillingServiceDisconnected: () {}, + billingChoiceMode: BillingChoiceMode.alternativeBillingOnly, + pendingPurchasesParams: + const PendingPurchasesParamsWrapper(enablePrepaidPlans: true)); + + expect( + verify(mockApi.startConnection(any, any, captureAny)).captured.first, + isA().having( + (PendingPurchasesParams params) => params.enablePrepaidPlans, + 'enablePrepaidPlans', + true)); + }); + test('UserChoiceDetailsWrapper searilization check', () async { // Test ensures that changes to UserChoiceDetailsWrapper#toJson are // compatible with code in Translator.java. From 3bad18ce7fe7cbb58f8c7d9b3f027d2ce234adaf Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Tue, 3 Dec 2024 09:59:46 +0100 Subject: [PATCH 12/16] Update CHANGELOG Signed-off-by: Marcin Chudy --- .../in_app_purchase/in_app_purchase_android/CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 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 ca949e024df3..5691262d6a2c 100644 --- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md @@ -1,8 +1,9 @@ ## 0.4.0 * Updates Google Play Billing Library to 7.1.1. -* **BREAKING CHANGE**: Removes the depracated `ProrationMode` enum. `ReplacementMode` should be used instead. -* **BREAKING CHANGE**: Removes the depracated `BillingClientWrapper.enablePendingPurchases`. +* **BREAKING CHANGES**: + * Removes the deprecated `ProrationMode` enum. `ReplacementMode` should be used instead. + * Removes the deprecated `BillingClientWrapper.enablePendingPurchases` method. * Adds `installmentPlanDetails` to `SubscriptionOfferDetailsWrapper` * Adds APIs to support pending transactions for subscription prepaid plans (`PendingPurchaseParams`). From 1ecb83777666fe3810e25cea5a959f1cc4d96643 Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Tue, 3 Dec 2024 10:09:47 +0100 Subject: [PATCH 13/16] Update pubspec.yaml Signed-off-by: Marcin Chudy --- packages/in_app_purchase/in_app_purchase_android/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 7e18fa0722a6..a3aae41cb017 100644 --- a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml @@ -2,7 +2,7 @@ name: in_app_purchase_android description: An implementation for the Android platform of the Flutter `in_app_purchase` plugin. This uses the Android BillingClient APIs. 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.3.6+12 +version: 0.4.0 environment: sdk: ^3.5.0 From cca3b16cbcf6c5d7884ecb67a67a200c2a693656 Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Tue, 3 Dec 2024 23:24:11 +0100 Subject: [PATCH 14/16] Update CHANGELOG and remove unnecessary ? --- packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md | 1 + .../lib/src/billing_client_wrappers/billing_client_wrapper.dart | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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 5691262d6a2c..d9f78b36231a 100644 --- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md @@ -4,6 +4,7 @@ * **BREAKING CHANGES**: * Removes the deprecated `ProrationMode` enum. `ReplacementMode` should be used instead. * Removes the deprecated `BillingClientWrapper.enablePendingPurchases` method. + * Bumps `minSdk` to 21 * Adds `installmentPlanDetails` to `SubscriptionOfferDetailsWrapper` * Adds APIs to support pending transactions for subscription prepaid plans (`PendingPurchaseParams`). 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 c72c2b520899..3a2ed36bed23 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 @@ -103,7 +103,7 @@ class BillingClient { hostCallbackHandler.disconnectCallbacks.length - 1, platformBillingChoiceMode(billingChoiceMode), switch (pendingPurchasesParams) { - final PendingPurchasesParamsWrapper params? => + final PendingPurchasesParamsWrapper params => pendingPurchasesParamsFromWrapper(params), null => PendingPurchasesParams(enablePrepaidPlans: false) }, From aacd8ff0a524a800d004a4e52aab2ef99238e082 Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Wed, 4 Dec 2024 09:54:26 +0100 Subject: [PATCH 15/16] Fix tests --- .../io/flutter/plugins/inapppurchase/TranslatorTest.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 330f3a3668d1..5f8e83cf401f 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 @@ -242,7 +242,13 @@ private void assertSerialized( assertEquals(expected.getOfferTags(), serialized.getOfferTags()); assertEquals(expected.getOfferToken(), serialized.getOfferToken()); assertSerialized(expected.getPricingPhases(), serialized.getPricingPhases()); - assertSerialized(expected.getInstallmentPlanDetails(), serialized.getInstallmentPlanDetails()); + + ProductDetails.InstallmentPlanDetails expectedInstallmentPlanDetails = expected.getInstallmentPlanDetails(); + Messages.PlatformInstallmentPlanDetails serializedInstallmentPlanDetails = serialized.getInstallmentPlanDetails(); + assertEquals(expectedInstallmentPlanDetails == null, serializedInstallmentPlanDetails == null); + if (expectedInstallmentPlanDetails != null && serializedInstallmentPlanDetails != null) { + assertSerialized(expectedInstallmentPlanDetails, serializedInstallmentPlanDetails); + } } private void assertSerialized( From a4e540f7160dc9ea82f9be7d6d42d94d4208a81c Mon Sep 17 00:00:00 2001 From: Marcin Chudy Date: Wed, 4 Dec 2024 09:55:15 +0100 Subject: [PATCH 16/16] Update CHANGELOG --- .../in_app_purchase/CHANGELOG.md | 524 +++++++++--------- 1 file changed, 263 insertions(+), 261 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md index d4a2e5ab131d..c91973ca355f 100644 --- a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md @@ -1,204 +1,206 @@ ## NEXT -* Updates minimum supported SDK version to Flutter 3.19/Dart 3.3. +- Updates minimum supported SDK version to Flutter 3.19/Dart 3.3. +- Updates `in_app_purchase_android` to 0.4.0. ## 3.2.0 -* Adds `countryCode` API. -* Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. -* Updates support matrix in README to indicate that iOS 11 is no longer supported. -* Clients on versions of Flutter that still support iOS 11 can continue to use this +- Adds `countryCode` API. +- Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. +- Updates support matrix in README to indicate that iOS 11 is no longer supported. +- Clients on versions of Flutter that still support iOS 11 can continue to use this package with iOS 11, but will not receive any further updates to the iOS implementation. ## 3.1.13 -* Updates minimum required plugin_platform_interface version to 2.1.7. +- Updates minimum required plugin_platform_interface version to 2.1.7. ## 3.1.12 -* Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. -* Fixes new lint warnings. +- Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. +- Fixes new lint warnings. ## 3.1.11 -* Updates documentation reference of `finishPurchase` to `completePurchase`. +- Updates documentation reference of `finishPurchase` to `completePurchase`. ## 3.1.10 -* Updates example code for current versions of Flutter. +- Updates example code for current versions of Flutter. ## 3.1.9 -* Adds pub topics to package metadata. -* Updates minimum supported SDK version to Flutter 3.7/Dart 2.19. +- Adds pub topics to package metadata. +- Updates minimum supported SDK version to Flutter 3.7/Dart 2.19. ## 3.1.8 -* Updates documentation on handling subscription price changes to match Android's billing client v5. +- Updates documentation on handling subscription price changes to match Android's billing client v5. ## 3.1.7 -* Fixes unawaited_futures violations. +- Fixes unawaited_futures violations. ## 3.1.6 -* Bumps minimum in_app_purchase_android version to 0.3.0. -* Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. -* Aligns Dart and Flutter SDK constraints. +- Bumps minimum in_app_purchase_android version to 0.3.0. +- Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. +- Aligns Dart and Flutter SDK constraints. ## 3.1.5 -* Updates links for the merge of flutter/plugins into flutter/packages. +- Updates links for the merge of flutter/plugins into flutter/packages. ## 3.1.4 -* Updates iOS minimum version in README. +- Updates iOS minimum version in README. ## 3.1.3 -* Ignores a lint in the example app for backwards compatibility. +- Ignores a lint in the example app for backwards compatibility. ## 3.1.2 -* Updates example code for `use_build_context_synchronously` lint. -* Updates minimum Flutter version to 3.0. +- Updates example code for `use_build_context_synchronously` lint. +- Updates minimum Flutter version to 3.0. ## 3.1.1 -* Adds screenshots to pubspec.yaml. +- Adds screenshots to pubspec.yaml. ## 3.1.0 -* Adds macOS as a supported platform. +- Adds macOS as a supported platform. ## 3.0.8 -* Updates minimum Flutter version to 2.10. -* Bumps minimum in_app_purchase_android to 0.2.3. +- Updates minimum Flutter version to 2.10. +- Bumps minimum in_app_purchase_android to 0.2.3. ## 3.0.7 -* Fixes avoid_redundant_argument_values lint warnings and minor typos. +- Fixes avoid_redundant_argument_values lint warnings and minor typos. ## 3.0.6 -* Ignores deprecation warnings for upcoming styleFrom button API changes. +- Ignores deprecation warnings for upcoming styleFrom button API changes. ## 3.0.5 -* Updates references to the obsolete master branch. +- Updates references to the obsolete master branch. ## 3.0.4 -* Minor fixes for new analysis options. +- Minor fixes for new analysis options. ## 3.0.3 -* Removes unnecessary imports. -* Adds OS version support information to README. -* Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors +- Removes unnecessary imports. +- Adds OS version support information to README. +- Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors lint warnings. ## 3.0.2 -* Adds additional explanation on why it is important to complete a purchase. +- Adds additional explanation on why it is important to complete a purchase. ## 3.0.1 -* Internal code cleanup for stricter analysis options. +- Internal code cleanup for stricter analysis options. ## 3.0.0 -* **BREAKING CHANGE** Updates `restorePurchases` to emit an empty list of purchases on StoreKit when there are no purchases to restore (same as Android). - * This change was listed in the CHANGELOG for 2.0.0, but the change was accidentally not included in 2.0.0. +- **BREAKING CHANGE** Updates `restorePurchases` to emit an empty list of purchases on StoreKit when there are no purchases to restore (same as Android). + - This change was listed in the CHANGELOG for 2.0.0, but the change was accidentally not included in 2.0.0. ## 2.0.1 -* Removes the instructions on initializing the plugin since this functionality is deprecated. +- Removes the instructions on initializing the plugin since this functionality is deprecated. ## 2.0.0 -* **BREAKING CHANGES**: - * Adds a new `PurchaseStatus` named `canceled`. This means developers can distinguish between an error and user cancellation. - * ~~Updates `restorePurchases` to emit an empty list of purchases on StoreKit when there are no purchases to restore (same as Android).~~ - * Renames `in_app_purchase_ios` to `in_app_purchase_storekit`. - * Renames `InAppPurchaseIosPlatform` to `InAppPurchaseStoreKitPlatform`. - * Renames `InAppPurchaseIosPlatformAddition` to +- **BREAKING CHANGES**: + + - Adds a new `PurchaseStatus` named `canceled`. This means developers can distinguish between an error and user cancellation. + - ~~Updates `restorePurchases` to emit an empty list of purchases on StoreKit when there are no purchases to restore (same as Android).~~ + - Renames `in_app_purchase_ios` to `in_app_purchase_storekit`. + - Renames `InAppPurchaseIosPlatform` to `InAppPurchaseStoreKitPlatform`. + - Renames `InAppPurchaseIosPlatformAddition` to `InAppPurchaseStoreKitPlatformAddition`. -* Deprecates the `InAppPurchaseAndroidPlatformAddition.enablePendingPurchases()` method and `InAppPurchaseAndroidPlatformAddition.enablePendingPurchase` property. -* Adds support for promotional offers on the store_kit_wrappers Dart API. -* Fixes integration tests. -* Updates example app Android compileSdkVersion to 31. +- Deprecates the `InAppPurchaseAndroidPlatformAddition.enablePendingPurchases()` method and `InAppPurchaseAndroidPlatformAddition.enablePendingPurchase` property. +- Adds support for promotional offers on the store_kit_wrappers Dart API. +- Fixes integration tests. +- Updates example app Android compileSdkVersion to 31. ## 1.0.9 -* Handle purchases with `PurchaseStatus.restored` correctly in the example App. -* Updated dependencies on `in_app_purchase_android` and `in_app_purchase_ios` to their latest versions (version 0.1.5 and 0.1.3+5 respectively). +- Handle purchases with `PurchaseStatus.restored` correctly in the example App. +- Updated dependencies on `in_app_purchase_android` and `in_app_purchase_ios` to their latest versions (version 0.1.5 and 0.1.3+5 respectively). ## 1.0.8 -* Fix repository link in pubspec.yaml. +- Fix repository link in pubspec.yaml. ## 1.0.7 -* Remove references to the Android V1 embedding. +- Remove references to the Android V1 embedding. ## 1.0.6 -* Added import flutter foundation dependency in README.md to be able to use `defaultTargetPlatform`. +- Added import flutter foundation dependency in README.md to be able to use `defaultTargetPlatform`. ## 1.0.5 -* Add explanation for casting `ProductDetails` and `PurchaseDetails` to platform specific implementations in the readme. +- Add explanation for casting `ProductDetails` and `PurchaseDetails` to platform specific implementations in the readme. ## 1.0.4 -* Fix `Restoring previous purchases` link in the README.md. +- Fix `Restoring previous purchases` link in the README.md. ## 1.0.3 -* Added a "Restore purchases" button to conform to Apple's StoreKit guidelines on [restoring products](https://developer.apple.com/documentation/storekit/in-app_purchase/restoring_purchased_products?language=objc); -* Corrected an error in a example snippet displayed in the README.md. +- Added a "Restore purchases" button to conform to Apple's StoreKit guidelines on [restoring products](https://developer.apple.com/documentation/storekit/in-app_purchase/restoring_purchased_products?language=objc); +- Corrected an error in a example snippet displayed in the README.md. ## 1.0.2 -* Fix ignoring "autoConsume" param in "InAppPurchase.instance.buyConsumable". +- Fix ignoring "autoConsume" param in "InAppPurchase.instance.buyConsumable". ## 1.0.1 -* Migrate maven repository from jcenter to mavenCentral. +- Migrate maven repository from jcenter to mavenCentral. ## 1.0.0 -* Stable release of in_app_purchase plugin. +- Stable release of in_app_purchase plugin. ## 0.6.0+1 -* Added a reference to the in-app purchase codelab in the README.md. +- Added a reference to the in-app purchase codelab in the README.md. ## 0.6.0 As part of implementing federated architecture and making the interface compatible for other platforms this version contains the following **breaking changes**: -* Changes to the platform agnostic interface: - * If you used `InAppPurchaseConnection.instance` to access generic In App Purchase APIs, please use `InAppPurchase.instance` instead; - * The `InAppPurchaseConnection.purchaseUpdatedStream` has been renamed to `InAppPurchase.purchaseStream`; - * The `InAppPurchaseConnection.queryPastPurchases` method has been removed. Instead, you should use `InAppPurchase.restorePurchases`. This method emits each restored purchase on the `InAppPurchase.purchaseStream`, the `PurchaseDetails` object will be marked with a `status` of `PurchaseStatus.restored`; - * The `InAppPurchase.completePurchase` method no longer returns an instance `BillingWrapperResult` class (which was Android specific). Instead it will return a completed `Future` if the method executed successfully, in case of errors it will complete with an `InAppPurchaseException` describing the error. -* Android specific changes: - * The Android specific `InAppPurchaseConnection.consumePurchase` and `InAppPurchaseConnection.enablePendingPurchases` methods have been removed from the platform agnostic interface and moved to the Android specific `InAppPurchaseAndroidPlatformAddition` class: - * `InAppPurchaseAndroidPlatformAddition.enablePendingPurchases` is a static method that should be called when initializing your App. Access the method like this: `InAppPurchaseAndroidPlatformAddition.enablePendingPurchases()` (make sure to add the following import: `import 'package:in_app_purchase_android/in_app_purchase_android.dart';`); - * To use the `InAppPurchaseAndroidPlatformAddition.consumePurchase` method, acquire an instance using the `InAppPurchase.getPlatformAddition` method. For example: +- Changes to the platform agnostic interface: + - If you used `InAppPurchaseConnection.instance` to access generic In App Purchase APIs, please use `InAppPurchase.instance` instead; + - The `InAppPurchaseConnection.purchaseUpdatedStream` has been renamed to `InAppPurchase.purchaseStream`; + - The `InAppPurchaseConnection.queryPastPurchases` method has been removed. Instead, you should use `InAppPurchase.restorePurchases`. This method emits each restored purchase on the `InAppPurchase.purchaseStream`, the `PurchaseDetails` object will be marked with a `status` of `PurchaseStatus.restored`; + - The `InAppPurchase.completePurchase` method no longer returns an instance `BillingWrapperResult` class (which was Android specific). Instead it will return a completed `Future` if the method executed successfully, in case of errors it will complete with an `InAppPurchaseException` describing the error. +- Android specific changes: + - The Android specific `InAppPurchaseConnection.consumePurchase` and `InAppPurchaseConnection.enablePendingPurchases` methods have been removed from the platform agnostic interface and moved to the Android specific `InAppPurchaseAndroidPlatformAddition` class: + - `InAppPurchaseAndroidPlatformAddition.enablePendingPurchases` is a static method that should be called when initializing your App. Access the method like this: `InAppPurchaseAndroidPlatformAddition.enablePendingPurchases()` (make sure to add the following import: `import 'package:in_app_purchase_android/in_app_purchase_android.dart';`); + - To use the `InAppPurchaseAndroidPlatformAddition.consumePurchase` method, acquire an instance using the `InAppPurchase.getPlatformAddition` method. For example: ```dart // Acquire the InAppPurchaseAndroidPlatformAddition instance. InAppPurchaseAndroidPlatformAddition androidAddition = InAppPurchase.instance.getPlatformAddition(); // Consume an Android purchase. BillingResultWrapper billingResult = await androidAddition.consumePurchase(purchase); ``` - * The [billing_client_wrappers](https://pub.dev/documentation/in_app_purchase_android/latest/billing_client_wrappers/billing_client_wrappers-library.html) have been moved into the [in_app_purchase_android](https://pub.dev/packages/in_app_purchase_android) package. They are still available through the [in_app_purchase](https://pub.dev/packages/in_app_purchase) plugin but to use them it is necessary to import the correct package when using them: `import 'package:in_app_purchase_android/billing_client_wrappers.dart';`; -* iOS specific changes: - * The iOS specific methods `InAppPurchaseConnection.presentCodeRedemptionSheet` and `InAppPurchaseConnection.refreshPurchaseVerificationData` methods have been removed from the platform agnostic interface and moved into the iOS specific `InAppPurchaseIosPlatformAddition` class. To use them acquire an instance through the `InAppPurchase.getPlatformAddition` method like so: + - The [billing_client_wrappers](https://pub.dev/documentation/in_app_purchase_android/latest/billing_client_wrappers/billing_client_wrappers-library.html) have been moved into the [in_app_purchase_android](https://pub.dev/packages/in_app_purchase_android) package. They are still available through the [in_app_purchase](https://pub.dev/packages/in_app_purchase) plugin but to use them it is necessary to import the correct package when using them: `import 'package:in_app_purchase_android/billing_client_wrappers.dart';`; +- iOS specific changes: + - The iOS specific methods `InAppPurchaseConnection.presentCodeRedemptionSheet` and `InAppPurchaseConnection.refreshPurchaseVerificationData` methods have been removed from the platform agnostic interface and moved into the iOS specific `InAppPurchaseIosPlatformAddition` class. To use them acquire an instance through the `InAppPurchase.getPlatformAddition` method like so: ```dart // Acquire the InAppPurchaseIosPlatformAddition instance. InAppPurchaseIosPlatformAddition iosAddition = InAppPurchase.instance.getPlatformAddition(); @@ -207,429 +209,429 @@ As part of implementing federated architecture and making the interface compatib // Refresh purchase verification data. PurchaseVerificationData? verificationData = await iosAddition.refreshPurchaseVerificationData(); ``` - * The [store_kit_wrappers](https://pub.dev/documentation/in_app_purchase_ios/latest/store_kit_wrappers/store_kit_wrappers-library.html) have been moved into the [in_app_purchase_ios](https://pub.dev/packages/in_app_purchase_ios) package. They are still available in the [in_app_purchase](https://pub.dev/packages/in_app_purchase) plugin, but to use them it is necessary to import the correct package when using them: `import 'package:in_app_purchase_ios/store_kit_wrappers.dart';`; - * Update the minimum supported Flutter version to 1.20.0. + - The [store_kit_wrappers](https://pub.dev/documentation/in_app_purchase_ios/latest/store_kit_wrappers/store_kit_wrappers-library.html) have been moved into the [in_app_purchase_ios](https://pub.dev/packages/in_app_purchase_ios) package. They are still available in the [in_app_purchase](https://pub.dev/packages/in_app_purchase) plugin, but to use them it is necessary to import the correct package when using them: `import 'package:in_app_purchase_ios/store_kit_wrappers.dart';`; + - Update the minimum supported Flutter version to 1.20.0. ## 0.5.2 -* Added `rawPrice` and `currencyCode` to the ProductDetails model. +- Added `rawPrice` and `currencyCode` to the ProductDetails model. ## 0.5.1+3 -* Configured the iOS example App to make use of StoreKit Testing on iOS 14 and higher. +- Configured the iOS example App to make use of StoreKit Testing on iOS 14 and higher. ## 0.5.1+2 -* Update README to provide a better instruction of the plugin. +- Update README to provide a better instruction of the plugin. ## 0.5.1+1 -* Fix error message when trying to consume purchase on iOS. +- Fix error message when trying to consume purchase on iOS. ## 0.5.1 -* [iOS] Introduce `SKPaymentQueueWrapper.presentCodeRedemptionSheet` +- [iOS] Introduce `SKPaymentQueueWrapper.presentCodeRedemptionSheet` ## 0.5.0 -* Migrate to Google Billing Library 3.0 - * Add `obfuscatedProfileId`, `purchaseToken` in [BillingClientWrapper.launchBillingFlow]. - * **Breaking Change** - * Removed `developerPayload` in [BillingClientWrapper.acknowledgePurchase], [BillingClientWrapper.consumeAsync], [InAppPurchaseConnection.completePurchase], [InAppPurchaseConnection.consumePurchase]. - * Removed `isRewarded` from [SkuDetailsWrapper]. - * [SkuDetailsWrapper.introductoryPriceCycles] now returns `int` instead of `String`. - * Above breaking changes are inline with the breaking changes introduced in [Google Play Billing 3.0 release](https://developer.android.com/google/play/billing/release-notes#3-0). - * Additional information on some the changes: - * [Dropping reward SKU support](https://support.google.com/googleplay/android-developer/answer/9155268?hl=en) - * [Developer payload](https://developer.android.com/google/play/billing/developer-payload) +- Migrate to Google Billing Library 3.0 + - Add `obfuscatedProfileId`, `purchaseToken` in [BillingClientWrapper.launchBillingFlow]. + - **Breaking Change** + - Removed `developerPayload` in [BillingClientWrapper.acknowledgePurchase], [BillingClientWrapper.consumeAsync], [InAppPurchaseConnection.completePurchase], [InAppPurchaseConnection.consumePurchase]. + - Removed `isRewarded` from [SkuDetailsWrapper]. + - [SkuDetailsWrapper.introductoryPriceCycles] now returns `int` instead of `String`. + - Above breaking changes are inline with the breaking changes introduced in [Google Play Billing 3.0 release](https://developer.android.com/google/play/billing/release-notes#3-0). + - Additional information on some the changes: + - [Dropping reward SKU support](https://support.google.com/googleplay/android-developer/answer/9155268?hl=en) + - [Developer payload](https://developer.android.com/google/play/billing/developer-payload) ## 0.4.1 -* Support InApp subscription upgrade/downgrade. +- Support InApp subscription upgrade/downgrade. ## 0.4.0 -* Migrate to nullsafety. -* Deprecate `sandboxTesting`, introduce `simulatesAskToBuyInSandbox`. -* **Breaking Change:** - * Removed `callbackChannel` in `channels.dart`, see https://github.com/flutter/flutter/issues/69225. +- Migrate to nullsafety. +- Deprecate `sandboxTesting`, introduce `simulatesAskToBuyInSandbox`. +- **Breaking Change:** + - Removed `callbackChannel` in `channels.dart`, see https://github.com/flutter/flutter/issues/69225. ## 0.3.5+2 -* Migrate deprecated references. +- Migrate deprecated references. ## 0.3.5+1 -* Update the example app: remove the deprecated `RaisedButton` and `FlatButton` widgets. +- Update the example app: remove the deprecated `RaisedButton` and `FlatButton` widgets. ## 0.3.5 -* [Android] Fixed: added support for the SERVICE_TIMEOUT (-3) response code. +- [Android] Fixed: added support for the SERVICE_TIMEOUT (-3) response code. ## 0.3.4+18 -* Fix outdated links across a number of markdown files ([#3276](https://github.com/flutter/plugins/pull/3276)) +- Fix outdated links across a number of markdown files ([#3276](https://github.com/flutter/plugins/pull/3276)) ## 0.3.4+17 -* Update Flutter SDK constraint. +- Update Flutter SDK constraint. ## 0.3.4+16 -* Add Dartdocs to all public APIs. +- Add Dartdocs to all public APIs. ## 0.3.4+15 -* Update android compileSdkVersion to 29. +- Update android compileSdkVersion to 29. ## 0.3.4+14 -* Add test target to iOS example app Podfile +- Add test target to iOS example app Podfile ## 0.3.4+13 -* Android Code Inspection and Clean up. +- Android Code Inspection and Clean up. ## 0.3.4+12 -* [iOS] Fixed: finishing purchases upon payment dialog cancellation. +- [iOS] Fixed: finishing purchases upon payment dialog cancellation. ## 0.3.4+11 -* [iOS] Fixed: crash when sending null for simulatesAskToBuyInSandbox parameter. +- [iOS] Fixed: crash when sending null for simulatesAskToBuyInSandbox parameter. ## 0.3.4+10 -* Fixed typo 'verity' for 'verify'. +- Fixed typo 'verity' for 'verify'. ## 0.3.4+9 -* [iOS] Fixed: purchase dialog not showing always. -* [iOS] Fixed: completing purchases could fail. -* [iOS] Fixed: restorePurchases caused hang (call never returned). +- [iOS] Fixed: purchase dialog not showing always. +- [iOS] Fixed: completing purchases could fail. +- [iOS] Fixed: restorePurchases caused hang (call never returned). ## 0.3.4+8 -* [iOS] Fixed: purchase dialog not showing always. -* [iOS] Fixed: completing purchases could fail. -* [iOS] Fixed: restorePurchases caused hang (call never returned). +- [iOS] Fixed: purchase dialog not showing always. +- [iOS] Fixed: completing purchases could fail. +- [iOS] Fixed: restorePurchases caused hang (call never returned). ## 0.3.4+7 -* iOS: Fix typo of the `simulatesAskToBuyInSandbox` key. +- iOS: Fix typo of the `simulatesAskToBuyInSandbox` key. ## 0.3.4+6 -* iOS: Fix the bug that prevent restored subscription transactions from being completed +- iOS: Fix the bug that prevent restored subscription transactions from being completed ## 0.3.4+5 -* Added necessary README docs for getting started with Android. +- Added necessary README docs for getting started with Android. ## 0.3.4+4 -* Update package:e2e -> package:integration_test +- Update package:e2e -> package:integration_test ## 0.3.4+3 -* Fixed typo 'manuelly' for 'manually'. +- Fixed typo 'manuelly' for 'manually'. ## 0.3.4+2 -* Update package:e2e reference to use the local version in the flutter/plugins +- Update package:e2e reference to use the local version in the flutter/plugins repository. ## 0.3.4+1 -* iOS: Fix the bug that `SKPaymentQueueWrapper.transactions` doesn't return all transactions. -* iOS: Fix the app crashes if `InAppPurchaseConnection.instance` is called in the `main()`. +- iOS: Fix the bug that `SKPaymentQueueWrapper.transactions` doesn't return all transactions. +- iOS: Fix the app crashes if `InAppPurchaseConnection.instance` is called in the `main()`. ## 0.3.4 -* Expose SKError code to client apps. +- Expose SKError code to client apps. ## 0.3.3+2 -* Post-v2 Android embedding cleanups. +- Post-v2 Android embedding cleanups. ## 0.3.3+1 -* Update documentations for `InAppPurchase.completePurchase` and update README. +- Update documentations for `InAppPurchase.completePurchase` and update README. ## 0.3.3 -* Introduce `SKPaymentQueueWrapper.transactions`. +- Introduce `SKPaymentQueueWrapper.transactions`. ## 0.3.2+2 -* Fix CocoaPods podspec lint warnings. +- Fix CocoaPods podspec lint warnings. ## 0.3.2+1 -* iOS: Fix only transactions with SKPaymentTransactionStatePurchased and SKPaymentTransactionStateFailed can be finished. -* iOS: Only one pending transaction of a given product is allowed. +- iOS: Fix only transactions with SKPaymentTransactionStatePurchased and SKPaymentTransactionStateFailed can be finished. +- iOS: Only one pending transaction of a given product is allowed. ## 0.3.2 -* Remove Android dependencies fallback. -* Require Flutter SDK 1.12.13+hotfix.5 or greater. +- Remove Android dependencies fallback. +- Require Flutter SDK 1.12.13+hotfix.5 or greater. ## 0.3.1+2 -* Fix potential casting crash on Android v1 embedding when registering life cycle callbacks. -* Remove hard-coded legacy xcode build setting. +- Fix potential casting crash on Android v1 embedding when registering life cycle callbacks. +- Remove hard-coded legacy xcode build setting. ## 0.3.1+1 -* Add `pedantic` to dev_dependency. +- Add `pedantic` to dev_dependency. ## 0.3.1 -* Android: Fix a bug where the `BillingClient` is disconnected when app goes to the background. -* Android: Make sure the `BillingClient` object is disconnected before the activity is destroyed. -* Android: Fix minor compiler warning. -* Fix typo in CHANGELOG. +- Android: Fix a bug where the `BillingClient` is disconnected when app goes to the background. +- Android: Make sure the `BillingClient` object is disconnected before the activity is destroyed. +- Android: Fix minor compiler warning. +- Fix typo in CHANGELOG. ## 0.3.0+3 -* Fix pendingCompletePurchase flag status to allow to complete purchases. +- Fix pendingCompletePurchase flag status to allow to complete purchases. ## 0.3.0+2 -* Update te example app to avoid using deprecated api. +- Update te example app to avoid using deprecated api. ## 0.3.0+1 -* Fixing usage example. No functional changes. +- Fixing usage example. No functional changes. ## 0.3.0 -* Migrate the `Google Play Library` to 2.0.3. - * Introduce a new class `BillingResultWrapper` which contains a detailed result of a BillingClient operation. - * **[Breaking Change]:** All the BillingClient methods that previously return a `BillingResponse` now return a `BillingResultWrapper`, including: `launchBillingFlow`, `startConnection` and `consumeAsync`. - * **[Breaking Change]:** The `SkuDetailsResponseWrapper` now contains a `billingResult` field in place of `billingResponse` field. - * A `billingResult` field is added to the `PurchasesResultWrapper`. - * Other Updates to the "billing_client_wrappers": - * Updates to the `PurchaseWrapper`: Add `developerPayload`, `purchaseState` and `isAcknowledged` fields. - * Updates to the `SkuDetailsWrapper`: Add `originalPrice` and `originalPriceAmountMicros` fields. - * **[Breaking Change]:** The `BillingClient.queryPurchaseHistory` is updated to return a `PurchasesHistoryResult`, which contains a list of `PurchaseHistoryRecordWrapper` instead of `PurchaseWrapper`. A `PurchaseHistoryRecordWrapper` object has the same fields and values as A `PurchaseWrapper` object, except that a `PurchaseHistoryRecordWrapper` object does not contain `isAutoRenewing`, `orderId` and `packageName`. - * Add a new `BillingClient.acknowledgePurchase` API. Starting from this version, the developer has to acknowledge any purchase on Android using this API within 3 days of purchase, or the user will be refunded. Note that if a product is "consumed" via `BillingClient.consumeAsync`, it is implicitly acknowledged. - * **[Breaking Change]:** Added `enablePendingPurchases` in `BillingClientWrapper`. The application has to call this method before calling `BillingClientWrapper.startConnection`. See [enablePendingPurchases](https://developer.android.com/reference/com/android/billingclient/api/BillingClient.Builder.html#enablependingpurchases) for more information. - * Updates to the "InAppPurchaseConnection": - * **[Breaking Change]:** `InAppPurchaseConnection.completePurchase` now returns a `Future` instead of `Future`. A new optional parameter `{String developerPayload}` has also been added to the API. On Android, this API does not throw an exception anymore, it instead acknowledge the purchase. If a purchase is not completed within 3 days on Android, the user will be refunded. - * **[Breaking Change]:** `InAppPurchaseConnection.consumePurchase` now returns a `Future` instead of `Future`. A new optional parameter `{String developerPayload}` has also been added to the API. - * A new boolean field `pendingCompletePurchase` has been added to the `PurchaseDetails` class. Which can be used as an indicator of whether to call `InAppPurchaseConnection.completePurchase` on the purchase. - * **[Breaking Change]:** Added `enablePendingPurchases` in `InAppPurchaseConnection`. The application has to call this method when initializing the `InAppPurchaseConnection` on Android. See [enablePendingPurchases](https://developer.android.com/reference/com/android/billingclient/api/BillingClient.Builder.html#enablependingpurchases) for more information. - * Misc: Some documentation updates reflecting the `BillingClient` migration and some documentation fixes. - * Refer to [Google Play Billing Library Release Note](https://developer.android.com/google/play/billing/billing_library_releases_notes#release-2_0) for a detailed information on the update. +- Migrate the `Google Play Library` to 2.0.3. + - Introduce a new class `BillingResultWrapper` which contains a detailed result of a BillingClient operation. + - **[Breaking Change]:** All the BillingClient methods that previously return a `BillingResponse` now return a `BillingResultWrapper`, including: `launchBillingFlow`, `startConnection` and `consumeAsync`. + - **[Breaking Change]:** The `SkuDetailsResponseWrapper` now contains a `billingResult` field in place of `billingResponse` field. + - A `billingResult` field is added to the `PurchasesResultWrapper`. + - Other Updates to the "billing_client_wrappers": + - Updates to the `PurchaseWrapper`: Add `developerPayload`, `purchaseState` and `isAcknowledged` fields. + - Updates to the `SkuDetailsWrapper`: Add `originalPrice` and `originalPriceAmountMicros` fields. + - **[Breaking Change]:** The `BillingClient.queryPurchaseHistory` is updated to return a `PurchasesHistoryResult`, which contains a list of `PurchaseHistoryRecordWrapper` instead of `PurchaseWrapper`. A `PurchaseHistoryRecordWrapper` object has the same fields and values as A `PurchaseWrapper` object, except that a `PurchaseHistoryRecordWrapper` object does not contain `isAutoRenewing`, `orderId` and `packageName`. + - Add a new `BillingClient.acknowledgePurchase` API. Starting from this version, the developer has to acknowledge any purchase on Android using this API within 3 days of purchase, or the user will be refunded. Note that if a product is "consumed" via `BillingClient.consumeAsync`, it is implicitly acknowledged. + - **[Breaking Change]:** Added `enablePendingPurchases` in `BillingClientWrapper`. The application has to call this method before calling `BillingClientWrapper.startConnection`. See [enablePendingPurchases](https://developer.android.com/reference/com/android/billingclient/api/BillingClient.Builder.html#enablependingpurchases) for more information. + - Updates to the "InAppPurchaseConnection": + - **[Breaking Change]:** `InAppPurchaseConnection.completePurchase` now returns a `Future` instead of `Future`. A new optional parameter `{String developerPayload}` has also been added to the API. On Android, this API does not throw an exception anymore, it instead acknowledge the purchase. If a purchase is not completed within 3 days on Android, the user will be refunded. + - **[Breaking Change]:** `InAppPurchaseConnection.consumePurchase` now returns a `Future` instead of `Future`. A new optional parameter `{String developerPayload}` has also been added to the API. + - A new boolean field `pendingCompletePurchase` has been added to the `PurchaseDetails` class. Which can be used as an indicator of whether to call `InAppPurchaseConnection.completePurchase` on the purchase. + - **[Breaking Change]:** Added `enablePendingPurchases` in `InAppPurchaseConnection`. The application has to call this method when initializing the `InAppPurchaseConnection` on Android. See [enablePendingPurchases](https://developer.android.com/reference/com/android/billingclient/api/BillingClient.Builder.html#enablependingpurchases) for more information. + - Misc: Some documentation updates reflecting the `BillingClient` migration and some documentation fixes. + - Refer to [Google Play Billing Library Release Note](https://developer.android.com/google/play/billing/billing_library_releases_notes#release-2_0) for a detailed information on the update. ## 0.2.2+6 -* Correct a comment. +- Correct a comment. ## 0.2.2+5 -* Update version of json_annotation to ^3.0.0 and json_serializable to ^3.2.0. Resolve conflicts with other packages e.g. flutter_tools from sdk. +- Update version of json_annotation to ^3.0.0 and json_serializable to ^3.2.0. Resolve conflicts with other packages e.g. flutter_tools from sdk. ## 0.2.2+4 -* Remove the deprecated `author:` field from pubspec.yaml -* Migrate the plugin to the pubspec platforms manifest. -* Require Flutter SDK 1.10.0 or greater. +- Remove the deprecated `author:` field from pubspec.yaml +- Migrate the plugin to the pubspec platforms manifest. +- Require Flutter SDK 1.10.0 or greater. ## 0.2.2+3 -* Fix failing pedantic lints. None of these fixes should have any change in +- Fix failing pedantic lints. None of these fixes should have any change in functionality. ## 0.2.2+2 -* Include lifecycle dependency as a compileOnly one on Android to resolve +- Include lifecycle dependency as a compileOnly one on Android to resolve potential version conflicts with other transitive libraries. ## 0.2.2+1 -* Android: Use android.arch.lifecycle instead of androidx.lifecycle:lifecycle in `build.gradle` to support apps that has not been migrated to AndroidX. +- Android: Use android.arch.lifecycle instead of androidx.lifecycle:lifecycle in `build.gradle` to support apps that has not been migrated to AndroidX. ## 0.2.2 -* Support the v2 Android embedder. -* Update to AndroidX. -* Migrate to using the new e2e test binding. -* Add a e2e test. +- Support the v2 Android embedder. +- Update to AndroidX. +- Migrate to using the new e2e test binding. +- Add a e2e test. ## 0.2.1+5 -* Define clang module for iOS. -* Fix iOS build warning. +- Define clang module for iOS. +- Fix iOS build warning. ## 0.2.1+4 -* Update and migrate iOS example project. +- Update and migrate iOS example project. ## 0.2.1+3 -* Android : Improved testability. +- Android : Improved testability. ## 0.2.1+2 -* Android: Require a non-null Activity to use the `launchBillingFlow` method. +- Android: Require a non-null Activity to use the `launchBillingFlow` method. ## 0.2.1+1 -* Remove skipped driver test. +- Remove skipped driver test. ## 0.2.1 -* iOS: Add currencyCode to priceLocale on productDetails. +- iOS: Add currencyCode to priceLocale on productDetails. ## 0.2.0+8 -* Add dependency on `androidx.annotation:annotation:1.0.0`. +- Add dependency on `androidx.annotation:annotation:1.0.0`. ## 0.2.0+7 -* Make Gradle version compatible with the Android Gradle plugin version. +- Make Gradle version compatible with the Android Gradle plugin version. ## 0.2.0+6 -* Add missing `hashCode` implementations. +- Add missing `hashCode` implementations. ## 0.2.0+5 -* iOS: Support unsupported UserInfo value types on NSError. +- iOS: Support unsupported UserInfo value types on NSError. ## 0.2.0+4 -* Fixed code error in `README.md` and adjusted links to work on Pub. +- Fixed code error in `README.md` and adjusted links to work on Pub. ## 0.2.0+3 -* Update the `README.md` so that the code samples compile with the latest Flutter/Dart version. +- Update the `README.md` so that the code samples compile with the latest Flutter/Dart version. ## 0.2.0+2 -* Fix a google_play_connection purchase update listener regression introduced in 0.2.0+1. +- Fix a google_play_connection purchase update listener regression introduced in 0.2.0+1. ## 0.2.0+1 -* Fix an issue the type is not casted before passing to `PurchasesResultWrapper.fromJson`. +- Fix an issue the type is not casted before passing to `PurchasesResultWrapper.fromJson`. ## 0.2.0 -* [Breaking Change] Rename 'PurchaseError' to 'IAPError'. -* [Breaking Change] Rename 'PurchaseSource' to 'IAPSource'. +- [Breaking Change] Rename 'PurchaseError' to 'IAPError'. +- [Breaking Change] Rename 'PurchaseSource' to 'IAPSource'. ## 0.1.1+3 -* Expanded description in `pubspec.yaml` and fixed typo in `README.md`. +- Expanded description in `pubspec.yaml` and fixed typo in `README.md`. ## 0.1.1+2 -* Add missing template type parameter to `invokeMethod` calls. -* Bump minimum Flutter version to 1.5.0. -* Replace invokeMethod with invokeMapMethod wherever necessary. +- Add missing template type parameter to `invokeMethod` calls. +- Bump minimum Flutter version to 1.5.0. +- Replace invokeMethod with invokeMapMethod wherever necessary. ## 0.1.1+1 -* Make `AdditionalSteps`(Used in the unit test) a void function. +- Make `AdditionalSteps`(Used in the unit test) a void function. ## 0.1.1 -* Some error messages from iOS are slightly changed. -* `ProductDetailsResponse` returned by `queryProductDetails()` now contains an `PurchaseError` object that represents any error that might occurred during the request. -* If the device is not connected to the internet, `queryPastPurchases()` on iOS now have the error stored in the response instead of throwing. -* Clean up minor iOS warning. -* Example app shows how to handle error when calling `queryProductDetails()` and `queryProductDetails()`. +- Some error messages from iOS are slightly changed. +- `ProductDetailsResponse` returned by `queryProductDetails()` now contains an `PurchaseError` object that represents any error that might occurred during the request. +- If the device is not connected to the internet, `queryPastPurchases()` on iOS now have the error stored in the response instead of throwing. +- Clean up minor iOS warning. +- Example app shows how to handle error when calling `queryProductDetails()` and `queryProductDetails()`. ## 0.1.0+4 -* Change the `buy` methods to return `Future` instead of `void` in order +- Change the `buy` methods to return `Future` instead of `void` in order to propagate `launchBillingFlow` failures up through `google_play_connection`. ## 0.1.0+3 -* Guard against multiple onSetupFinished() calls. +- Guard against multiple onSetupFinished() calls. ## 0.1.0+2 -* Fix bug where error only purchases updates weren't propagated correctly in +- Fix bug where error only purchases updates weren't propagated correctly in `google_play_connection.dart`. ## 0.1.0+1 -* Add more consumable handling to the example app. +- Add more consumable handling to the example app. ## 0.1.0 Beta release. -* Ability to list products, load previous purchases, and make purchases. -* Simplified Dart API that's been unified for ease of use. -* Platform-specific APIs more directly exposing `StoreKit` and `BillingClient`. +- Ability to list products, load previous purchases, and make purchases. +- Simplified Dart API that's been unified for ease of use. +- Platform-specific APIs more directly exposing `StoreKit` and `BillingClient`. Includes: -* 5ba657dc [in_app_purchase] Remove extraneous download logic (#1560) -* 01bb8796 [in_app_purchase] Minor doc updates (#1555) -* 1a4d493f [in_app_purchase] Only fetch owned purchases (#1540) -* d63c51cf [in_app_purchase] Add auto-consume errors to PurchaseDetails (#1537) -* 959da97f [in_app_purchase] Minor doc updates (#1536) -* b82ae1a6 [in_app_purchase] Rename the unified API (#1517) -* d1ad723a [in_app_purchase]remove SKDownloadWrapper and related code. (#1474) -* 7c1e8b8a [in_app_purchase]make payment unified APIs (#1421) -* 80233db6 [in_app_purchase] Add references to the original object for PurchaseDetails and ProductDetails (#1448) -* 8c180f0d [in_app_purchase]load purchase (#1380) -* e9f141bc [in_app_purchase] Iap refactor (#1381) -* d3b3d60c add driver test command to cirrus (#1342) -* aee12523 [in_app_purchase] refactoring and tests (#1322) -* 6d7b4592 [in_app_purchase] Adds Dart BillingClient APIs for loading purchases (#1286) -* 5567a9c8 [in_app_purchase]retrieve receipt (#1303) -* 3475f1b7 [in_app_purchase]restore purchases (#1299) -* a533148d [in_app_purchase] payment queue dart ios (#1249) -* 10030840 [in_app_purchase] Minor bugfixes and code cleanup (#1284) -* 347f508d [in_app_purchase] Fix CI formatting errors. (#1281) -* fad02d87 [in_app_purchase] Java API for querying purchases (#1259) -* bc501915 [In_app_purchase]SKProduct related fixes (#1252) -* f92ba3a1 IAP make payment objc (#1231) -* 62b82522 [IAP] Add the Dart API for launchBillingFlow (#1232) -* b40a4acf [IAP] Add Java call for launchBillingFlow (#1230) -* 4ff06cd1 [In_app_purchase]remove categories (#1222) -* 0e72ca56 [In_app_purchase]fix requesthandler crash (#1199) -* 81dff2be Iap getproductlist basic draft (#1169) -* db139b28 Iap iOS add payment dart wrappers (#1178) -* 2e5fbb9b Fix the param map passed down to the platform channel when calling querySkuDetails (#1194) -* 4a84bac1 Mark some packages as unpublishable (#1193) -* 51696552 Add a gradle warning to the AndroidX plugins (#1138) -* 832ab832 Iap add payment objc translators (#1172) -* d0e615cf Revert "IAP add payment translators in objc (#1126)" (#1171) -* 09a5a36e IAP add payment translators in objc (#1126) -* a100fbf9 Expose nslocale and expose currencySymbol instead of currencyCode to match android (#1162) -* 1c982efd Using json serializer for skproduct wrapper and related classes (#1147) -* 3039a261 Iap productlist ios (#1068) -* 2a1593da [IAP] Update dev deps to match flutter_driver (#1118) -* 9f87cbe5 [IAP] Update README (#1112) -* 59e84d85 Migrate independent plugins to AndroidX (#1103) -* a027ccd6 [IAP] Generate boilerplate serializers (#1090) -* 909cf1c2 [IAP] Fetch SkuDetails from Google Play (#1084) -* 6bbaa7e5 [IAP] Add missing license headers (#1083) -* 5347e877 [IAP] Clean up Dart unit tests (#1082) -* fe03e407 [IAP] Check if the payment processor is available (#1057) -* 43ee28cf Fix `Manifest versionCode not found` (#1076) -* 4d702ad7 Supress `strong_mode_implicit_dynamic_method` for `invokeMethod` calls. (#1065) -* 809ccde7 Doc and build script updates to the IAP plugin (#1024) -* 052b71a9 Update the IAP README (#933) -* 54f9c4e2 Upgrade Android Gradle Plugin to 3.2.1 (#916) -* ced3e99d Set all gradle-wrapper versions to 4.10.2 (#915) -* eaa1388b Reconfigure Cirrus to use clang 7 (#905) -* 9b153920 Update gradle dependencies. (#881) -* 1aef7d92 Enable lint unnecessary_new (#701) +- 5ba657dc [in_app_purchase] Remove extraneous download logic (#1560) +- 01bb8796 [in_app_purchase] Minor doc updates (#1555) +- 1a4d493f [in_app_purchase] Only fetch owned purchases (#1540) +- d63c51cf [in_app_purchase] Add auto-consume errors to PurchaseDetails (#1537) +- 959da97f [in_app_purchase] Minor doc updates (#1536) +- b82ae1a6 [in_app_purchase] Rename the unified API (#1517) +- d1ad723a [in_app_purchase]remove SKDownloadWrapper and related code. (#1474) +- 7c1e8b8a [in_app_purchase]make payment unified APIs (#1421) +- 80233db6 [in_app_purchase] Add references to the original object for PurchaseDetails and ProductDetails (#1448) +- 8c180f0d [in_app_purchase]load purchase (#1380) +- e9f141bc [in_app_purchase] Iap refactor (#1381) +- d3b3d60c add driver test command to cirrus (#1342) +- aee12523 [in_app_purchase] refactoring and tests (#1322) +- 6d7b4592 [in_app_purchase] Adds Dart BillingClient APIs for loading purchases (#1286) +- 5567a9c8 [in_app_purchase]retrieve receipt (#1303) +- 3475f1b7 [in_app_purchase]restore purchases (#1299) +- a533148d [in_app_purchase] payment queue dart ios (#1249) +- 10030840 [in_app_purchase] Minor bugfixes and code cleanup (#1284) +- 347f508d [in_app_purchase] Fix CI formatting errors. (#1281) +- fad02d87 [in_app_purchase] Java API for querying purchases (#1259) +- bc501915 [In_app_purchase]SKProduct related fixes (#1252) +- f92ba3a1 IAP make payment objc (#1231) +- 62b82522 [IAP] Add the Dart API for launchBillingFlow (#1232) +- b40a4acf [IAP] Add Java call for launchBillingFlow (#1230) +- 4ff06cd1 [In_app_purchase]remove categories (#1222) +- 0e72ca56 [In_app_purchase]fix requesthandler crash (#1199) +- 81dff2be Iap getproductlist basic draft (#1169) +- db139b28 Iap iOS add payment dart wrappers (#1178) +- 2e5fbb9b Fix the param map passed down to the platform channel when calling querySkuDetails (#1194) +- 4a84bac1 Mark some packages as unpublishable (#1193) +- 51696552 Add a gradle warning to the AndroidX plugins (#1138) +- 832ab832 Iap add payment objc translators (#1172) +- d0e615cf Revert "IAP add payment translators in objc (#1126)" (#1171) +- 09a5a36e IAP add payment translators in objc (#1126) +- a100fbf9 Expose nslocale and expose currencySymbol instead of currencyCode to match android (#1162) +- 1c982efd Using json serializer for skproduct wrapper and related classes (#1147) +- 3039a261 Iap productlist ios (#1068) +- 2a1593da [IAP] Update dev deps to match flutter_driver (#1118) +- 9f87cbe5 [IAP] Update README (#1112) +- 59e84d85 Migrate independent plugins to AndroidX (#1103) +- a027ccd6 [IAP] Generate boilerplate serializers (#1090) +- 909cf1c2 [IAP] Fetch SkuDetails from Google Play (#1084) +- 6bbaa7e5 [IAP] Add missing license headers (#1083) +- 5347e877 [IAP] Clean up Dart unit tests (#1082) +- fe03e407 [IAP] Check if the payment processor is available (#1057) +- 43ee28cf Fix `Manifest versionCode not found` (#1076) +- 4d702ad7 Supress `strong_mode_implicit_dynamic_method` for `invokeMethod` calls. (#1065) +- 809ccde7 Doc and build script updates to the IAP plugin (#1024) +- 052b71a9 Update the IAP README (#933) +- 54f9c4e2 Upgrade Android Gradle Plugin to 3.2.1 (#916) +- ced3e99d Set all gradle-wrapper versions to 4.10.2 (#915) +- eaa1388b Reconfigure Cirrus to use clang 7 (#905) +- 9b153920 Update gradle dependencies. (#881) +- 1aef7d92 Enable lint unnecessary_new (#701) ## 0.0.2 -* Added missing flutter_test package dependency. -* Added missing flutter version requirements. +- Added missing flutter_test package dependency. +- Added missing flutter version requirements. ## 0.0.1 -* Initial release. +- Initial release.