Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
format
  • Loading branch information
Gray Mackall committed Jul 6, 2023
commit b1a7ce8b0bc05080dc1e1a707990e63de23c998f
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ private MethodNames() {}
// https://github.com/flutter/flutter/issues/128957
@SuppressWarnings(value = "deprecation")
private static final int PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY =
com.android.billingclient.api.BillingFlowParams
.ProrationMode.UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY;
com.android.billingclient.api.BillingFlowParams.ProrationMode
.UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY;

private static final String TAG = "InAppPurchasePlugin";
private static final String LOAD_PRODUCT_DOC_URL =
Expand Down Expand Up @@ -163,7 +163,7 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result
(String) call.argument("purchaseToken"),
call.hasArgument("prorationMode")
? (int) call.argument("prorationMode")
: PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY,
: PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY,
result);
break;
case MethodNames.QUERY_PURCHASES_ASYNC:
Expand Down Expand Up @@ -280,8 +280,7 @@ private void launchBillingFlow(
}

if (oldProduct == null
&& prorationMode
!= PRORATION_MODE_UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY) {
&& prorationMode != PRORATION_MODE_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 Expand Up @@ -341,7 +340,8 @@ private void launchBillingFlow(
// TODO(gmackall): Replace uses of deprecated setReplaceProrationMode
// https://github.com/flutter/flutter/issues/128957
@SuppressWarnings(value = "deprecation")
private void setReplaceProrationMode(BillingFlowParams.SubscriptionUpdateParams.Builder builder, int prorationMode) {
private void setReplaceProrationMode(
BillingFlowParams.SubscriptionUpdateParams.Builder builder, int prorationMode) {
// The proration mode value has to match one of the following declared in
// https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.ProrationMode
builder.setReplaceProrationMode(prorationMode);
Expand Down