Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[in_app_purchase] Ensure purchases correctly report if they are acknowledged on Android - #4257

Merged
mvanbeusekom merged 7 commits into
flutter-team-archive:masterfrom
Baseflow:issue/85448
Aug 27, 2021
Merged

mvanbeusekom merged 7 commits into
flutter-team-archive:masterfrom
Baseflow:issue/85448

Conversation

@mvanbeusekom

Copy link
Copy Markdown
Contributor

On Android the indication if a purchase is completed (acknowledged) should be based on the Purchase.isAcknowledged() method (see documentation) instead of the PurchaseState. As described in issue flutter/flutter#85448 determining if a purchase is completed based on the state results into a problem when purchases are restored. In this case the purchase status will have a value of PurchaseStatus.restored which doesn't indicate if a purchase is "purchased and not acknowledged" or "purchased and acknowledged". This leads to developers not being able to correctly determine if a purchase still needs to be completed.

Resolves flutter/flutter#85448

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Note that unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@renefloor renefloor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

some nits

Comment thread packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md Outdated
Comment thread packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md Outdated
mvanbeusekom and others added 2 commits August 24, 2021 13:38
Co-authored-by: Rene Floor <r.floor.1@gmail.com>
Co-authored-by: Rene Floor <r.floor.1@gmail.com>
required String? transactionDate,
required this.billingClientPurchase,
required PurchaseStatus status,
bool pendingCompletePurchase = false,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks like a public API change? The minor version should be updated.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can modify it to be a non-public-API change if my below comment is applied.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, thank you for the suggestion.

verificationData: verificationData,
status: status,
) {
this.pendingCompletePurchase = pendingCompletePurchase;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since we already have billingClientPurchase, can we just use it?
pendingCompletePurchase = !billingClientPurchase.isAcknowledged
So we don't need the extra pendingCompletePurchase parameter.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are 100% correct, thank you for this suggestion. I have committed the necessary changes.

@mvanbeusekom
mvanbeusekom requested a review from cyanglaz August 24, 2021 20:11

@cyanglaz cyanglaz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@mvanbeusekom mvanbeusekom added the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label Aug 25, 2021
@mvanbeusekom

Copy link
Copy Markdown
Contributor Author

Merging this PR as the Windows Plugins tasks seem stuck and this plugin doesn't contain any windows related code which should make is save to merge as all other tasks are green.

@mvanbeusekom
mvanbeusekom merged commit 3f808c1 into flutter-team-archive:master Aug 27, 2021
@mvanbeusekom
mvanbeusekom deleted the issue/85448 branch August 27, 2021 12:44
@mvanbeusekom mvanbeusekom added needs-publishing and removed waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. labels Aug 27, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 27, 2021
fluttergithubbot pushed a commit to flutter/flutter that referenced this pull request Aug 27, 2021
fotiDim pushed a commit to fotiDim/plugins that referenced this pull request Sep 13, 2021
…wledged on Android (flutter-team-archive#4257)

* Ensure purchases correctly show they are acknowledged

* Update packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md

Co-authored-by: Rene Floor <r.floor.1@gmail.com>

* Update packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md

Co-authored-by: Rene Floor <r.floor.1@gmail.com>

* Modify so public API is not changed

Co-authored-by: Rene Floor <r.floor.1@gmail.com>
amantoux pushed a commit to amantoux/plugins that referenced this pull request Sep 27, 2021
…wledged on Android (flutter-team-archive#4257)

* Ensure purchases correctly show they are acknowledged

* Update packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md

Co-authored-by: Rene Floor <r.floor.1@gmail.com>

* Update packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md

Co-authored-by: Rene Floor <r.floor.1@gmail.com>

* Modify so public API is not changed

Co-authored-by: Rene Floor <r.floor.1@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[in_app_purchase] pendingCompletePurchase returns incorrect status

3 participants