Skip to content

[in_app_pur]: Bump com.android.billingclient:billing from 5.2.0 to 6.0.0 in /packages/in_app_purchase/in_app_purchase_android/android #3988

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
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 @@ -131,6 +130,7 @@ void onDetachedFromActivity() {
}

@Override
@SuppressWarnings(value = "deprecation")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally we extract deprecated code paths to a minimal helper method that we can mark as deprecated, rather than making a whole large method, since the latter will hide future issues.

This also seems like something we should have an issue and TODO for migrating to the new API.

public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
switch (call.method) {
case MethodNames.IS_READY:
Expand All @@ -156,7 +156,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 +223,7 @@ private void queryProductDetailsAsync(
});
}

@SuppressWarnings(value = "deprecation")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

private void launchBillingFlow(
String product,
@Nullable String offerToken,
Expand Down Expand Up @@ -273,7 +275,9 @@ private void launchBillingFlow(
}

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.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ public void launchBillingFlow_ok_AccountId() {
}

@Test
@SuppressWarnings(value = "deprecation")
public void launchBillingFlow_ok_Proration() {
// Fetch the product details first and query the method call
String productId = "foo";
Expand Down Expand Up @@ -454,6 +455,7 @@ public void launchBillingFlow_ok_Proration() {
}

@Test
@SuppressWarnings(value = "deprecation")
public void launchBillingFlow_ok_Proration_with_null_OldProduct() {
// Fetch the product details first and query the method call
String productId = "foo";
Expand Down Expand Up @@ -488,6 +490,7 @@ public void launchBillingFlow_ok_Proration_with_null_OldProduct() {
}

@Test
@SuppressWarnings(value = "deprecation")
public void launchBillingFlow_ok_Full() {
// Fetch the product details first and query the method call
String productId = "foo";
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