-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[In_App_Purchase]queryPastPurchases() shouldn't block transaction updates. #2834
Conversation
static void enablePendingPurchases() { | ||
_enablePendingPurchase = true; | ||
if (Platform.isIOS) { | ||
// Setting setTransactionObserver to prevent throwing exceptions. | ||
AppStoreConnection.getOrCreateInstance(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just to make the getOrCreateInstance() call a little bit earlier?
Can user just subscribe purchaseUpdatedStream
as early as possible as we mentioned in the doc to achieve the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
## 0.3.5 | ||
|
||
* Fix the bug that `SKPaymentQueueWrapper.transactions` doesn't return all transactions. | ||
* `enablePendingPurchases` now works on iOS too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
@@ -1,3 +1,8 @@ | |||
## 0.3.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because there is no public API change, this should be 0.3.4+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo nits
## 0.3.4+1 | ||
|
||
* Fix the bug that `SKPaymentQueueWrapper.transactions` doesn't return all transactions. | ||
* Fix the app crashes if `queryPastPurchases` is called in the `main()`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits:
maybe add iOS?
Also, i don't think it crashes if queryPastPurchases
is called in the main()
.
It crashes if the InAppPurchaseConnection instance is created on main.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! THANKS
…ates. (flutter#2834) * Allow all transactions except for purchasing ones to be passed back to the Flutter side. * Restore transactions shouldn't block transaction updates
…ates. (flutter#2834) * Allow all transactions except for purchasing ones to be passed back to the Flutter side. * Restore transactions shouldn't block transaction updates
…ates. (flutter#2834) * Allow all transactions except for purchasing ones to be passed back to the Flutter side. * Restore transactions shouldn't block transaction updates
.add(transactions.where((SKPaymentTransactionWrapper wrapper) { | ||
return wrapper.transactionState != | ||
SKPaymentTransactionStateWrapper.restored; | ||
}).map((SKPaymentTransactionWrapper transaction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure queryPastPurchases() won't block transaction updates. When the client apps calls queryPastPurchases() right after app launch, they should still receive transaction updates in the purchaseUpdatedStream for transactions with state != restored.
Why did you add this filter and only give transactions that are not restored? Seems like this has resulted in a different bug, see: flutter/flutter#43957 (comment)
Description
queryPastPurchases()
won't block transaction updates. When the client apps callsqueryPastPurchases()
right after app launch, they should still receive transaction updates in thepurchaseUpdatedStream
for transactions with state != restored.Related Issues
flutter/flutter#53534
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.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?