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

[in_app_purchase] Fix wrong _pendingCompletePurchase flag value #2504

Merged
merged 3 commits into from
Feb 6, 2020
Merged

[in_app_purchase] Fix wrong _pendingCompletePurchase flag value #2504

merged 3 commits into from
Feb 6, 2020

Conversation

malsabbagh
Copy link
Contributor

Description

When purchasing the _pendingCompletePurchase flag is always set to false as we were not using the setter that was setting _pendingCompletePurchase to true when purchasing status was true.

Related Issues

flutter/flutter#49083

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • 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 signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

When purchasing the flag is always set to false as we were not use the setter that was setting _pendingCompletePurchase to true when purchasing.
@malsabbagh malsabbagh changed the title [in_app_purchases] Fix wrong _pendingCompletePurchase flag value [in_app_purchase] Fix wrong _pendingCompletePurchase flag value Feb 6, 2020
Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! The fix is great! Would you mind add some tests before we land the PR?

Adding unit-test cases to validate the new results for  pendingCompletePurchase flag
Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you very much!

@malsabbagh
Copy link
Contributor Author

np :)

@d0bry
Copy link

d0bry commented Feb 7, 2020

To clarify, now pendingCompletePurchase remains true after completion.

If this is intended then the name may be misleading (after migration to Play Billing Library 2.0, I thought on Android it means 'not yet acknowledged'). Anyway, this may only result in redundant completePurchase calls, which is no harm.

@malsabbagh
Copy link
Contributor Author

Yea I was thinking about that use case as well. But then as you said extra calls to completePurchase won't cause issues.

@cyanglaz
Copy link
Contributor

cyanglaz commented Feb 7, 2020

@d0bry The purchases are not considered completed unless a completePurchase is called. So I guess the name is fitting. However, I think we should make our documentation clearer about this terminology.

@d0bry
Copy link

d0bry commented Feb 8, 2020

@cyanglaz Yes, I just meant that pendingCompletePurchase may suggest the purchase is not yet completed, even if it is (after completePurchase has already been called).

sanekyy pushed a commit to sanekyy/plugins that referenced this pull request Feb 18, 2020
EdwinRomelta pushed a commit to EdwinRomelta/plugins that referenced this pull request Jun 11, 2020
FlutterSu pushed a commit to FlutterSu/flutter-plugins that referenced this pull request Nov 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
4 participants