Skip to content

[in_app_purchase_android]: Bump com.android.billingclient:billing from 5.2.0 to 6.0.0 #4219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.0+6

* Bumps com.android.billingclient:billing from 5.2.0 to 6.0.0.

## 0.3.0+5

* Bumps org.jetbrains.kotlin:kotlin-bom from 1.8.0 to 1.8.21.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ dependencies {
// org.jetbrains.kotlin:kotlin-bom artifact purpose is to align kotlin stdlib and related code versions.
// See: https://youtrack.jetbrains.com/issue/KT-55297/kotlin-stdlib-should-declare-constraints-on-kotlin-stdlib-jdk8-and-kotlin-stdlib-jdk7
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.21"))
implementation 'com.android.billingclient:billing:5.2.0'
implementation 'com.android.billingclient:billing:6.0.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.json:json:20230227'
testImplementation 'org.mockito:mockito-core:4.7.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.android.billingclient.api.BillingClient;
import com.android.billingclient.api.BillingClientStateListener;
import com.android.billingclient.api.BillingFlowParams;
import com.android.billingclient.api.BillingFlowParams.ProrationMode;
import com.android.billingclient.api.BillingResult;
import com.android.billingclient.api.ConsumeParams;
import com.android.billingclient.api.ConsumeResponseListener;
Expand Down Expand Up @@ -50,17 +49,20 @@ static final class MethodNames {
static final String END_CONNECTION = "BillingClient#endConnection()";
static final String ON_DISCONNECT = "BillingClientStateListener#onBillingServiceDisconnected()";
static final String QUERY_PRODUCT_DETAILS =
"BillingClient#queryProductDetailsAsync(QueryProductDetailsParams, ProductDetailsResponseListener)";
"BillingClient#queryProductDetailsAsync(QueryProductDetailsParams,"
+ " ProductDetailsResponseListener)";
static final String LAUNCH_BILLING_FLOW =
"BillingClient#launchBillingFlow(Activity, BillingFlowParams)";
static final String QUERY_PURCHASES_ASYNC =
"BillingClient#queryPurchasesAsync(QueryPurchaseParams, PurchaseResponseListener)";
static final String QUERY_PURCHASE_HISTORY_ASYNC =
"BillingClient#queryPurchaseHistoryAsync(QueryPurchaseHistoryParams, PurchaseHistoryResponseListener)";
"BillingClient#queryPurchaseHistoryAsync(QueryPurchaseHistoryParams,"
+ " PurchaseHistoryResponseListener)";
static final String CONSUME_PURCHASE_ASYNC =
"BillingClient#consumeAsync(ConsumeParams, ConsumeResponseListener)";
static final String ACKNOWLEDGE_PURCHASE =
"BillingClient#acknowledgePurchase(AcknowledgePurchaseParams, AcknowledgePurchaseResponseListener)";
"BillingClient#acknowledgePurchase(AcknowledgePurchaseParams,"
+ " AcknowledgePurchaseResponseListener)";
static final String IS_FEATURE_SUPPORTED = "BillingClient#isFeatureSupported(String)";
static final String GET_CONNECTION_STATE = "BillingClient#getConnectionState()";

Expand Down Expand Up @@ -131,6 +133,7 @@ void onDetachedFromActivity() {
}

@Override
@SuppressWarnings(value = "deprecation")
public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
switch (call.method) {
case MethodNames.IS_READY:
Expand All @@ -156,7 +159,8 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result
(String) call.argument("purchaseToken"),
call.hasArgument("prorationMode")
? (int) call.argument("prorationMode")
: ProrationMode.UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY,
: com.android.billingclient.api.BillingFlowParams.ProrationMode
.UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY,
result);
break;
case MethodNames.QUERY_PURCHASES_ASYNC:
Expand Down Expand Up @@ -222,6 +226,7 @@ private void queryProductDetailsAsync(
});
}

@SuppressWarnings(value = "deprecation")
private void launchBillingFlow(
String product,
@Nullable String offerToken,
Expand All @@ -241,7 +246,9 @@ private void launchBillingFlow(
"NOT_FOUND",
"Details for product "
+ product
+ " are not available. It might because products were not fetched prior to the call. Please fetch the products first. An example of how to fetch the products could be found here: "
+ " are not available. It might because products were not fetched prior to the call."
+ " Please fetch the products first. An example of how to fetch the products could be"
+ " found here: "
+ LOAD_PRODUCT_DOC_URL,
null);
return;
Expand All @@ -265,26 +272,33 @@ private void launchBillingFlow(
+ offerToken
+ " for product "
+ product
+ " is not valid. Make sure to only pass offer tokens that belong to the product. To obtain offer tokens for a product, fetch the products. An example of how to fetch the products could be found here: "
+ " is not valid. Make sure to only pass offer tokens that belong to the product."
+ " To obtain offer tokens for a product, fetch the products. An example of how to"
+ " fetch the products could be found here: "
+ LOAD_PRODUCT_DOC_URL,
null);
return;
}
}

if (oldProduct == null
&& prorationMode != ProrationMode.UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY) {
&& prorationMode
!= com.android.billingclient.api.BillingFlowParams.ProrationMode
.UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY) {
result.error(
"IN_APP_PURCHASE_REQUIRE_OLD_PRODUCT",
"launchBillingFlow failed because oldProduct is null. You must provide a valid oldProduct in order to use a proration mode.",
"launchBillingFlow failed because oldProduct is null. You must provide a valid oldProduct"
+ " in order to use a proration mode.",
null);
return;
} else if (oldProduct != null && !cachedProducts.containsKey(oldProduct)) {
result.error(
"IN_APP_PURCHASE_INVALID_OLD_PRODUCT",
"Details for product "
+ oldProduct
+ " are not available. It might because products were not fetched prior to the call. Please fetch the products first. An example of how to fetch the products could be found here: "
+ " are not available. It might because products were not fetched prior to the call."
+ " Please fetch the products first. An example of how to fetch the products could be"
+ " found here: "
+ LOAD_PRODUCT_DOC_URL,
null);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.0+5
version: 0.3.0+6

environment:
sdk: ">=2.18.0 <4.0.0"
Expand Down