1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

InAppPurchases: Add support for Android BillingClient 5.0.0

This commit is contained in:
reuk 2022-02-15 20:09:34 +00:00
parent 7c66dc8e15
commit 6375f640db
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
7 changed files with 402 additions and 185 deletions

View file

@ -192,20 +192,23 @@ private:
{
purchaseInProgress = false;
auto idx = findVoiceIndexFromIdentifier (info.purchase.productId);
if (isPositiveAndBelow (idx, voiceProducts.size()))
for (const auto productId : info.purchase.productIds)
{
auto& voiceProduct = voiceProducts.getReference (idx);
auto idx = findVoiceIndexFromIdentifier (productId);
voiceProduct.isPurchased = success;
voiceProduct.purchaseInProgress = false;
}
else
{
// On failure Play Store will not tell us which purchase failed
for (auto& voiceProduct : voiceProducts)
if (isPositiveAndBelow (idx, voiceProducts.size()))
{
auto& voiceProduct = voiceProducts.getReference (idx);
voiceProduct.isPurchased = success;
voiceProduct.purchaseInProgress = false;
}
else
{
// On failure Play Store will not tell us which purchase failed
for (auto& voiceProduct : voiceProducts)
voiceProduct.purchaseInProgress = false;
}
}
guiUpdater.triggerAsyncUpdate();
@ -217,13 +220,16 @@ private:
{
for (auto& info : infos)
{
auto idx = findVoiceIndexFromIdentifier (info.purchase.productId);
if (isPositiveAndBelow (idx, voiceProducts.size()))
for (const auto productId : info.purchase.productIds)
{
auto& voiceProduct = voiceProducts.getReference (idx);
auto idx = findVoiceIndexFromIdentifier (productId);
voiceProduct.isPurchased = true;
if (isPositiveAndBelow (idx, voiceProducts.size()))
{
auto& voiceProduct = voiceProducts.getReference (idx);
voiceProduct.isPurchased = true;
}
}
}