Is there any way inside when().approved() or when().finished() to determine whether the trigger was a call to store.order(), store.restorePurchases(), or store.initialize()? I'd like to notify the user of a restored/finished purchase, but don't want to annoy them in case they just made a normal order. I tried to keep track using the promises that store.restorePurchases() and store.initialize() return, but they seem to complete before when().approved() fires.
Related is the following scenario:
- The user makes a purchase using the slow test card
- The user closes the app
- The purchase is completed
- The user starts the app
store.initialize() is called and in turn fires store.productUpdated(). The product has canPurchase=false. The UI is updated accordingly.
- Then,
when().approved() is fired and the purchase is finished. The product, presumably, now has canPurchase=true, but I can't be sure unless I call store.update(). But calling that every time a purchase finishes feels wrong and its throttling mechanism would yield mixed results anyway.
What is the intended way to deal with this scenario?
Any help is appreciated!
Is there any way inside
when().approved()orwhen().finished()to determine whether the trigger was a call tostore.order(),store.restorePurchases(), orstore.initialize()? I'd like to notify the user of a restored/finished purchase, but don't want to annoy them in case they just made a normal order. I tried to keep track using the promises thatstore.restorePurchases()andstore.initialize()return, but they seem to complete beforewhen().approved()fires.Related is the following scenario:
store.initialize()is called and in turn firesstore.productUpdated(). The product hascanPurchase=false. The UI is updated accordingly.when().approved()is fired and the purchase is finished. The product, presumably, now hascanPurchase=true, but I can't be sure unless I callstore.update(). But calling that every time a purchase finishes feels wrong and its throttling mechanism would yield mixed results anyway.What is the intended way to deal with this scenario?
Any help is appreciated!