Skip to content

Commit

Permalink
Changes to support isIOS
Browse files Browse the repository at this point in the history
  • Loading branch information
RodriSanchez1 committed Nov 16, 2023
1 parent ac9dfb9 commit 75bd800
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 });
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 75bd800

Please sign in to comment.