-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
I'm using the 0.6.0 release of in_app_purchase.
My use case is that I want to inform the user if there were no previous purchases to restore if they request to restore purchases.
This can be done, but it requires different solutions for iOS and Android. It would be nice if restorePurchases worked the same on both platforms.
iOS:
restorePurchases returns a Future that completes when paymentQueueRestoreCompletedTransactionsFinished is received from the platform:
When the Future completes, any restored purchases will have already been delivered to the StreamSubscription.
However, if there are no purchases to restore, nothing is added to the queue for purchase updates.
- Detection of "nothing to restore" can be achieved by waiting for the Future to complete, then checking if any restored purchases were delivered.
- Detection of "nothing to restore" can not be achieved by waiting for an empty result to be delivered to the
StreamSubscription.
Android:
restorePurchases returns a Future that completes after restored purchases have been added to the queue for purchase updates:
When the Future completes, the events from the queue for purchase updates have not yet been delivered to the StreamSubscription. If there are no purchases to restore, an empty List<PurchaseDetails> will be added to the queue for purchase updates.
- Detection of "nothing to restore" can not be achieved by waiting for the Future to complete, then checking if any restored purchases were delivered.
- Detection of "nothing to restore" can be achieved by waiting for an empty result to be delivered to the
StreamSubscription.
Both detection methods are fine by me, but it would be preferable to be able to use the same method on both platforms.