From 1b55a5e2806f0fb8dcef3f53c948629d24439fd3 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Fri, 4 Oct 2024 10:35:42 -0400 Subject: [PATCH 1/3] Update definition and regenerate --- .../plugins/inapppurchase/Messages.java | 1123 +++++++++++------ ...ling_only_reporting_details_wrapper.g.dart | 2 +- .../billing_client_wrapper.dart | 2 +- .../billing_config_wrapper.g.dart | 2 +- .../billing_response_wrapper.g.dart | 2 +- ...time_purchase_offer_details_wrapper.g.dart | 2 +- .../purchase_wrapper.g.dart | 8 +- .../subscription_offer_details_wrapper.g.dart | 6 +- .../lib/src/messages.g.dart | 728 ++++++----- .../pigeons/messages.dart | 46 +- .../in_app_purchase_android/pubspec.yaml | 2 +- .../billing_client_wrapper_test.mocks.dart | 130 +- 12 files changed, 1183 insertions(+), 870 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 0602260e72f4..cef3e316c3d6 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 (v17.3.0), do not edit directly. +// Autogenerated from Pigeon (v22.4.2), do not edit directly. // See also: https://pub.dev/packages/pigeon package io.flutter.plugins.inapppurchase; @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Objects; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) @@ -46,7 +47,7 @@ public FlutterError(@NonNull String code, @Nullable String message, @Nullable Ob @NonNull protected static ArrayList wrapError(@NonNull Throwable exception) { - ArrayList errorList = new ArrayList(3); + ArrayList errorList = new ArrayList<>(3); if (exception instanceof FlutterError) { FlutterError error = (FlutterError) exception; errorList.add(error.code); @@ -78,7 +79,7 @@ public enum PlatformProductType { final int index; - private PlatformProductType(final int index) { + PlatformProductType(final int index) { this.index = index; } } @@ -98,7 +99,7 @@ public enum PlatformBillingChoiceMode { final int index; - private PlatformBillingChoiceMode(final int index) { + PlatformBillingChoiceMode(final int index) { this.index = index; } } @@ -111,7 +112,7 @@ public enum PlatformPurchaseState { final int index; - private PlatformPurchaseState(final int index) { + PlatformPurchaseState(final int index) { this.index = index; } } @@ -124,7 +125,7 @@ public enum PlatformRecurrenceMode { final int index; - private PlatformRecurrenceMode(final int index) { + PlatformRecurrenceMode(final int index) { this.index = index; } } @@ -164,6 +165,23 @@ public void setProductType(@NonNull PlatformProductType setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ PlatformQueryProduct() {} + @Override + public boolean equals(Object o) { + 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); + } + + @Override + public int hashCode() { + return Objects.hash(productId, productType); + } + public static final class Builder { private @Nullable String productId; @@ -192,18 +210,18 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(2); + ArrayList toListResult = new ArrayList<>(2); toListResult.add(productId); - toListResult.add(productType == null ? null : productType.index); + toListResult.add(productType); return toListResult; } - static @NonNull PlatformQueryProduct fromList(@NonNull ArrayList list) { + static @NonNull PlatformQueryProduct fromList(@NonNull ArrayList pigeonVar_list) { PlatformQueryProduct pigeonResult = new PlatformQueryProduct(); - Object productId = list.get(0); + Object productId = pigeonVar_list.get(0); pigeonResult.setProductId((String) productId); - Object productType = list.get(1); - pigeonResult.setProductType(PlatformProductType.values()[(int) productType]); + Object productType = pigeonVar_list.get(1); + pigeonResult.setProductType((PlatformProductType) productType); return pigeonResult; } } @@ -234,6 +252,24 @@ public void setObfuscatedProfileId(@Nullable String setterArg) { this.obfuscatedProfileId = setterArg; } + @Override + public boolean equals(Object o) { + 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); + } + + @Override + public int hashCode() { + return Objects.hash(obfuscatedAccountId, obfuscatedProfileId); + } + public static final class Builder { private @Nullable String obfuscatedAccountId; @@ -262,17 +298,17 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(2); + ArrayList toListResult = new ArrayList<>(2); toListResult.add(obfuscatedAccountId); toListResult.add(obfuscatedProfileId); return toListResult; } - static @NonNull PlatformAccountIdentifiers fromList(@NonNull ArrayList list) { + static @NonNull PlatformAccountIdentifiers fromList(@NonNull ArrayList pigeonVar_list) { PlatformAccountIdentifiers pigeonResult = new PlatformAccountIdentifiers(); - Object obfuscatedAccountId = list.get(0); + Object obfuscatedAccountId = pigeonVar_list.get(0); pigeonResult.setObfuscatedAccountId((String) obfuscatedAccountId); - Object obfuscatedProfileId = list.get(1); + Object obfuscatedProfileId = pigeonVar_list.get(1); pigeonResult.setObfuscatedProfileId((String) obfuscatedProfileId); return pigeonResult; } @@ -313,6 +349,23 @@ public void setDebugMessage(@NonNull String setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ PlatformBillingResult() {} + @Override + public boolean equals(Object o) { + 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); + } + + @Override + public int hashCode() { + return Objects.hash(responseCode, debugMessage); + } + public static final class Builder { private @Nullable Long responseCode; @@ -341,20 +394,17 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(2); + ArrayList toListResult = new ArrayList<>(2); toListResult.add(responseCode); toListResult.add(debugMessage); return toListResult; } - static @NonNull PlatformBillingResult fromList(@NonNull ArrayList list) { + static @NonNull PlatformBillingResult fromList(@NonNull ArrayList pigeonVar_list) { PlatformBillingResult pigeonResult = new PlatformBillingResult(); - Object responseCode = list.get(0); - pigeonResult.setResponseCode( - (responseCode == null) - ? null - : ((responseCode instanceof Integer) ? (Integer) responseCode : (Long) responseCode)); - Object debugMessage = list.get(1); + Object responseCode = pigeonVar_list.get(0); + pigeonResult.setResponseCode((Long) responseCode); + Object debugMessage = pigeonVar_list.get(1); pigeonResult.setDebugMessage((String) debugMessage); return pigeonResult; } @@ -408,6 +458,25 @@ public void setPriceCurrencyCode(@NonNull String setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ PlatformOneTimePurchaseOfferDetails() {} + @Override + public boolean equals(Object o) { + 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); + } + + @Override + public int hashCode() { + return Objects.hash(priceAmountMicros, formattedPrice, priceCurrencyCode); + } + public static final class Builder { private @Nullable Long priceAmountMicros; @@ -446,25 +515,21 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(3); + ArrayList toListResult = new ArrayList<>(3); toListResult.add(priceAmountMicros); toListResult.add(formattedPrice); toListResult.add(priceCurrencyCode); return toListResult; } - static @NonNull PlatformOneTimePurchaseOfferDetails fromList(@NonNull ArrayList list) { + static @NonNull PlatformOneTimePurchaseOfferDetails fromList( + @NonNull ArrayList pigeonVar_list) { PlatformOneTimePurchaseOfferDetails pigeonResult = new PlatformOneTimePurchaseOfferDetails(); - Object priceAmountMicros = list.get(0); - pigeonResult.setPriceAmountMicros( - (priceAmountMicros == null) - ? null - : ((priceAmountMicros instanceof Integer) - ? (Integer) priceAmountMicros - : (Long) priceAmountMicros)); - Object formattedPrice = list.get(1); + Object priceAmountMicros = pigeonVar_list.get(0); + pigeonResult.setPriceAmountMicros((Long) priceAmountMicros); + Object formattedPrice = pigeonVar_list.get(1); pigeonResult.setFormattedPrice((String) formattedPrice); - Object priceCurrencyCode = list.get(2); + Object priceCurrencyCode = pigeonVar_list.get(2); pigeonResult.setPriceCurrencyCode((String) priceCurrencyCode); return pigeonResult; } @@ -566,6 +631,36 @@ public void setSubscriptionOfferDetails( /** Constructor is non-public to enforce null safety; use Builder. */ PlatformProductDetails() {} + @Override + public boolean equals(Object o) { + 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); + } + + @Override + public int hashCode() { + return Objects.hash( + description, + name, + productId, + productType, + title, + oneTimePurchaseOfferDetails, + subscriptionOfferDetails); + } + public static final class Builder { private @Nullable String description; @@ -641,37 +736,33 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(7); + ArrayList toListResult = new ArrayList<>(7); toListResult.add(description); toListResult.add(name); toListResult.add(productId); - toListResult.add(productType == null ? null : productType.index); + toListResult.add(productType); toListResult.add(title); - toListResult.add( - (oneTimePurchaseOfferDetails == null) ? null : oneTimePurchaseOfferDetails.toList()); + toListResult.add(oneTimePurchaseOfferDetails); toListResult.add(subscriptionOfferDetails); return toListResult; } - static @NonNull PlatformProductDetails fromList(@NonNull ArrayList list) { + static @NonNull PlatformProductDetails fromList(@NonNull ArrayList pigeonVar_list) { PlatformProductDetails pigeonResult = new PlatformProductDetails(); - Object description = list.get(0); + Object description = pigeonVar_list.get(0); pigeonResult.setDescription((String) description); - Object name = list.get(1); + Object name = pigeonVar_list.get(1); pigeonResult.setName((String) name); - Object productId = list.get(2); + Object productId = pigeonVar_list.get(2); pigeonResult.setProductId((String) productId); - Object productType = list.get(3); - pigeonResult.setProductType(PlatformProductType.values()[(int) productType]); - Object title = list.get(4); + Object productType = pigeonVar_list.get(3); + pigeonResult.setProductType((PlatformProductType) productType); + Object title = pigeonVar_list.get(4); pigeonResult.setTitle((String) title); - Object oneTimePurchaseOfferDetails = list.get(5); + Object oneTimePurchaseOfferDetails = pigeonVar_list.get(5); pigeonResult.setOneTimePurchaseOfferDetails( - (oneTimePurchaseOfferDetails == null) - ? null - : PlatformOneTimePurchaseOfferDetails.fromList( - (ArrayList) oneTimePurchaseOfferDetails)); - Object subscriptionOfferDetails = list.get(6); + (PlatformOneTimePurchaseOfferDetails) oneTimePurchaseOfferDetails); + Object subscriptionOfferDetails = pigeonVar_list.get(6); pigeonResult.setSubscriptionOfferDetails( (List) subscriptionOfferDetails); return pigeonResult; @@ -714,6 +805,23 @@ public void setProductDetails(@NonNull List setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ PlatformProductDetailsResponse() {} + @Override + public boolean equals(Object o) { + 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); + } + + @Override + public int hashCode() { + return Objects.hash(billingResult, productDetails); + } + public static final class Builder { private @Nullable PlatformBillingResult billingResult; @@ -742,20 +850,18 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(2); - toListResult.add((billingResult == null) ? null : billingResult.toList()); + ArrayList toListResult = new ArrayList<>(2); + toListResult.add(billingResult); toListResult.add(productDetails); return toListResult; } - static @NonNull PlatformProductDetailsResponse fromList(@NonNull ArrayList list) { + static @NonNull PlatformProductDetailsResponse fromList( + @NonNull ArrayList pigeonVar_list) { PlatformProductDetailsResponse pigeonResult = new PlatformProductDetailsResponse(); - Object billingResult = list.get(0); - pigeonResult.setBillingResult( - (billingResult == null) - ? null - : PlatformBillingResult.fromList((ArrayList) billingResult)); - Object productDetails = list.get(1); + Object billingResult = pigeonVar_list.get(0); + pigeonResult.setBillingResult((PlatformBillingResult) billingResult); + Object productDetails = pigeonVar_list.get(1); pigeonResult.setProductDetails((List) productDetails); return pigeonResult; } @@ -797,6 +903,25 @@ public void setExternalTransactionToken(@NonNull String setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ PlatformAlternativeBillingOnlyReportingDetailsResponse() {} + @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); + } + + @Override + public int hashCode() { + return Objects.hash(billingResult, externalTransactionToken); + } + public static final class Builder { private @Nullable PlatformBillingResult billingResult; @@ -826,22 +951,19 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(2); - toListResult.add((billingResult == null) ? null : billingResult.toList()); + ArrayList toListResult = new ArrayList<>(2); + toListResult.add(billingResult); toListResult.add(externalTransactionToken); return toListResult; } static @NonNull PlatformAlternativeBillingOnlyReportingDetailsResponse fromList( - @NonNull ArrayList list) { + @NonNull ArrayList pigeonVar_list) { PlatformAlternativeBillingOnlyReportingDetailsResponse pigeonResult = new PlatformAlternativeBillingOnlyReportingDetailsResponse(); - Object billingResult = list.get(0); - pigeonResult.setBillingResult( - (billingResult == null) - ? null - : PlatformBillingResult.fromList((ArrayList) billingResult)); - Object externalTransactionToken = list.get(1); + Object billingResult = pigeonVar_list.get(0); + pigeonResult.setBillingResult((PlatformBillingResult) billingResult); + Object externalTransactionToken = pigeonVar_list.get(1); pigeonResult.setExternalTransactionToken((String) externalTransactionToken); return pigeonResult; } @@ -883,6 +1005,23 @@ public void setCountryCode(@NonNull String setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ PlatformBillingConfigResponse() {} + @Override + public boolean equals(Object o) { + 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); + } + + @Override + public int hashCode() { + return Objects.hash(billingResult, countryCode); + } + public static final class Builder { private @Nullable PlatformBillingResult billingResult; @@ -911,20 +1050,18 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(2); - toListResult.add((billingResult == null) ? null : billingResult.toList()); + ArrayList toListResult = new ArrayList<>(2); + toListResult.add(billingResult); toListResult.add(countryCode); return toListResult; } - static @NonNull PlatformBillingConfigResponse fromList(@NonNull ArrayList list) { + static @NonNull PlatformBillingConfigResponse fromList( + @NonNull ArrayList pigeonVar_list) { PlatformBillingConfigResponse pigeonResult = new PlatformBillingConfigResponse(); - Object billingResult = list.get(0); - pigeonResult.setBillingResult( - (billingResult == null) - ? null - : PlatformBillingResult.fromList((ArrayList) billingResult)); - Object countryCode = list.get(1); + Object billingResult = pigeonVar_list.get(0); + pigeonResult.setBillingResult((PlatformBillingResult) billingResult); + Object countryCode = pigeonVar_list.get(1); pigeonResult.setCountryCode((String) countryCode); return pigeonResult; } @@ -1028,6 +1165,38 @@ public void setPurchaseToken(@Nullable String setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ PlatformBillingFlowParams() {} + @Override + 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); + } + + @Override + public int hashCode() { + return Objects.hash( + product, + prorationMode, + replacementMode, + offerToken, + accountId, + obfuscatedProfileId, + oldProduct, + purchaseToken); + } + public static final class Builder { private @Nullable String product; @@ -1110,7 +1279,7 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(8); + ArrayList toListResult = new ArrayList<>(8); toListResult.add(product); toListResult.add(prorationMode); toListResult.add(replacementMode); @@ -1122,33 +1291,23 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformBillingFlowParams fromList(@NonNull ArrayList list) { + static @NonNull PlatformBillingFlowParams fromList(@NonNull ArrayList pigeonVar_list) { PlatformBillingFlowParams pigeonResult = new PlatformBillingFlowParams(); - Object product = list.get(0); + Object product = pigeonVar_list.get(0); pigeonResult.setProduct((String) product); - Object prorationMode = list.get(1); - pigeonResult.setProrationMode( - (prorationMode == null) - ? null - : ((prorationMode instanceof Integer) - ? (Integer) prorationMode - : (Long) prorationMode)); - Object replacementMode = list.get(2); - pigeonResult.setReplacementMode( - (replacementMode == null) - ? null - : ((replacementMode instanceof Integer) - ? (Integer) replacementMode - : (Long) replacementMode)); - Object offerToken = list.get(3); + Object prorationMode = pigeonVar_list.get(1); + pigeonResult.setProrationMode((Long) prorationMode); + Object replacementMode = pigeonVar_list.get(2); + pigeonResult.setReplacementMode((Long) replacementMode); + Object offerToken = pigeonVar_list.get(3); pigeonResult.setOfferToken((String) offerToken); - Object accountId = list.get(4); + Object accountId = pigeonVar_list.get(4); pigeonResult.setAccountId((String) accountId); - Object obfuscatedProfileId = list.get(5); + Object obfuscatedProfileId = pigeonVar_list.get(5); pigeonResult.setObfuscatedProfileId((String) obfuscatedProfileId); - Object oldProduct = list.get(6); + Object oldProduct = pigeonVar_list.get(6); pigeonResult.setOldProduct((String) oldProduct); - Object purchaseToken = list.get(7); + Object purchaseToken = pigeonVar_list.get(7); pigeonResult.setPurchaseToken((String) purchaseToken); return pigeonResult; } @@ -1241,6 +1400,34 @@ public void setPriceCurrencyCode(@NonNull String setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ PlatformPricingPhase() {} + @Override + public boolean equals(Object o) { + 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); + } + + @Override + public int hashCode() { + return Objects.hash( + billingCycleCount, + recurrenceMode, + priceAmountMicros, + billingPeriod, + formattedPrice, + priceCurrencyCode); + } + public static final class Builder { private @Nullable Long billingCycleCount; @@ -1305,9 +1492,9 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(6); + ArrayList toListResult = new ArrayList<>(6); toListResult.add(billingCycleCount); - toListResult.add(recurrenceMode == null ? null : recurrenceMode.index); + toListResult.add(recurrenceMode); toListResult.add(priceAmountMicros); toListResult.add(billingPeriod); toListResult.add(formattedPrice); @@ -1315,29 +1502,19 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPricingPhase fromList(@NonNull ArrayList list) { + static @NonNull PlatformPricingPhase fromList(@NonNull ArrayList pigeonVar_list) { PlatformPricingPhase pigeonResult = new PlatformPricingPhase(); - Object billingCycleCount = list.get(0); - pigeonResult.setBillingCycleCount( - (billingCycleCount == null) - ? null - : ((billingCycleCount instanceof Integer) - ? (Integer) billingCycleCount - : (Long) billingCycleCount)); - Object recurrenceMode = list.get(1); - pigeonResult.setRecurrenceMode(PlatformRecurrenceMode.values()[(int) recurrenceMode]); - Object priceAmountMicros = list.get(2); - pigeonResult.setPriceAmountMicros( - (priceAmountMicros == null) - ? null - : ((priceAmountMicros instanceof Integer) - ? (Integer) priceAmountMicros - : (Long) priceAmountMicros)); - Object billingPeriod = list.get(3); + Object billingCycleCount = pigeonVar_list.get(0); + pigeonResult.setBillingCycleCount((Long) billingCycleCount); + Object recurrenceMode = pigeonVar_list.get(1); + pigeonResult.setRecurrenceMode((PlatformRecurrenceMode) recurrenceMode); + Object priceAmountMicros = pigeonVar_list.get(2); + pigeonResult.setPriceAmountMicros((Long) priceAmountMicros); + Object billingPeriod = pigeonVar_list.get(3); pigeonResult.setBillingPeriod((String) billingPeriod); - Object formattedPrice = list.get(4); + Object formattedPrice = pigeonVar_list.get(4); pigeonResult.setFormattedPrice((String) formattedPrice); - Object priceCurrencyCode = list.get(5); + Object priceCurrencyCode = pigeonVar_list.get(5); pigeonResult.setPriceCurrencyCode((String) priceCurrencyCode); return pigeonResult; } @@ -1517,6 +1694,48 @@ public void setAccountIdentifiers(@Nullable PlatformAccountIdentifiers 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; + } + 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); + } + + @Override + public int hashCode() { + return Objects.hash( + orderId, + packageName, + purchaseTime, + purchaseToken, + signature, + products, + isAutoRenewing, + originalJson, + developerPayload, + isAcknowledged, + quantity, + purchaseState, + accountIdentifiers); + } + public static final class Builder { private @Nullable String orderId; @@ -1645,7 +1864,7 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(13); + ArrayList toListResult = new ArrayList<>(13); toListResult.add(orderId); toListResult.add(packageName); toListResult.add(purchaseTime); @@ -1657,48 +1876,39 @@ ArrayList toList() { toListResult.add(developerPayload); toListResult.add(isAcknowledged); toListResult.add(quantity); - toListResult.add(purchaseState == null ? null : purchaseState.index); - toListResult.add((accountIdentifiers == null) ? null : accountIdentifiers.toList()); + toListResult.add(purchaseState); + toListResult.add(accountIdentifiers); return toListResult; } - static @NonNull PlatformPurchase fromList(@NonNull ArrayList list) { + static @NonNull PlatformPurchase fromList(@NonNull ArrayList pigeonVar_list) { PlatformPurchase pigeonResult = new PlatformPurchase(); - Object orderId = list.get(0); + Object orderId = pigeonVar_list.get(0); pigeonResult.setOrderId((String) orderId); - Object packageName = list.get(1); + Object packageName = pigeonVar_list.get(1); pigeonResult.setPackageName((String) packageName); - Object purchaseTime = list.get(2); - pigeonResult.setPurchaseTime( - (purchaseTime == null) - ? null - : ((purchaseTime instanceof Integer) ? (Integer) purchaseTime : (Long) purchaseTime)); - Object purchaseToken = list.get(3); + Object purchaseTime = pigeonVar_list.get(2); + pigeonResult.setPurchaseTime((Long) purchaseTime); + Object purchaseToken = pigeonVar_list.get(3); pigeonResult.setPurchaseToken((String) purchaseToken); - Object signature = list.get(4); + Object signature = pigeonVar_list.get(4); pigeonResult.setSignature((String) signature); - Object products = list.get(5); + Object products = pigeonVar_list.get(5); pigeonResult.setProducts((List) products); - Object isAutoRenewing = list.get(6); + Object isAutoRenewing = pigeonVar_list.get(6); pigeonResult.setIsAutoRenewing((Boolean) isAutoRenewing); - Object originalJson = list.get(7); + Object originalJson = pigeonVar_list.get(7); pigeonResult.setOriginalJson((String) originalJson); - Object developerPayload = list.get(8); + Object developerPayload = pigeonVar_list.get(8); pigeonResult.setDeveloperPayload((String) developerPayload); - Object isAcknowledged = list.get(9); + Object isAcknowledged = pigeonVar_list.get(9); pigeonResult.setIsAcknowledged((Boolean) isAcknowledged); - Object quantity = list.get(10); - pigeonResult.setQuantity( - (quantity == null) - ? null - : ((quantity instanceof Integer) ? (Integer) quantity : (Long) quantity)); - Object purchaseState = list.get(11); - pigeonResult.setPurchaseState(PlatformPurchaseState.values()[(int) purchaseState]); - Object accountIdentifiers = list.get(12); - pigeonResult.setAccountIdentifiers( - (accountIdentifiers == null) - ? null - : PlatformAccountIdentifiers.fromList((ArrayList) accountIdentifiers)); + Object quantity = pigeonVar_list.get(10); + pigeonResult.setQuantity((Long) quantity); + Object purchaseState = pigeonVar_list.get(11); + pigeonResult.setPurchaseState((PlatformPurchaseState) purchaseState); + Object accountIdentifiers = pigeonVar_list.get(12); + pigeonResult.setAccountIdentifiers((PlatformAccountIdentifiers) accountIdentifiers); return pigeonResult; } } @@ -1802,6 +2012,36 @@ public void setProducts(@NonNull List setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ PlatformPurchaseHistoryRecord() {} + @Override + public boolean equals(Object o) { + 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); + } + + @Override + public int hashCode() { + return Objects.hash( + quantity, + purchaseTime, + developerPayload, + originalJson, + purchaseToken, + signature, + products); + } + public static final class Builder { private @Nullable Long quantity; @@ -1875,7 +2115,7 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(7); + ArrayList toListResult = new ArrayList<>(7); toListResult.add(quantity); toListResult.add(purchaseTime); toListResult.add(developerPayload); @@ -1886,27 +2126,22 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformPurchaseHistoryRecord fromList(@NonNull ArrayList list) { + static @NonNull PlatformPurchaseHistoryRecord fromList( + @NonNull ArrayList pigeonVar_list) { PlatformPurchaseHistoryRecord pigeonResult = new PlatformPurchaseHistoryRecord(); - Object quantity = list.get(0); - pigeonResult.setQuantity( - (quantity == null) - ? null - : ((quantity instanceof Integer) ? (Integer) quantity : (Long) quantity)); - Object purchaseTime = list.get(1); - pigeonResult.setPurchaseTime( - (purchaseTime == null) - ? null - : ((purchaseTime instanceof Integer) ? (Integer) purchaseTime : (Long) purchaseTime)); - Object developerPayload = list.get(2); + Object quantity = pigeonVar_list.get(0); + pigeonResult.setQuantity((Long) quantity); + Object purchaseTime = pigeonVar_list.get(1); + pigeonResult.setPurchaseTime((Long) purchaseTime); + Object developerPayload = pigeonVar_list.get(2); pigeonResult.setDeveloperPayload((String) developerPayload); - Object originalJson = list.get(3); + Object originalJson = pigeonVar_list.get(3); pigeonResult.setOriginalJson((String) originalJson); - Object purchaseToken = list.get(4); + Object purchaseToken = pigeonVar_list.get(4); pigeonResult.setPurchaseToken((String) purchaseToken); - Object signature = list.get(5); + Object signature = pigeonVar_list.get(5); pigeonResult.setSignature((String) signature); - Object products = list.get(6); + Object products = pigeonVar_list.get(6); pigeonResult.setProducts((List) products); return pigeonResult; } @@ -1948,6 +2183,23 @@ public void setPurchases(@NonNull List setterArg) /** Constructor is non-public to enforce null safety; use Builder. */ PlatformPurchaseHistoryResponse() {} + @Override + public boolean equals(Object o) { + 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); + } + + @Override + public int hashCode() { + return Objects.hash(billingResult, purchases); + } + public static final class Builder { private @Nullable PlatformBillingResult billingResult; @@ -1976,20 +2228,18 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(2); - toListResult.add((billingResult == null) ? null : billingResult.toList()); + ArrayList toListResult = new ArrayList<>(2); + toListResult.add(billingResult); toListResult.add(purchases); return toListResult; } - static @NonNull PlatformPurchaseHistoryResponse fromList(@NonNull ArrayList list) { + static @NonNull PlatformPurchaseHistoryResponse fromList( + @NonNull ArrayList pigeonVar_list) { PlatformPurchaseHistoryResponse pigeonResult = new PlatformPurchaseHistoryResponse(); - Object billingResult = list.get(0); - pigeonResult.setBillingResult( - (billingResult == null) - ? null - : PlatformBillingResult.fromList((ArrayList) billingResult)); - Object purchases = list.get(1); + Object billingResult = pigeonVar_list.get(0); + pigeonResult.setBillingResult((PlatformBillingResult) billingResult); + Object purchases = pigeonVar_list.get(1); pigeonResult.setPurchases((List) purchases); return pigeonResult; } @@ -2031,6 +2281,23 @@ public void setPurchases(@NonNull List setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ PlatformPurchasesResponse() {} + @Override + public boolean equals(Object o) { + 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); + } + + @Override + public int hashCode() { + return Objects.hash(billingResult, purchases); + } + public static final class Builder { private @Nullable PlatformBillingResult billingResult; @@ -2059,20 +2326,17 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(2); - toListResult.add((billingResult == null) ? null : billingResult.toList()); + ArrayList toListResult = new ArrayList<>(2); + toListResult.add(billingResult); toListResult.add(purchases); return toListResult; } - static @NonNull PlatformPurchasesResponse fromList(@NonNull ArrayList list) { + static @NonNull PlatformPurchasesResponse fromList(@NonNull ArrayList pigeonVar_list) { PlatformPurchasesResponse pigeonResult = new PlatformPurchasesResponse(); - Object billingResult = list.get(0); - pigeonResult.setBillingResult( - (billingResult == null) - ? null - : PlatformBillingResult.fromList((ArrayList) billingResult)); - Object purchases = list.get(1); + Object billingResult = pigeonVar_list.get(0); + pigeonResult.setBillingResult((PlatformBillingResult) billingResult); + Object purchases = pigeonVar_list.get(1); pigeonResult.setPurchases((List) purchases); return pigeonResult; } @@ -2149,6 +2413,27 @@ public void setPricingPhases(@NonNull List 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; + } + 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); + } + + @Override + public int hashCode() { + return Objects.hash(basePlanId, offerId, offerToken, offerTags, pricingPhases); + } + public static final class Builder { private @Nullable String basePlanId; @@ -2204,7 +2489,7 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(5); + ArrayList toListResult = new ArrayList<>(5); toListResult.add(basePlanId); toListResult.add(offerId); toListResult.add(offerToken); @@ -2213,17 +2498,18 @@ ArrayList toList() { return toListResult; } - static @NonNull PlatformSubscriptionOfferDetails fromList(@NonNull ArrayList list) { + static @NonNull PlatformSubscriptionOfferDetails fromList( + @NonNull ArrayList pigeonVar_list) { PlatformSubscriptionOfferDetails pigeonResult = new PlatformSubscriptionOfferDetails(); - Object basePlanId = list.get(0); + Object basePlanId = pigeonVar_list.get(0); pigeonResult.setBasePlanId((String) basePlanId); - Object offerId = list.get(1); + Object offerId = pigeonVar_list.get(1); pigeonResult.setOfferId((String) offerId); - Object offerToken = list.get(2); + Object offerToken = pigeonVar_list.get(2); pigeonResult.setOfferToken((String) offerToken); - Object offerTags = list.get(3); + Object offerTags = pigeonVar_list.get(3); pigeonResult.setOfferTags((List) offerTags); - Object pricingPhases = list.get(4); + Object pricingPhases = pigeonVar_list.get(4); pigeonResult.setPricingPhases((List) pricingPhases); return pigeonResult; } @@ -2274,6 +2560,25 @@ public void setProducts(@NonNull List setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ PlatformUserChoiceDetails() {} + @Override + public boolean equals(Object o) { + 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); + } + + @Override + public int hashCode() { + return Objects.hash(originalExternalTransactionId, externalTransactionToken, products); + } + public static final class Builder { private @Nullable String originalExternalTransactionId; @@ -2311,20 +2616,20 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(3); + ArrayList toListResult = new ArrayList<>(3); toListResult.add(originalExternalTransactionId); toListResult.add(externalTransactionToken); toListResult.add(products); return toListResult; } - static @NonNull PlatformUserChoiceDetails fromList(@NonNull ArrayList list) { + static @NonNull PlatformUserChoiceDetails fromList(@NonNull ArrayList pigeonVar_list) { PlatformUserChoiceDetails pigeonResult = new PlatformUserChoiceDetails(); - Object originalExternalTransactionId = list.get(0); + Object originalExternalTransactionId = pigeonVar_list.get(0); pigeonResult.setOriginalExternalTransactionId((String) originalExternalTransactionId); - Object externalTransactionToken = list.get(1); + Object externalTransactionToken = pigeonVar_list.get(1); pigeonResult.setExternalTransactionToken((String) externalTransactionToken); - Object products = list.get(2); + Object products = pigeonVar_list.get(2); pigeonResult.setProducts((List) products); return pigeonResult; } @@ -2375,6 +2680,25 @@ public void setType(@NonNull PlatformProductType setterArg) { /** Constructor is non-public to enforce null safety; use Builder. */ PlatformUserChoiceProduct() {} + @Override + public boolean equals(Object o) { + 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); + } + + @Override + public int hashCode() { + return Objects.hash(id, offerToken, type); + } + public static final class Builder { private @Nullable String id; @@ -2412,90 +2736,93 @@ public static final class Builder { @NonNull ArrayList toList() { - ArrayList toListResult = new ArrayList(3); + ArrayList toListResult = new ArrayList<>(3); toListResult.add(id); toListResult.add(offerToken); - toListResult.add(type == null ? null : type.index); + toListResult.add(type); return toListResult; } - static @NonNull PlatformUserChoiceProduct fromList(@NonNull ArrayList list) { + static @NonNull PlatformUserChoiceProduct fromList(@NonNull ArrayList pigeonVar_list) { PlatformUserChoiceProduct pigeonResult = new PlatformUserChoiceProduct(); - Object id = list.get(0); + Object id = pigeonVar_list.get(0); pigeonResult.setId((String) id); - Object offerToken = list.get(1); + Object offerToken = pigeonVar_list.get(1); pigeonResult.setOfferToken((String) offerToken); - Object type = list.get(2); - pigeonResult.setType(PlatformProductType.values()[(int) type]); + Object type = pigeonVar_list.get(2); + pigeonResult.setType((PlatformProductType) type); return pigeonResult; } } - /** Asynchronous error handling return type for non-nullable API method returns. */ - public interface Result { - /** Success case callback method for handling returns. */ - void success(@NonNull T result); - - /** Failure case callback method for handling errors. */ - void error(@NonNull Throwable error); - } - /** Asynchronous error handling return type for nullable API method returns. */ - public interface NullableResult { - /** Success case callback method for handling returns. */ - void success(@Nullable T result); - - /** Failure case callback method for handling errors. */ - void error(@NonNull Throwable error); - } - /** Asynchronous error handling return type for void API method returns. */ - public interface VoidResult { - /** Success case callback method for handling returns. */ - void success(); - - /** Failure case callback method for handling errors. */ - void error(@NonNull Throwable error); - } - - private static class InAppPurchaseApiCodec extends StandardMessageCodec { - public static final InAppPurchaseApiCodec INSTANCE = new InAppPurchaseApiCodec(); + private static class PigeonCodec extends StandardMessageCodec { + public static final PigeonCodec INSTANCE = new PigeonCodec(); - private InAppPurchaseApiCodec() {} + private PigeonCodec() {} @Override protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { - case (byte) 128: - return PlatformAccountIdentifiers.fromList((ArrayList) readValue(buffer)); case (byte) 129: - return PlatformAlternativeBillingOnlyReportingDetailsResponse.fromList( - (ArrayList) readValue(buffer)); + { + Object value = readValue(buffer); + return value == null ? null : PlatformProductType.values()[((Long) value).intValue()]; + } case (byte) 130: - return PlatformBillingConfigResponse.fromList((ArrayList) readValue(buffer)); + { + Object value = readValue(buffer); + return value == null + ? null + : PlatformBillingChoiceMode.values()[((Long) value).intValue()]; + } case (byte) 131: - return PlatformBillingFlowParams.fromList((ArrayList) readValue(buffer)); + { + Object value = readValue(buffer); + return value == null ? null : PlatformPurchaseState.values()[((Long) value).intValue()]; + } case (byte) 132: - return PlatformBillingResult.fromList((ArrayList) readValue(buffer)); + { + Object value = readValue(buffer); + return value == null + ? null + : PlatformRecurrenceMode.values()[((Long) value).intValue()]; + } case (byte) 133: - return PlatformOneTimePurchaseOfferDetails.fromList( - (ArrayList) readValue(buffer)); + return PlatformQueryProduct.fromList((ArrayList) readValue(buffer)); case (byte) 134: - return PlatformPricingPhase.fromList((ArrayList) readValue(buffer)); + return PlatformAccountIdentifiers.fromList((ArrayList) readValue(buffer)); case (byte) 135: - return PlatformProductDetails.fromList((ArrayList) readValue(buffer)); + return PlatformBillingResult.fromList((ArrayList) readValue(buffer)); case (byte) 136: - return PlatformProductDetailsResponse.fromList((ArrayList) readValue(buffer)); + return PlatformOneTimePurchaseOfferDetails.fromList( + (ArrayList) readValue(buffer)); case (byte) 137: - return PlatformPurchase.fromList((ArrayList) readValue(buffer)); + return PlatformProductDetails.fromList((ArrayList) readValue(buffer)); case (byte) 138: - return PlatformPurchaseHistoryRecord.fromList((ArrayList) readValue(buffer)); + return PlatformProductDetailsResponse.fromList((ArrayList) readValue(buffer)); case (byte) 139: - return PlatformPurchaseHistoryResponse.fromList((ArrayList) readValue(buffer)); + return PlatformAlternativeBillingOnlyReportingDetailsResponse.fromList( + (ArrayList) readValue(buffer)); case (byte) 140: - return PlatformPurchasesResponse.fromList((ArrayList) readValue(buffer)); + return PlatformBillingConfigResponse.fromList((ArrayList) readValue(buffer)); case (byte) 141: - return PlatformQueryProduct.fromList((ArrayList) readValue(buffer)); + return PlatformBillingFlowParams.fromList((ArrayList) readValue(buffer)); case (byte) 142: + return PlatformPricingPhase.fromList((ArrayList) readValue(buffer)); + case (byte) 143: + return PlatformPurchase.fromList((ArrayList) readValue(buffer)); + case (byte) 144: + return PlatformPurchaseHistoryRecord.fromList((ArrayList) readValue(buffer)); + case (byte) 145: + return PlatformPurchaseHistoryResponse.fromList((ArrayList) readValue(buffer)); + case (byte) 146: + return PlatformPurchasesResponse.fromList((ArrayList) readValue(buffer)); + case (byte) 147: return PlatformSubscriptionOfferDetails.fromList((ArrayList) readValue(buffer)); + case (byte) 148: + return PlatformUserChoiceDetails.fromList((ArrayList) readValue(buffer)); + case (byte) 149: + return PlatformUserChoiceProduct.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); } @@ -2503,58 +2830,100 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { @Override protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof PlatformAccountIdentifiers) { - stream.write(128); - writeValue(stream, ((PlatformAccountIdentifiers) value).toList()); - } else if (value instanceof PlatformAlternativeBillingOnlyReportingDetailsResponse) { + if (value instanceof PlatformProductType) { stream.write(129); - writeValue( - stream, ((PlatformAlternativeBillingOnlyReportingDetailsResponse) value).toList()); - } else if (value instanceof PlatformBillingConfigResponse) { + writeValue(stream, value == null ? null : ((PlatformProductType) value).index); + } else if (value instanceof PlatformBillingChoiceMode) { stream.write(130); - writeValue(stream, ((PlatformBillingConfigResponse) value).toList()); - } else if (value instanceof PlatformBillingFlowParams) { + writeValue(stream, value == null ? null : ((PlatformBillingChoiceMode) value).index); + } else if (value instanceof PlatformPurchaseState) { stream.write(131); - writeValue(stream, ((PlatformBillingFlowParams) value).toList()); - } else if (value instanceof PlatformBillingResult) { + writeValue(stream, value == null ? null : ((PlatformPurchaseState) value).index); + } else if (value instanceof PlatformRecurrenceMode) { stream.write(132); + writeValue(stream, value == null ? null : ((PlatformRecurrenceMode) value).index); + } else if (value instanceof PlatformQueryProduct) { + stream.write(133); + writeValue(stream, ((PlatformQueryProduct) value).toList()); + } else if (value instanceof PlatformAccountIdentifiers) { + stream.write(134); + writeValue(stream, ((PlatformAccountIdentifiers) value).toList()); + } else if (value instanceof PlatformBillingResult) { + stream.write(135); writeValue(stream, ((PlatformBillingResult) value).toList()); } else if (value instanceof PlatformOneTimePurchaseOfferDetails) { - stream.write(133); + stream.write(136); writeValue(stream, ((PlatformOneTimePurchaseOfferDetails) value).toList()); - } else if (value instanceof PlatformPricingPhase) { - stream.write(134); - writeValue(stream, ((PlatformPricingPhase) value).toList()); } else if (value instanceof PlatformProductDetails) { - stream.write(135); + stream.write(137); writeValue(stream, ((PlatformProductDetails) value).toList()); } else if (value instanceof PlatformProductDetailsResponse) { - stream.write(136); + stream.write(138); writeValue(stream, ((PlatformProductDetailsResponse) value).toList()); + } else if (value instanceof PlatformAlternativeBillingOnlyReportingDetailsResponse) { + stream.write(139); + writeValue( + stream, ((PlatformAlternativeBillingOnlyReportingDetailsResponse) value).toList()); + } else if (value instanceof PlatformBillingConfigResponse) { + stream.write(140); + writeValue(stream, ((PlatformBillingConfigResponse) value).toList()); + } else if (value instanceof PlatformBillingFlowParams) { + stream.write(141); + writeValue(stream, ((PlatformBillingFlowParams) value).toList()); + } else if (value instanceof PlatformPricingPhase) { + stream.write(142); + writeValue(stream, ((PlatformPricingPhase) value).toList()); } else if (value instanceof PlatformPurchase) { - stream.write(137); + stream.write(143); writeValue(stream, ((PlatformPurchase) value).toList()); } else if (value instanceof PlatformPurchaseHistoryRecord) { - stream.write(138); + stream.write(144); writeValue(stream, ((PlatformPurchaseHistoryRecord) value).toList()); } else if (value instanceof PlatformPurchaseHistoryResponse) { - stream.write(139); + stream.write(145); writeValue(stream, ((PlatformPurchaseHistoryResponse) value).toList()); } else if (value instanceof PlatformPurchasesResponse) { - stream.write(140); + stream.write(146); writeValue(stream, ((PlatformPurchasesResponse) value).toList()); - } else if (value instanceof PlatformQueryProduct) { - stream.write(141); - writeValue(stream, ((PlatformQueryProduct) value).toList()); } else if (value instanceof PlatformSubscriptionOfferDetails) { - stream.write(142); + stream.write(147); writeValue(stream, ((PlatformSubscriptionOfferDetails) value).toList()); + } else if (value instanceof PlatformUserChoiceDetails) { + stream.write(148); + writeValue(stream, ((PlatformUserChoiceDetails) value).toList()); + } else if (value instanceof PlatformUserChoiceProduct) { + stream.write(149); + writeValue(stream, ((PlatformUserChoiceProduct) 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. */ + void success(@NonNull T result); + + /** Failure case callback method for handling errors. */ + void error(@NonNull Throwable error); + } + /** Asynchronous error handling return type for nullable API method returns. */ + public interface NullableResult { + /** Success case callback method for handling returns. */ + void success(@Nullable T result); + + /** Failure case callback method for handling errors. */ + void error(@NonNull Throwable error); + } + /** Asynchronous error handling return type for void API method returns. */ + public interface VoidResult { + /** Success case callback method for handling returns. */ + void success(); + + /** Failure case callback method for handling errors. */ + void error(@NonNull Throwable error); + } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InAppPurchaseApi { /** Wraps BillingClient#isReady. */ @@ -2617,28 +2986,36 @@ void createAlternativeBillingOnlyReportingDetailsAsync( /** The codec used by InAppPurchaseApi. */ static @NonNull MessageCodec getCodec() { - return InAppPurchaseApiCodec.INSTANCE; + return PigeonCodec.INSTANCE; } /** * 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) { + messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady", + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady" + + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); try { Boolean output = api.isReady(); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2650,16 +3027,16 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable InAppPurch BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection", + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection" + + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; - Number callbackHandleArg = (Number) args.get(0); - PlatformBillingChoiceMode billingModeArg = - PlatformBillingChoiceMode.values()[(int) args.get(1)]; + Long callbackHandleArg = (Long) args.get(0); + PlatformBillingChoiceMode billingModeArg = (PlatformBillingChoiceMode) args.get(1); Result resultCallback = new Result() { public void success(PlatformBillingResult result) { @@ -2673,10 +3050,7 @@ public void error(Throwable error) { } }; - api.startConnection( - (callbackHandleArg == null) ? null : callbackHandleArg.longValue(), - billingModeArg, - resultCallback); + api.startConnection(callbackHandleArg, billingModeArg, resultCallback); }); } else { channel.setMessageHandler(null); @@ -2686,18 +3060,18 @@ public void error(Throwable error) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection", + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection" + + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); try { api.endConnection(); wrapped.add(0, null); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2709,12 +3083,13 @@ public void error(Throwable error) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync", + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync" + + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); Result resultCallback = new Result() { public void success(PlatformBillingConfigResponse result) { @@ -2738,20 +3113,20 @@ public void error(Throwable error) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow", + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow" + + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; PlatformBillingFlowParams paramsArg = (PlatformBillingFlowParams) args.get(0); try { PlatformBillingResult output = api.launchBillingFlow(paramsArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2763,12 +3138,13 @@ public void error(Throwable error) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase", + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase" + + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; String purchaseTokenArg = (String) args.get(0); Result resultCallback = @@ -2794,12 +3170,13 @@ public void error(Throwable error) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync", + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync" + + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; String purchaseTokenArg = (String) args.get(0); Result resultCallback = @@ -2825,15 +3202,15 @@ public void error(Throwable error) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync", + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync" + + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; - PlatformProductType productTypeArg = - PlatformProductType.values()[(int) args.get(0)]; + PlatformProductType productTypeArg = (PlatformProductType) args.get(0); Result resultCallback = new Result() { public void success(PlatformPurchasesResponse result) { @@ -2857,15 +3234,15 @@ public void error(Throwable error) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync", + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync" + + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; - PlatformProductType productTypeArg = - PlatformProductType.values()[(int) args.get(0)]; + PlatformProductType productTypeArg = (PlatformProductType) args.get(0); Result resultCallback = new Result() { public void success(PlatformPurchaseHistoryResponse result) { @@ -2889,12 +3266,13 @@ public void error(Throwable error) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync", + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync" + + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; List productsArg = (List) args.get(0); Result resultCallback = @@ -2920,20 +3298,20 @@ public void error(Throwable error) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported", + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported" + + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); ArrayList args = (ArrayList) message; String featureArg = (String) args.get(0); try { Boolean output = api.isFeatureSupported(featureArg); wrapped.add(0, output); } catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; + wrapped = wrapError(exception); } reply.reply(wrapped); }); @@ -2945,12 +3323,13 @@ public void error(Throwable error) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync", + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync" + + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); Result resultCallback = new Result() { public void success(PlatformBillingResult result) { @@ -2974,12 +3353,13 @@ public void error(Throwable error) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog", + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog" + + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); Result resultCallback = new Result() { public void success(PlatformBillingResult result) { @@ -3003,12 +3383,13 @@ public void error(Throwable error) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync", + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync" + + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { - ArrayList wrapped = new ArrayList(); + ArrayList wrapped = new ArrayList<>(); Result resultCallback = new Result() { public void success( @@ -3031,90 +3412,42 @@ public void error(Throwable error) { } } } - - private static class InAppPurchaseCallbackApiCodec extends StandardMessageCodec { - public static final InAppPurchaseCallbackApiCodec INSTANCE = - new InAppPurchaseCallbackApiCodec(); - - private InAppPurchaseCallbackApiCodec() {} - - @Override - protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { - switch (type) { - case (byte) 128: - return PlatformAccountIdentifiers.fromList((ArrayList) readValue(buffer)); - case (byte) 129: - return PlatformBillingResult.fromList((ArrayList) readValue(buffer)); - case (byte) 130: - return PlatformPurchase.fromList((ArrayList) readValue(buffer)); - case (byte) 131: - return PlatformPurchasesResponse.fromList((ArrayList) readValue(buffer)); - case (byte) 132: - return PlatformUserChoiceDetails.fromList((ArrayList) readValue(buffer)); - case (byte) 133: - return PlatformUserChoiceProduct.fromList((ArrayList) readValue(buffer)); - default: - return super.readValueOfType(type, buffer); - } - } - - @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof PlatformAccountIdentifiers) { - stream.write(128); - writeValue(stream, ((PlatformAccountIdentifiers) value).toList()); - } else if (value instanceof PlatformBillingResult) { - stream.write(129); - writeValue(stream, ((PlatformBillingResult) value).toList()); - } else if (value instanceof PlatformPurchase) { - stream.write(130); - writeValue(stream, ((PlatformPurchase) value).toList()); - } else if (value instanceof PlatformPurchasesResponse) { - stream.write(131); - writeValue(stream, ((PlatformPurchasesResponse) value).toList()); - } else if (value instanceof PlatformUserChoiceDetails) { - stream.write(132); - writeValue(stream, ((PlatformUserChoiceDetails) value).toList()); - } else if (value instanceof PlatformUserChoiceProduct) { - stream.write(133); - writeValue(stream, ((PlatformUserChoiceProduct) value).toList()); - } else { - super.writeValue(stream, value); - } - } - } - /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class InAppPurchaseCallbackApi { private final @NonNull BinaryMessenger binaryMessenger; + private final String messageChannelSuffix; public InAppPurchaseCallbackApi(@NonNull BinaryMessenger argBinaryMessenger) { + this(argBinaryMessenger, ""); + } + + 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 InAppPurchaseCallbackApiCodec.INSTANCE; + 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"; + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected" + + messageChannelSuffix; BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(callbackHandleArg)), + 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), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } @@ -3127,20 +3460,19 @@ public void onBillingServiceDisconnected( public void onPurchasesUpdated( @NonNull PlatformPurchasesResponse updateArg, @NonNull VoidResult result) { final String channelName = - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated"; + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated" + + messageChannelSuffix; BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(updateArg)), + 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), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } @@ -3153,20 +3485,19 @@ public void onPurchasesUpdated( public void userSelectedalternativeBilling( @NonNull PlatformUserChoiceDetails detailsArg, @NonNull VoidResult result) { final String channelName = - "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling"; + "dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling" + + messageChannelSuffix; BasicMessageChannel channel = new BasicMessageChannel<>(binaryMessenger, channelName, getCodec()); channel.send( - new ArrayList(Collections.singletonList(detailsArg)), + 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), - (String) listReply.get(2))); + (String) listReply.get(0), (String) listReply.get(1), listReply.get(2))); } else { result.success(); } diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/alternative_billing_only_reporting_details_wrapper.g.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/alternative_billing_only_reporting_details_wrapper.g.dart index 46b82645de0f..04578fb4a45b 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/alternative_billing_only_reporting_details_wrapper.g.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/alternative_billing_only_reporting_details_wrapper.g.dart @@ -10,7 +10,7 @@ AlternativeBillingOnlyReportingDetailsWrapper _$AlternativeBillingOnlyReportingDetailsWrapperFromJson(Map json) => AlternativeBillingOnlyReportingDetailsWrapper( responseCode: const BillingResponseConverter() - .fromJson(json['responseCode'] as int?), + .fromJson((json['responseCode'] as num?)?.toInt()), debugMessage: json['debugMessage'] as String? ?? '', externalTransactionToken: json['externalTransactionToken'] as String? ?? '', 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 3f7bd499bbf1..1f46c3f1de20 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 @@ -64,7 +64,7 @@ class BillingClient { }) : _hostApi = api ?? InAppPurchaseApi(), hostCallbackHandler = HostBillingClientCallbackHandler( onPurchasesUpdated, alternativeBillingListener) { - InAppPurchaseCallbackApi.setup(hostCallbackHandler); + InAppPurchaseCallbackApi.setUp(hostCallbackHandler); } /// Interface for calling host-side code. diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_config_wrapper.g.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_config_wrapper.g.dart index 21f98577d91e..fc8328aec176 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_config_wrapper.g.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_config_wrapper.g.dart @@ -9,7 +9,7 @@ part of 'billing_config_wrapper.dart'; BillingConfigWrapper _$BillingConfigWrapperFromJson(Map json) => BillingConfigWrapper( responseCode: const BillingResponseConverter() - .fromJson(json['responseCode'] as int?), + .fromJson((json['responseCode'] as num?)?.toInt()), debugMessage: json['debugMessage'] as String? ?? '', countryCode: json['countryCode'] as String? ?? '', ); diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_response_wrapper.g.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_response_wrapper.g.dart index bff62ae85744..a3b28403983e 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_response_wrapper.g.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/billing_response_wrapper.g.dart @@ -9,6 +9,6 @@ part of 'billing_response_wrapper.dart'; BillingResultWrapper _$BillingResultWrapperFromJson(Map json) => BillingResultWrapper( responseCode: const BillingResponseConverter() - .fromJson(json['responseCode'] as int?), + .fromJson((json['responseCode'] as num?)?.toInt()), debugMessage: json['debugMessage'] as String?, ); diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/one_time_purchase_offer_details_wrapper.g.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/one_time_purchase_offer_details_wrapper.g.dart index 19e57e80157b..f26a38162fcd 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/one_time_purchase_offer_details_wrapper.g.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/billing_client_wrappers/one_time_purchase_offer_details_wrapper.g.dart @@ -10,6 +10,6 @@ OneTimePurchaseOfferDetailsWrapper _$OneTimePurchaseOfferDetailsWrapperFromJson( Map json) => OneTimePurchaseOfferDetailsWrapper( formattedPrice: json['formattedPrice'] as String? ?? '', - priceAmountMicros: json['priceAmountMicros'] as int? ?? 0, + priceAmountMicros: (json['priceAmountMicros'] as num?)?.toInt() ?? 0, priceCurrencyCode: json['priceCurrencyCode'] as String? ?? '', ); 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 0270d610eb68..b97afce0f628 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 @@ -9,7 +9,7 @@ part of 'purchase_wrapper.dart'; PurchaseWrapper _$PurchaseWrapperFromJson(Map json) => PurchaseWrapper( orderId: json['orderId'] as String? ?? '', packageName: json['packageName'] as String? ?? '', - purchaseTime: json['purchaseTime'] as int? ?? 0, + purchaseTime: (json['purchaseTime'] as num?)?.toInt() ?? 0, purchaseToken: json['purchaseToken'] as String? ?? '', signature: json['signature'] as String? ?? '', products: (json['products'] as List?) @@ -21,14 +21,14 @@ PurchaseWrapper _$PurchaseWrapperFromJson(Map json) => PurchaseWrapper( developerPayload: json['developerPayload'] as String?, isAcknowledged: json['isAcknowledged'] as bool? ?? false, purchaseState: const PurchaseStateConverter() - .fromJson(json['purchaseState'] as int?), + .fromJson((json['purchaseState'] as num?)?.toInt()), obfuscatedAccountId: json['obfuscatedAccountId'] as String?, obfuscatedProfileId: json['obfuscatedProfileId'] as String?, ); PurchaseHistoryRecordWrapper _$PurchaseHistoryRecordWrapperFromJson(Map json) => PurchaseHistoryRecordWrapper( - purchaseTime: json['purchaseTime'] as int? ?? 0, + purchaseTime: (json['purchaseTime'] as num?)?.toInt() ?? 0, purchaseToken: json['purchaseToken'] as String? ?? '', signature: json['signature'] as String? ?? '', products: (json['products'] as List?) @@ -42,7 +42,7 @@ PurchaseHistoryRecordWrapper _$PurchaseHistoryRecordWrapperFromJson(Map json) => PurchasesResultWrapper _$PurchasesResultWrapperFromJson(Map json) => PurchasesResultWrapper( responseCode: const BillingResponseConverter() - .fromJson(json['responseCode'] as int?), + .fromJson((json['responseCode'] as num?)?.toInt()), billingResult: BillingResultWrapper.fromJson((json['billingResult'] as Map?)?.map( (k, e) => MapEntry(k as String, e), 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 eca645340fe5..46973ed7d427 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 @@ -25,13 +25,13 @@ SubscriptionOfferDetailsWrapper _$SubscriptionOfferDetailsWrapperFromJson( PricingPhaseWrapper _$PricingPhaseWrapperFromJson(Map json) => PricingPhaseWrapper( - billingCycleCount: json['billingCycleCount'] as int? ?? 0, + billingCycleCount: (json['billingCycleCount'] as num?)?.toInt() ?? 0, billingPeriod: json['billingPeriod'] as String? ?? '', formattedPrice: json['formattedPrice'] as String? ?? '', - priceAmountMicros: json['priceAmountMicros'] as int? ?? 0, + priceAmountMicros: (json['priceAmountMicros'] as num?)?.toInt() ?? 0, priceCurrencyCode: json['priceCurrencyCode'] as String? ?? '', recurrenceMode: json['recurrenceMode'] == null ? RecurrenceMode.nonRecurring : const RecurrenceModeConverter() - .fromJson(json['recurrenceMode'] as int?), + .fromJson((json['recurrenceMode'] as num?)?.toInt()), ); 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 e6444b8d9b64..1e6cca2ccbd3 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 (v17.3.0), do not edit directly. +// Autogenerated from Pigeon (v22.4.2), 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 @@ -77,7 +77,7 @@ class PlatformQueryProduct { Object encode() { return [ productId, - productType.index, + productType, ]; } @@ -85,7 +85,7 @@ class PlatformQueryProduct { result as List; return PlatformQueryProduct( productId: result[0]! as String, - productType: PlatformProductType.values[result[1]! as int], + productType: result[1]! as PlatformProductType, ); } } @@ -200,16 +200,16 @@ class PlatformProductDetails { PlatformOneTimePurchaseOfferDetails? oneTimePurchaseOfferDetails; - List? subscriptionOfferDetails; + List? subscriptionOfferDetails; Object encode() { return [ description, name, productId, - productType.index, + productType, title, - oneTimePurchaseOfferDetails?.encode(), + oneTimePurchaseOfferDetails, subscriptionOfferDetails, ]; } @@ -220,14 +220,12 @@ class PlatformProductDetails { description: result[0]! as String, name: result[1]! as String, productId: result[2]! as String, - productType: PlatformProductType.values[result[3]! as int], + productType: result[3]! as PlatformProductType, title: result[4]! as String, - oneTimePurchaseOfferDetails: result[5] != null - ? PlatformOneTimePurchaseOfferDetails.decode( - result[5]! as List) - : null, + oneTimePurchaseOfferDetails: + result[5] as PlatformOneTimePurchaseOfferDetails?, subscriptionOfferDetails: (result[6] as List?) - ?.cast(), + ?.cast(), ); } } @@ -242,11 +240,11 @@ class PlatformProductDetailsResponse { PlatformBillingResult billingResult; - List productDetails; + List productDetails; Object encode() { return [ - billingResult.encode(), + billingResult, productDetails, ]; } @@ -254,9 +252,9 @@ class PlatformProductDetailsResponse { static PlatformProductDetailsResponse decode(Object result) { result as List; return PlatformProductDetailsResponse( - billingResult: PlatformBillingResult.decode(result[0]! as List), + billingResult: result[0]! as PlatformBillingResult, productDetails: - (result[1] as List?)!.cast(), + (result[1] as List?)!.cast(), ); } } @@ -276,7 +274,7 @@ class PlatformAlternativeBillingOnlyReportingDetailsResponse { Object encode() { return [ - billingResult.encode(), + billingResult, externalTransactionToken, ]; } @@ -285,7 +283,7 @@ class PlatformAlternativeBillingOnlyReportingDetailsResponse { Object result) { result as List; return PlatformAlternativeBillingOnlyReportingDetailsResponse( - billingResult: PlatformBillingResult.decode(result[0]! as List), + billingResult: result[0]! as PlatformBillingResult, externalTransactionToken: result[1]! as String, ); } @@ -305,7 +303,7 @@ class PlatformBillingConfigResponse { Object encode() { return [ - billingResult.encode(), + billingResult, countryCode, ]; } @@ -313,7 +311,7 @@ class PlatformBillingConfigResponse { static PlatformBillingConfigResponse decode(Object result) { result as List; return PlatformBillingConfigResponse( - billingResult: PlatformBillingResult.decode(result[0]! as List), + billingResult: result[0]! as PlatformBillingResult, countryCode: result[1]! as String, ); } @@ -402,7 +400,7 @@ class PlatformPricingPhase { Object encode() { return [ billingCycleCount, - recurrenceMode.index, + recurrenceMode, priceAmountMicros, billingPeriod, formattedPrice, @@ -414,7 +412,7 @@ class PlatformPricingPhase { result as List; return PlatformPricingPhase( billingCycleCount: result[0]! as int, - recurrenceMode: PlatformRecurrenceMode.values[result[1]! as int], + recurrenceMode: result[1]! as PlatformRecurrenceMode, priceAmountMicros: result[2]! as int, billingPeriod: result[3]! as String, formattedPrice: result[4]! as String, @@ -453,7 +451,7 @@ class PlatformPurchase { String signature; - List products; + List products; bool isAutoRenewing; @@ -482,8 +480,8 @@ class PlatformPurchase { developerPayload, isAcknowledged, quantity, - purchaseState.index, - accountIdentifiers?.encode(), + purchaseState, + accountIdentifiers, ]; } @@ -495,16 +493,14 @@ class PlatformPurchase { purchaseTime: result[2]! as int, purchaseToken: result[3]! as String, signature: result[4]! as String, - products: (result[5] as List?)!.cast(), + products: (result[5] as List?)!.cast(), isAutoRenewing: result[6]! as bool, originalJson: result[7]! as String, developerPayload: result[8]! as String, isAcknowledged: result[9]! as bool, quantity: result[10]! as int, - purchaseState: PlatformPurchaseState.values[result[11]! as int], - accountIdentifiers: result[12] != null - ? PlatformAccountIdentifiers.decode(result[12]! as List) - : null, + purchaseState: result[11]! as PlatformPurchaseState, + accountIdentifiers: result[12] as PlatformAccountIdentifiers?, ); } } @@ -535,7 +531,7 @@ class PlatformPurchaseHistoryRecord { String signature; - List products; + List products; Object encode() { return [ @@ -558,7 +554,7 @@ class PlatformPurchaseHistoryRecord { originalJson: result[3]! as String, purchaseToken: result[4]! as String, signature: result[5]! as String, - products: (result[6] as List?)!.cast(), + products: (result[6] as List?)!.cast(), ); } } @@ -573,11 +569,11 @@ class PlatformPurchaseHistoryResponse { PlatformBillingResult billingResult; - List purchases; + List purchases; Object encode() { return [ - billingResult.encode(), + billingResult, purchases, ]; } @@ -585,9 +581,9 @@ class PlatformPurchaseHistoryResponse { static PlatformPurchaseHistoryResponse decode(Object result) { result as List; return PlatformPurchaseHistoryResponse( - billingResult: PlatformBillingResult.decode(result[0]! as List), + billingResult: result[0]! as PlatformBillingResult, purchases: - (result[1] as List?)!.cast(), + (result[1] as List?)!.cast(), ); } } @@ -602,11 +598,11 @@ class PlatformPurchasesResponse { PlatformBillingResult billingResult; - List purchases; + List purchases; Object encode() { return [ - billingResult.encode(), + billingResult, purchases, ]; } @@ -614,8 +610,8 @@ class PlatformPurchasesResponse { static PlatformPurchasesResponse decode(Object result) { result as List; return PlatformPurchasesResponse( - billingResult: PlatformBillingResult.decode(result[0]! as List), - purchases: (result[1] as List?)!.cast(), + billingResult: result[0]! as PlatformBillingResult, + purchases: (result[1] as List?)!.cast(), ); } } @@ -636,9 +632,9 @@ class PlatformSubscriptionOfferDetails { String offerToken; - List offerTags; + List offerTags; - List pricingPhases; + List pricingPhases; Object encode() { return [ @@ -656,9 +652,9 @@ class PlatformSubscriptionOfferDetails { basePlanId: result[0]! as String, offerId: result[1] as String?, offerToken: result[2]! as String, - offerTags: (result[3] as List?)!.cast(), + offerTags: (result[3] as List?)!.cast(), pricingPhases: - (result[4] as List?)!.cast(), + (result[4] as List?)!.cast(), ); } } @@ -675,7 +671,7 @@ class PlatformUserChoiceDetails { String externalTransactionToken; - List products; + List products; Object encode() { return [ @@ -691,7 +687,7 @@ class PlatformUserChoiceDetails { originalExternalTransactionId: result[0] as String?, externalTransactionToken: result[1]! as String, products: - (result[2] as List?)!.cast(), + (result[2] as List?)!.cast(), ); } } @@ -714,7 +710,7 @@ class PlatformUserChoiceProduct { return [ id, offerToken, - type.index, + type, ]; } @@ -723,61 +719,82 @@ class PlatformUserChoiceProduct { return PlatformUserChoiceProduct( id: result[0]! as String, offerToken: result[1] as String?, - type: PlatformProductType.values[result[2]! as int], + type: result[2]! as PlatformProductType, ); } } -class _InAppPurchaseApiCodec extends StandardMessageCodec { - const _InAppPurchaseApiCodec(); +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is PlatformAccountIdentifiers) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value - is PlatformAlternativeBillingOnlyReportingDetailsResponse) { + if (value is int) { + buffer.putUint8(4); + buffer.putInt64(value); + } else if (value is PlatformProductType) { buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is PlatformBillingConfigResponse) { + writeValue(buffer, value.index); + } else if (value is PlatformBillingChoiceMode) { buffer.putUint8(130); - writeValue(buffer, value.encode()); - } else if (value is PlatformBillingFlowParams) { + writeValue(buffer, value.index); + } else if (value is PlatformPurchaseState) { buffer.putUint8(131); - writeValue(buffer, value.encode()); - } else if (value is PlatformBillingResult) { + writeValue(buffer, value.index); + } else if (value is PlatformRecurrenceMode) { buffer.putUint8(132); - writeValue(buffer, value.encode()); - } else if (value is PlatformOneTimePurchaseOfferDetails) { + writeValue(buffer, value.index); + } else if (value is PlatformQueryProduct) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is PlatformPricingPhase) { + } else if (value is PlatformAccountIdentifiers) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is PlatformProductDetails) { + } else if (value is PlatformBillingResult) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else if (value is PlatformProductDetailsResponse) { + } else if (value is PlatformOneTimePurchaseOfferDetails) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchase) { + } else if (value is PlatformProductDetails) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchaseHistoryRecord) { + } else if (value is PlatformProductDetailsResponse) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchaseHistoryResponse) { + } else if (value + is PlatformAlternativeBillingOnlyReportingDetailsResponse) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is PlatformPurchasesResponse) { + } else if (value is PlatformBillingConfigResponse) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is PlatformQueryProduct) { + } else if (value is PlatformBillingFlowParams) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else if (value is PlatformSubscriptionOfferDetails) { + } else if (value is PlatformPricingPhase) { buffer.putUint8(142); writeValue(buffer, value.encode()); + } else if (value is PlatformPurchase) { + buffer.putUint8(143); + writeValue(buffer, value.encode()); + } else if (value is PlatformPurchaseHistoryRecord) { + buffer.putUint8(144); + writeValue(buffer, value.encode()); + } else if (value is PlatformPurchaseHistoryResponse) { + buffer.putUint8(145); + writeValue(buffer, value.encode()); + } else if (value is PlatformPurchasesResponse) { + buffer.putUint8(146); + writeValue(buffer, value.encode()); + } else if (value is PlatformSubscriptionOfferDetails) { + buffer.putUint8(147); + writeValue(buffer, value.encode()); + } else if (value is PlatformUserChoiceDetails) { + buffer.putUint8(148); + writeValue(buffer, value.encode()); + } else if (value is PlatformUserChoiceProduct) { + buffer.putUint8(149); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -786,37 +803,53 @@ class _InAppPurchaseApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return PlatformAccountIdentifiers.decode(readValue(buffer)!); case 129: - return PlatformAlternativeBillingOnlyReportingDetailsResponse.decode( - readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : PlatformProductType.values[value]; case 130: - return PlatformBillingConfigResponse.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : PlatformBillingChoiceMode.values[value]; case 131: - return PlatformBillingFlowParams.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : PlatformPurchaseState.values[value]; case 132: - return PlatformBillingResult.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : PlatformRecurrenceMode.values[value]; case 133: - return PlatformOneTimePurchaseOfferDetails.decode(readValue(buffer)!); + return PlatformQueryProduct.decode(readValue(buffer)!); case 134: - return PlatformPricingPhase.decode(readValue(buffer)!); + return PlatformAccountIdentifiers.decode(readValue(buffer)!); case 135: - return PlatformProductDetails.decode(readValue(buffer)!); + return PlatformBillingResult.decode(readValue(buffer)!); case 136: - return PlatformProductDetailsResponse.decode(readValue(buffer)!); + return PlatformOneTimePurchaseOfferDetails.decode(readValue(buffer)!); case 137: - return PlatformPurchase.decode(readValue(buffer)!); + return PlatformProductDetails.decode(readValue(buffer)!); case 138: - return PlatformPurchaseHistoryRecord.decode(readValue(buffer)!); + return PlatformProductDetailsResponse.decode(readValue(buffer)!); case 139: - return PlatformPurchaseHistoryResponse.decode(readValue(buffer)!); + return PlatformAlternativeBillingOnlyReportingDetailsResponse.decode( + readValue(buffer)!); case 140: - return PlatformPurchasesResponse.decode(readValue(buffer)!); + return PlatformBillingConfigResponse.decode(readValue(buffer)!); case 141: - return PlatformQueryProduct.decode(readValue(buffer)!); + return PlatformBillingFlowParams.decode(readValue(buffer)!); case 142: + return PlatformPricingPhase.decode(readValue(buffer)!); + case 143: + return PlatformPurchase.decode(readValue(buffer)!); + case 144: + return PlatformPurchaseHistoryRecord.decode(readValue(buffer)!); + case 145: + return PlatformPurchaseHistoryResponse.decode(readValue(buffer)!); + case 146: + return PlatformPurchasesResponse.decode(readValue(buffer)!); + case 147: return PlatformSubscriptionOfferDetails.decode(readValue(buffer)!); + case 148: + return PlatformUserChoiceDetails.decode(readValue(buffer)!); + case 149: + return PlatformUserChoiceProduct.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -827,93 +860,97 @@ 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}) - : __pigeon_binaryMessenger = binaryMessenger; - final BinaryMessenger? __pigeon_binaryMessenger; + InAppPurchaseApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; + + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - static const MessageCodec pigeonChannelCodec = - _InAppPurchaseApiCodec(); + final String pigeonVar_messageChannelSuffix; /// Wraps BillingClient#isReady. Future isReady() async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isReady$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send(null) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as bool?)!; + return (pigeonVar_replyList[0] as bool?)!; } } /// Wraps BillingClient#startConnection(BillingClientStateListener). Future startConnection( int callbackHandle, PlatformBillingChoiceMode billingMode) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.startConnection$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([callbackHandle, billingMode.index]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + 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) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as PlatformBillingResult?)!; + return (pigeonVar_replyList[0] as PlatformBillingResult?)!; } } /// Wraps BillingClient#endConnection(BillingClientStateListener). Future endConnection() async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.endConnection$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send(null) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; @@ -922,394 +959,345 @@ class InAppPurchaseApi { /// Wraps BillingClient#getBillingConfigAsync(GetBillingConfigParams, BillingConfigResponseListener). Future getBillingConfigAsync() async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.getBillingConfigAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send(null) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as PlatformBillingConfigResponse?)!; + return (pigeonVar_replyList[0] as PlatformBillingConfigResponse?)!; } } /// Wraps BillingClient#launchBillingFlow(Activity, BillingFlowParams). Future launchBillingFlow( PlatformBillingFlowParams params) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.launchBillingFlow$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([params]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([params]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as PlatformBillingResult?)!; + return (pigeonVar_replyList[0] as PlatformBillingResult?)!; } } /// Wraps BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, AcknowledgePurchaseResponseListener). Future acknowledgePurchase( String purchaseToken) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.acknowledgePurchase$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([purchaseToken]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + 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) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as PlatformBillingResult?)!; + return (pigeonVar_replyList[0] as PlatformBillingResult?)!; } } /// Wraps BillingClient#consumeAsync(ConsumeParams, ConsumeResponseListener). Future consumeAsync(String purchaseToken) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.consumeAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([purchaseToken]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + 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) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as PlatformBillingResult?)!; + return (pigeonVar_replyList[0] as PlatformBillingResult?)!; } } /// Wraps BillingClient#queryPurchasesAsync(QueryPurchaseParams, PurchaseResponseListener). Future queryPurchasesAsync( PlatformProductType productType) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchasesAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([productType.index]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([productType]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as PlatformPurchasesResponse?)!; + return (pigeonVar_replyList[0] as PlatformPurchasesResponse?)!; } } /// Wraps BillingClient#queryPurchaseHistoryAsync(QueryPurchaseHistoryParams, PurchaseHistoryResponseListener). Future queryPurchaseHistoryAsync( PlatformProductType productType) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryPurchaseHistoryAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([productType.index]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([productType]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as PlatformPurchaseHistoryResponse?)!; + return (pigeonVar_replyList[0] as PlatformPurchaseHistoryResponse?)!; } } /// Wraps BillingClient#queryProductDetailsAsync(QueryProductDetailsParams, ProductDetailsResponseListener). Future queryProductDetailsAsync( - List products) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync'; - final BasicMessageChannel __pigeon_channel = + List products) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.queryProductDetailsAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([products]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([products]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as PlatformProductDetailsResponse?)!; + return (pigeonVar_replyList[0] as PlatformProductDetailsResponse?)!; } } /// Wraps BillingClient#isFeatureSupported(String). Future isFeatureSupported(String feature) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isFeatureSupported$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([feature]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([feature]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as bool?)!; + return (pigeonVar_replyList[0] as bool?)!; } } /// Wraps BillingClient#isAlternativeBillingOnlyAvailableAsync(). Future isAlternativeBillingOnlyAvailableAsync() async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.isAlternativeBillingOnlyAvailableAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send(null) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as PlatformBillingResult?)!; + return (pigeonVar_replyList[0] as PlatformBillingResult?)!; } } /// Wraps BillingClient#showAlternativeBillingOnlyInformationDialog(). Future showAlternativeBillingOnlyInformationDialog() async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.showAlternativeBillingOnlyInformationDialog$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send(null) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as PlatformBillingResult?)!; + return (pigeonVar_replyList[0] as PlatformBillingResult?)!; } } /// Wraps BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(AlternativeBillingOnlyReportingDetailsListener). Future createAlternativeBillingOnlyReportingDetailsAsync() async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseApi.createAlternativeBillingOnlyReportingDetailsAsync$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send(null) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send(null) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); - } else if (__pigeon_replyList[0] == null) { + } else if (pigeonVar_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] + return (pigeonVar_replyList[0] as PlatformAlternativeBillingOnlyReportingDetailsResponse?)!; } } } -class _InAppPurchaseCallbackApiCodec extends StandardMessageCodec { - const _InAppPurchaseCallbackApiCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PlatformAccountIdentifiers) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is PlatformBillingResult) { - buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is PlatformPurchase) { - buffer.putUint8(130); - writeValue(buffer, value.encode()); - } else if (value is PlatformPurchasesResponse) { - buffer.putUint8(131); - writeValue(buffer, value.encode()); - } else if (value is PlatformUserChoiceDetails) { - buffer.putUint8(132); - writeValue(buffer, value.encode()); - } else if (value is PlatformUserChoiceProduct) { - buffer.putUint8(133); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return PlatformAccountIdentifiers.decode(readValue(buffer)!); - case 129: - return PlatformBillingResult.decode(readValue(buffer)!); - case 130: - return PlatformPurchase.decode(readValue(buffer)!); - case 131: - return PlatformPurchasesResponse.decode(readValue(buffer)!); - case 132: - return PlatformUserChoiceDetails.decode(readValue(buffer)!); - case 133: - return PlatformUserChoiceProduct.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - abstract class InAppPurchaseCallbackApi { - static const MessageCodec pigeonChannelCodec = - _InAppPurchaseCallbackApiCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); /// Called for BillingClientStateListener#onBillingServiceDisconnected(). void onBillingServiceDisconnected(int callbackHandle); @@ -1320,18 +1308,24 @@ abstract class InAppPurchaseCallbackApi { /// Called for UserChoiceBillingListener#userSelectedAlternativeBilling(UserChoiceDetails). void userSelectedalternativeBilling(PlatformUserChoiceDetails details); - static void setup(InAppPurchaseCallbackApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setUp( + InAppPurchaseCallbackApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected', + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onBillingServiceDisconnected was null.'); final List args = (message as List?)!; @@ -1351,15 +1345,16 @@ abstract class InAppPurchaseCallbackApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated', + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.onPurchasesUpdated was null.'); final List args = (message as List?)!; @@ -1380,15 +1375,16 @@ abstract class InAppPurchaseCallbackApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( - 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling', + 'dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.in_app_purchase_android.InAppPurchaseCallbackApi.userSelectedalternativeBilling was null.'); final List args = (message as List?)!; 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 d0bbc51e973e..3c15cc4750a9 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 @@ -70,11 +70,7 @@ class PlatformProductDetails { final PlatformProductType productType; final String title; final PlatformOneTimePurchaseOfferDetails? oneTimePurchaseOfferDetails; - // TODO(stuartmorgan): Make the generic type non-nullable once supported. - // https://github.com/flutter/flutter/issues/97848 - // The consuming code treats it (the entries, not the list itself) as - // non-nullable. - final List? subscriptionOfferDetails; + final List? subscriptionOfferDetails; } /// Pigeon version of ProductDetailsResponseWrapper, which contains the @@ -86,10 +82,7 @@ class PlatformProductDetailsResponse { }); final PlatformBillingResult billingResult; - // TODO(stuartmorgan): Make the generic type non-nullable once supported. - // https://github.com/flutter/flutter/issues/97848 - // The consuming code treats it as non-nullable. - final List productDetails; + final List productDetails; } /// Pigeon version of AlternativeBillingOnlyReportingDetailsWrapper, which @@ -183,10 +176,7 @@ class PlatformPurchase { final int purchaseTime; final String purchaseToken; final String signature; - // TODO(stuartmorgan): Make the type non-nullable once supported. - // https://github.com/flutter/flutter/issues/97848 - // The consuming code treats it as non-nullable. - final List products; + final List products; final bool isAutoRenewing; final String originalJson; final String developerPayload; @@ -216,10 +206,7 @@ class PlatformPurchaseHistoryRecord { final String originalJson; final String purchaseToken; final String signature; - // TODO(stuartmorgan): Make the type non-nullable once supported. - // https://github.com/flutter/flutter/issues/97848 - // The consuming code treats it as non-nullable. - final List products; + final List products; } /// Pigeon version of PurchasesHistoryResult, which contains the components of @@ -231,10 +218,7 @@ class PlatformPurchaseHistoryResponse { }); final PlatformBillingResult billingResult; - // TODO(stuartmorgan): Make the type non-nullable once supported. - // https://github.com/flutter/flutter/issues/97848 - // The consuming code treats it as non-nullable. - final List purchases; + final List purchases; } /// Pigeon version of PurchasesResultWrapper, which contains the components of @@ -246,10 +230,7 @@ class PlatformPurchasesResponse { }); final PlatformBillingResult billingResult; - // TODO(stuartmorgan): Make the generic type non-nullable once supported. - // https://github.com/flutter/flutter/issues/97848 - // The consuming code treats it as non-nullable. - final List purchases; + final List purchases; } /// Pigeon version of Java ProductDetails.SubscriptionOfferDetails. @@ -265,18 +246,12 @@ class PlatformSubscriptionOfferDetails { final String basePlanId; final String? offerId; final String offerToken; - // TODO(stuartmorgan): Make the generic type non-nullable once supported. - // https://github.com/flutter/flutter/issues/97848 - // The consuming code treats it as non-nullable. - final List offerTags; + final List offerTags; // On the native side this is actually a class called PricingPhases, // which contains nothing but a List. Since this is an // internal API, we can always add that indirection later if we need it, // so for now this bypasses that unnecessary wrapper. - // TODO(stuartmorgan): Make the generic type non-nullable once supported. - // https://github.com/flutter/flutter/issues/97848 - // The consuming code treats it as non-nullable. - final List pricingPhases; + final List pricingPhases; } /// Pigeon version of UserChoiceDetailsWrapper and Java UserChoiceDetails. @@ -289,10 +264,7 @@ class PlatformUserChoiceDetails { final String? originalExternalTransactionId; final String externalTransactionToken; - // TODO(stuartmorgan): Make the generic type non-nullable once supported. - // https://github.com/flutter/flutter/issues/97848 - // The consuming code treats it as non-nullable. - final List products; + final List products; } /// Pigeon version of UserChoiseDetails.Product. 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 f5fbddd81185..1b4a3cf737eb 100644 --- a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml @@ -29,7 +29,7 @@ dev_dependencies: sdk: flutter json_serializable: ^6.3.1 mockito: ^5.4.4 - pigeon: ^17.1.1 + pigeon: ^22.4.2 test: ^1.16.0 topics: 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 1fd6c3382453..5a93a96f9754 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 @@ -3,10 +3,11 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i3; +import 'dart:async' as _i4; import 'package:in_app_purchase_android/src/messages.g.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i3; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -93,17 +94,30 @@ class _FakePlatformAlternativeBillingOnlyReportingDetailsResponse_5 /// See the documentation for Mockito's code generation for more information. class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { @override - _i3.Future isReady() => (super.noSuchMethod( + String get pigeonVar_messageChannelSuffix => (super.noSuchMethod( + Invocation.getter(#pigeonVar_messageChannelSuffix), + returnValue: _i3.dummyValue( + this, + Invocation.getter(#pigeonVar_messageChannelSuffix), + ), + returnValueForMissingStub: _i3.dummyValue( + this, + Invocation.getter(#pigeonVar_messageChannelSuffix), + ), + ) as String); + + @override + _i4.Future isReady() => (super.noSuchMethod( Invocation.method( #isReady, [], ), - returnValue: _i3.Future.value(false), - returnValueForMissingStub: _i3.Future.value(false), - ) as _i3.Future); + returnValue: _i4.Future.value(false), + returnValueForMissingStub: _i4.Future.value(false), + ) as _i4.Future); @override - _i3.Future<_i2.PlatformBillingResult> startConnection( + _i4.Future<_i2.PlatformBillingResult> startConnection( int? callbackHandle, _i2.PlatformBillingChoiceMode? billingMode, ) => @@ -115,7 +129,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { billingMode, ], ), - returnValue: _i3.Future<_i2.PlatformBillingResult>.value( + returnValue: _i4.Future<_i2.PlatformBillingResult>.value( _FakePlatformBillingResult_0( this, Invocation.method( @@ -126,7 +140,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { ], ), )), - returnValueForMissingStub: _i3.Future<_i2.PlatformBillingResult>.value( + returnValueForMissingStub: _i4.Future<_i2.PlatformBillingResult>.value( _FakePlatformBillingResult_0( this, Invocation.method( @@ -137,26 +151,26 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { ], ), )), - ) as _i3.Future<_i2.PlatformBillingResult>); + ) as _i4.Future<_i2.PlatformBillingResult>); @override - _i3.Future endConnection() => (super.noSuchMethod( + _i4.Future endConnection() => (super.noSuchMethod( Invocation.method( #endConnection, [], ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i3.Future<_i2.PlatformBillingConfigResponse> getBillingConfigAsync() => + _i4.Future<_i2.PlatformBillingConfigResponse> getBillingConfigAsync() => (super.noSuchMethod( Invocation.method( #getBillingConfigAsync, [], ), - returnValue: _i3.Future<_i2.PlatformBillingConfigResponse>.value( + returnValue: _i4.Future<_i2.PlatformBillingConfigResponse>.value( _FakePlatformBillingConfigResponse_1( this, Invocation.method( @@ -165,7 +179,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { ), )), returnValueForMissingStub: - _i3.Future<_i2.PlatformBillingConfigResponse>.value( + _i4.Future<_i2.PlatformBillingConfigResponse>.value( _FakePlatformBillingConfigResponse_1( this, Invocation.method( @@ -173,17 +187,17 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [], ), )), - ) as _i3.Future<_i2.PlatformBillingConfigResponse>); + ) as _i4.Future<_i2.PlatformBillingConfigResponse>); @override - _i3.Future<_i2.PlatformBillingResult> launchBillingFlow( + _i4.Future<_i2.PlatformBillingResult> launchBillingFlow( _i2.PlatformBillingFlowParams? params) => (super.noSuchMethod( Invocation.method( #launchBillingFlow, [params], ), - returnValue: _i3.Future<_i2.PlatformBillingResult>.value( + returnValue: _i4.Future<_i2.PlatformBillingResult>.value( _FakePlatformBillingResult_0( this, Invocation.method( @@ -191,7 +205,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [params], ), )), - returnValueForMissingStub: _i3.Future<_i2.PlatformBillingResult>.value( + returnValueForMissingStub: _i4.Future<_i2.PlatformBillingResult>.value( _FakePlatformBillingResult_0( this, Invocation.method( @@ -199,17 +213,17 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [params], ), )), - ) as _i3.Future<_i2.PlatformBillingResult>); + ) as _i4.Future<_i2.PlatformBillingResult>); @override - _i3.Future<_i2.PlatformBillingResult> acknowledgePurchase( + _i4.Future<_i2.PlatformBillingResult> acknowledgePurchase( String? purchaseToken) => (super.noSuchMethod( Invocation.method( #acknowledgePurchase, [purchaseToken], ), - returnValue: _i3.Future<_i2.PlatformBillingResult>.value( + returnValue: _i4.Future<_i2.PlatformBillingResult>.value( _FakePlatformBillingResult_0( this, Invocation.method( @@ -217,7 +231,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [purchaseToken], ), )), - returnValueForMissingStub: _i3.Future<_i2.PlatformBillingResult>.value( + returnValueForMissingStub: _i4.Future<_i2.PlatformBillingResult>.value( _FakePlatformBillingResult_0( this, Invocation.method( @@ -225,16 +239,16 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [purchaseToken], ), )), - ) as _i3.Future<_i2.PlatformBillingResult>); + ) as _i4.Future<_i2.PlatformBillingResult>); @override - _i3.Future<_i2.PlatformBillingResult> consumeAsync(String? purchaseToken) => + _i4.Future<_i2.PlatformBillingResult> consumeAsync(String? purchaseToken) => (super.noSuchMethod( Invocation.method( #consumeAsync, [purchaseToken], ), - returnValue: _i3.Future<_i2.PlatformBillingResult>.value( + returnValue: _i4.Future<_i2.PlatformBillingResult>.value( _FakePlatformBillingResult_0( this, Invocation.method( @@ -242,7 +256,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [purchaseToken], ), )), - returnValueForMissingStub: _i3.Future<_i2.PlatformBillingResult>.value( + returnValueForMissingStub: _i4.Future<_i2.PlatformBillingResult>.value( _FakePlatformBillingResult_0( this, Invocation.method( @@ -250,17 +264,17 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [purchaseToken], ), )), - ) as _i3.Future<_i2.PlatformBillingResult>); + ) as _i4.Future<_i2.PlatformBillingResult>); @override - _i3.Future<_i2.PlatformPurchasesResponse> queryPurchasesAsync( + _i4.Future<_i2.PlatformPurchasesResponse> queryPurchasesAsync( _i2.PlatformProductType? productType) => (super.noSuchMethod( Invocation.method( #queryPurchasesAsync, [productType], ), - returnValue: _i3.Future<_i2.PlatformPurchasesResponse>.value( + returnValue: _i4.Future<_i2.PlatformPurchasesResponse>.value( _FakePlatformPurchasesResponse_2( this, Invocation.method( @@ -269,7 +283,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { ), )), returnValueForMissingStub: - _i3.Future<_i2.PlatformPurchasesResponse>.value( + _i4.Future<_i2.PlatformPurchasesResponse>.value( _FakePlatformPurchasesResponse_2( this, Invocation.method( @@ -277,17 +291,17 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [productType], ), )), - ) as _i3.Future<_i2.PlatformPurchasesResponse>); + ) as _i4.Future<_i2.PlatformPurchasesResponse>); @override - _i3.Future<_i2.PlatformPurchaseHistoryResponse> queryPurchaseHistoryAsync( + _i4.Future<_i2.PlatformPurchaseHistoryResponse> queryPurchaseHistoryAsync( _i2.PlatformProductType? productType) => (super.noSuchMethod( Invocation.method( #queryPurchaseHistoryAsync, [productType], ), - returnValue: _i3.Future<_i2.PlatformPurchaseHistoryResponse>.value( + returnValue: _i4.Future<_i2.PlatformPurchaseHistoryResponse>.value( _FakePlatformPurchaseHistoryResponse_3( this, Invocation.method( @@ -296,7 +310,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { ), )), returnValueForMissingStub: - _i3.Future<_i2.PlatformPurchaseHistoryResponse>.value( + _i4.Future<_i2.PlatformPurchaseHistoryResponse>.value( _FakePlatformPurchaseHistoryResponse_3( this, Invocation.method( @@ -304,17 +318,17 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [productType], ), )), - ) as _i3.Future<_i2.PlatformPurchaseHistoryResponse>); + ) as _i4.Future<_i2.PlatformPurchaseHistoryResponse>); @override - _i3.Future<_i2.PlatformProductDetailsResponse> queryProductDetailsAsync( - List<_i2.PlatformQueryProduct?>? products) => + _i4.Future<_i2.PlatformProductDetailsResponse> queryProductDetailsAsync( + List<_i2.PlatformQueryProduct>? products) => (super.noSuchMethod( Invocation.method( #queryProductDetailsAsync, [products], ), - returnValue: _i3.Future<_i2.PlatformProductDetailsResponse>.value( + returnValue: _i4.Future<_i2.PlatformProductDetailsResponse>.value( _FakePlatformProductDetailsResponse_4( this, Invocation.method( @@ -323,7 +337,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { ), )), returnValueForMissingStub: - _i3.Future<_i2.PlatformProductDetailsResponse>.value( + _i4.Future<_i2.PlatformProductDetailsResponse>.value( _FakePlatformProductDetailsResponse_4( this, Invocation.method( @@ -331,26 +345,26 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [products], ), )), - ) as _i3.Future<_i2.PlatformProductDetailsResponse>); + ) as _i4.Future<_i2.PlatformProductDetailsResponse>); @override - _i3.Future isFeatureSupported(String? feature) => (super.noSuchMethod( + _i4.Future isFeatureSupported(String? feature) => (super.noSuchMethod( Invocation.method( #isFeatureSupported, [feature], ), - returnValue: _i3.Future.value(false), - returnValueForMissingStub: _i3.Future.value(false), - ) as _i3.Future); + returnValue: _i4.Future.value(false), + returnValueForMissingStub: _i4.Future.value(false), + ) as _i4.Future); @override - _i3.Future<_i2.PlatformBillingResult> + _i4.Future<_i2.PlatformBillingResult> isAlternativeBillingOnlyAvailableAsync() => (super.noSuchMethod( Invocation.method( #isAlternativeBillingOnlyAvailableAsync, [], ), - returnValue: _i3.Future<_i2.PlatformBillingResult>.value( + returnValue: _i4.Future<_i2.PlatformBillingResult>.value( _FakePlatformBillingResult_0( this, Invocation.method( @@ -359,7 +373,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { ), )), returnValueForMissingStub: - _i3.Future<_i2.PlatformBillingResult>.value( + _i4.Future<_i2.PlatformBillingResult>.value( _FakePlatformBillingResult_0( this, Invocation.method( @@ -367,16 +381,16 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [], ), )), - ) as _i3.Future<_i2.PlatformBillingResult>); + ) as _i4.Future<_i2.PlatformBillingResult>); @override - _i3.Future<_i2.PlatformBillingResult> + _i4.Future<_i2.PlatformBillingResult> showAlternativeBillingOnlyInformationDialog() => (super.noSuchMethod( Invocation.method( #showAlternativeBillingOnlyInformationDialog, [], ), - returnValue: _i3.Future<_i2.PlatformBillingResult>.value( + returnValue: _i4.Future<_i2.PlatformBillingResult>.value( _FakePlatformBillingResult_0( this, Invocation.method( @@ -385,7 +399,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { ), )), returnValueForMissingStub: - _i3.Future<_i2.PlatformBillingResult>.value( + _i4.Future<_i2.PlatformBillingResult>.value( _FakePlatformBillingResult_0( this, Invocation.method( @@ -393,17 +407,17 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [], ), )), - ) as _i3.Future<_i2.PlatformBillingResult>); + ) as _i4.Future<_i2.PlatformBillingResult>); @override - _i3.Future<_i2.PlatformAlternativeBillingOnlyReportingDetailsResponse> + _i4.Future<_i2.PlatformAlternativeBillingOnlyReportingDetailsResponse> createAlternativeBillingOnlyReportingDetailsAsync() => (super.noSuchMethod( Invocation.method( #createAlternativeBillingOnlyReportingDetailsAsync, [], ), - returnValue: _i3.Future< + returnValue: _i4.Future< _i2 .PlatformAlternativeBillingOnlyReportingDetailsResponse>.value( _FakePlatformAlternativeBillingOnlyReportingDetailsResponse_5( @@ -413,7 +427,7 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [], ), )), - returnValueForMissingStub: _i3.Future< + returnValueForMissingStub: _i4.Future< _i2 .PlatformAlternativeBillingOnlyReportingDetailsResponse>.value( _FakePlatformAlternativeBillingOnlyReportingDetailsResponse_5( @@ -423,6 +437,6 @@ class MockInAppPurchaseApi extends _i1.Mock implements _i2.InAppPurchaseApi { [], ), )), - ) as _i3.Future< + ) as _i4.Future< _i2.PlatformAlternativeBillingOnlyReportingDetailsResponse>); } From 65b92ebb636bbdcbc211f8824a6b451b5a222a5b Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Fri, 4 Oct 2024 10:39:40 -0400 Subject: [PATCH 2/3] Version bump --- packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md | 4 ++++ packages/in_app_purchase/in_app_purchase_android/pubspec.yaml | 2 +- 2 files changed, 5 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 fd5167e8702c..b35fcf646e04 100644 --- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.6+9 + +* Updates Pigeon for non-nullable collection type support. + ## 0.3.6+8 * Removes dependency on org.jetbrains.kotlin:kotlin-bom. 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 1b4a3cf737eb..67878afd2ab0 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+8 +version: 0.3.6+9 environment: sdk: ^3.5.0 From 43fa9dd92bf9e5a71c47761ce436e98bcd5e3725 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Fri, 4 Oct 2024 10:42:28 -0400 Subject: [PATCH 3/3] Remove all the force-unwrapping --- .../lib/src/pigeon_converters.dart | 37 +++++-------------- 1 file changed, 9 insertions(+), 28 deletions(-) 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 7fe8a3c92f21..bc93f614704f 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 @@ -32,8 +32,6 @@ ProductDetailsResponseWrapper productDetailsResponseWrapperFromPlatform( return ProductDetailsResponseWrapper( billingResult: resultWrapperFromPlatform(response.billingResult), productDetailsList: response.productDetails - // See TODOs in messages.dart for why casting away nullability is safe. - .map((PlatformProductDetails? p) => p!) .map(productDetailsWrapperFromPlatform) .toList()); } @@ -50,9 +48,7 @@ ProductDetailsWrapper productDetailsWrapperFromPlatform( oneTimePurchaseOfferDetails: oneTimePurchaseOfferDetailsWrapperFromPlatform( product.oneTimePurchaseOfferDetails), subscriptionOfferDetails: product.subscriptionOfferDetails - // See comment in messages.dart for why casting away nullability is safe. - ?.map((PlatformSubscriptionOfferDetails? o) => o!) - .map(subscriptionOfferDetailsWrapperFromPlatform) + ?.map(subscriptionOfferDetailsWrapperFromPlatform) .toList(), ); } @@ -77,8 +73,6 @@ PurchasesHistoryResult purchaseHistoryResultFromPlatform( return PurchasesHistoryResult( billingResult: resultWrapperFromPlatform(response.billingResult), purchaseHistoryRecordList: response.purchases - // See comment in messages.dart for why casting away nullability is safe. - .map((PlatformPurchaseHistoryRecord? r) => r!) .map(purchaseHistoryRecordWrapperFromPlatform) .toList(), ); @@ -91,8 +85,7 @@ PurchaseHistoryRecordWrapper purchaseHistoryRecordWrapperFromPlatform( purchaseTime: record.purchaseTime, purchaseToken: record.purchaseToken, signature: record.signature, - // See comment in messages.dart for why casting away nullability is safe. - products: record.products.map((String? s) => s!).toList(), + products: record.products, originalJson: record.originalJson, developerPayload: record.developerPayload, ); @@ -104,11 +97,7 @@ PurchasesResultWrapper purchasesResultWrapperFromPlatform( {bool forceOkResponseCode = false}) { return PurchasesResultWrapper( billingResult: resultWrapperFromPlatform(response.billingResult), - purchasesList: response.purchases - // See TODOs in messages.dart for why casting away nullability is safe. - .map((PlatformPurchase? p) => p!) - .map(purchaseWrapperFromPlatform) - .toList(), + purchasesList: response.purchases.map(purchaseWrapperFromPlatform).toList(), responseCode: forceOkResponseCode ? BillingResponse.ok : const BillingResponseConverter() @@ -185,8 +174,7 @@ PurchaseWrapper purchaseWrapperFromPlatform(PlatformPurchase purchase) { purchaseTime: purchase.purchaseTime, purchaseToken: purchase.purchaseToken, signature: purchase.signature, - // See comment in messages.dart for why casting away nullability is safe. - products: purchase.products.map((String? s) => s!).toList(), + products: purchase.products, isAutoRenewing: purchase.isAutoRenewing, originalJson: purchase.originalJson, isAcknowledged: purchase.isAcknowledged, @@ -223,14 +211,10 @@ SubscriptionOfferDetailsWrapper subscriptionOfferDetailsWrapperFromPlatform( return SubscriptionOfferDetailsWrapper( basePlanId: offer.basePlanId, offerId: offer.offerId, - // See comment in messages.dart for why casting away nullability is safe. - offerTags: offer.offerTags.map((String? s) => s!).toList(), + offerTags: offer.offerTags, offerIdToken: offer.offerToken, - pricingPhases: offer.pricingPhases - // See comment in messages.dart for why casting away nullability is safe. - .map((PlatformPricingPhase? p) => p!) - .map(pricingPhaseWrapperFromPlatform) - .toList(), + pricingPhases: + offer.pricingPhases.map(pricingPhaseWrapperFromPlatform).toList(), ); } @@ -240,11 +224,8 @@ UserChoiceDetailsWrapper userChoiceDetailsFromPlatform( return UserChoiceDetailsWrapper( originalExternalTransactionId: details.originalExternalTransactionId ?? '', externalTransactionToken: details.externalTransactionToken, - products: details.products - // See comment in messages.dart for why casting away nullability is safe. - .map((PlatformUserChoiceProduct? p) => p!) - .map(userChoiceDetailsProductFromPlatform) - .toList(), + products: + details.products.map(userChoiceDetailsProductFromPlatform).toList(), ); }