Hi All,
I’ve noticed that after performing a test purchase, the Store (for Soomla) item seems to ‘Restore all purchases’ at each application start up. This leads to strange behaviour in the Store slot handlers for when actions occur.
In my app, I have three handlers for the Store item:
Store {
onRestoreAllTransactionsFinished: {
// Show dialog for restoring
}
onItemPurchased: {
// Show dialog for item successfully purchased
}
}
I thought this would be sufficient. However, due to the described behaviour of the Soomla plugin (restoring purchases at start-up), it means both the ‘onItemPurchased’ and ‘onRestoreAllTransactionsFinished’ are being triggered at each application start-up.
I introduced a boolean flag to try and alleviate this:
Store {
property bool restoring: false
onRestoreAllTransactionsStarted: {
restoring = true
}
onRestoreAllTransactionsFinished: {
if (restoring)
{
// Show dialog for restoring succesfull
}
restoring = false
}
onItemPurchased: {
if (!restoring)
{
// Show dialog for item successfully purchased
}
}
}
This almost gets the right behaviour but it isn’t great.
Is there a better way to properly differentiate between a user-triggered store purchase and the start-up restoration?
Many thanks!