From 75bd80041a0a27d6d0b6c99ba3ac2999a83362f3 Mon Sep 17 00:00:00 2001 From: Rodri Sanchez Date: Thu, 16 Nov 2023 16:57:42 -0300 Subject: [PATCH] Changes to support isIOS --- .../SubscriptionProvider.container.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/providers/SubscriptionProvider/SubscriptionProvider.container.js b/src/providers/SubscriptionProvider/SubscriptionProvider.container.js index d6277a13e..a2c8f09d8 100644 --- a/src/providers/SubscriptionProvider/SubscriptionProvider.container.js +++ b/src/providers/SubscriptionProvider/SubscriptionProvider.container.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import API from '../../api'; -import { isAndroid } from '../../cordova-util'; +import { isAndroid, isIOS } from '../../cordova-util'; import { updateIsInFreeCountry, @@ -41,7 +41,7 @@ export class SubscriptionProvider extends Component { const isInFreeCountry = updateIsInFreeCountry(); const isOnTrialPeriod = updateIsOnTrialPeriod(); await updatePlans(); - if (isAndroid()) this.configInAppPurchasePlugin(); + if (isAndroid() || isIOS()) this.configInAppPurchasePlugin(); if (!isInFreeCountry && !isOnTrialPeriod && !isSubscribed && isLogged) { showPremiumRequired({ showTryPeriodFinishedMessages: true }); } @@ -111,9 +111,9 @@ export class SubscriptionProvider extends Component { window.CdvPurchase.store.validator = async function(receipt, callback) { try { - const transaction = isAndroid() - ? transformReceipt(receipt) - : receipt.transactions[0]; + const transaction = isIOS() + ? receipt.transaction + : transformReceipt(receipt); const res = await API.postTransaction(transaction); if (!res.ok) throw res;