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

Conversation

@mvanbeusekom
Copy link
Contributor

The InAppPurchaseIosPlatform.purchaseStream will emit an empty list when after calling the InAppPurchaseIosPlatform.restoreTransactions()there are not transactions to restore.

Note that this is a breaking change as the results emitted on the purchaseStream are changing.

Resolves flutter/flutter#82795

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. (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, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this 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.

The `InAppPurchaseIosPlatform.purchaseStream` will emit an empty list
when after calling  the `InAppPurchaseIosPlatform.restoreTransactions()`
there are not transactions to restore.
late String _receiptData;

bool _isRestoringTransactions = false;
bool _didReceiveRestoredTransactions = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be less error-prone as a single state enum rather than two bools; that way it's impossible to have a bug one one is reset but the other isn't. E.g.:

enum _TransactionRestoreState {
  notRunning,
  waitingForTransactions,
  receivedTransaction,
}

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM other than a small update for the rename.

@@ -1,3 +1,7 @@
## 0.3.0

* **BREAKING CHANGE:** `InAppPurchaseIosPlatform.restorePurchase()` emits an empty instance of `List<ProductDetails>` when there were no transactions to restore, indicating that the restore procedure has finished.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/Ios/StoreKit/

@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 Nov 19, 2021
@fluttergithubbot fluttergithubbot merged commit fe1a3c4 into flutter:master Nov 19, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 19, 2021
@mvanbeusekom mvanbeusekom deleted the issue/82795 branch November 22, 2021 07:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes p: in_app_purchase waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[in_app_purchase] restorePurchases handles "nothing to restore"-case differently on iOS and Android

3 participants