I have caught an error case when using the library with the following scenario:
My app has a login, so IAPHub.setId() is called on successful login
I init the library BEFORE the login as part of my initial loading process
Any user makes a pruchase while logged in - all works great
The user then uninstalls the app or logs out
If the app is restarted at that stage the "User id required" error is thrown
I have investigated what happens and it turnes out in the initialization of the library there's this piece of code:
// Init purchase updated listener
if (!this.purchaseUpdatedListener) {
this.purchaseUpdatedListener = RNIap.purchaseUpdatedListener((purchase) => {
// Add receipt to the queue
this.receiptQueue.add({date: new Date(), purchase: purchase})
// Resume queues in case it was paused
this.resumeQueues();
});
}
As the device account actually has an active purchase - the receiptQueue method gets called which then calls processReceipt, which then calls fetchUser which throws the error. But at this point we don't have a valid user logged in, so the error is thrown which seems wrong. The restore should be triggered manually after the user logs in I think.
Hello,
I have caught an error case when using the library with the following scenario:
I have investigated what happens and it turnes out in the initialization of the library there's this piece of code:
As the device account actually has an active purchase - the receiptQueue method gets called which then calls
processReceipt
, which then callsfetchUser
which throws the error. But at this point we don't have a valid user logged in, so the error is thrown which seems wrong. The restore should be triggered manually after the user logs in I think.