Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async componentDidMount() {
try {
this.purchaserInfoUpdateListener = (info) => {
checkIfPro(info, this.props.navigation);
};
this.shouldPurchasePromoProduct = async deferredPurchase => {
this.deferredPurchase = deferredPurchase;
};
Purchases.addPurchaserInfoUpdateListener(this.purchaserInfoUpdateListener);
Purchases.addShouldPurchasePromoProductListener(this.shouldPurchasePromoProduct);
const offerings = await Purchases.getOfferings();
// eslint-disable-next-line no-console
console.log(JSON.stringify(offerings));
this.setState({
offerings,
proAnnualPrice: `Buy Annual w/ Trial ${
offerings.current.annual.product.price_string
}`,
proMonthlyPrice: `Buy Monthly w/ Trial ${
offerings.current.lifetime.product.price_string
}`
});
} catch (e) {
// eslint-disable-next-line no-console
console.log("Error handling");