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 {
const info = await Purchases.getPurchaserInfo();
this.handleInfo(info);
} catch (e) {
// eslint-disable-next-line no-console
console.log("Error handling");
}
}
async componentDidMount() {
Purchases.setDebugLogsEnabled(true);
Purchases.setup("api_key");
try {
const purchaserInfo = await Purchases.getPurchaserInfo();
if (typeof purchaserInfo.entitlements.active.pro_cat !== "undefined") {
this.setState({
load: "Cats",
loading: false
});
} else {
this.setState({
load: "Upsell",
loading: false
});
}
} catch (e) {
// eslint-disable-next-line no-console
console.log(`Error ${JSON.stringify(e)}`);
}
}
onPress={async () => {
try {
const info = await Purchases.restoreTransactions();
this.handleInfo(info);
} catch (e) {
// eslint-disable-next-line no-console
console.log(JSON.stringify(e));
}
}}
>
async componentDidMount() {
Purchases.setDebugLogsEnabled(true);
Purchases.setup("api_key");
try {
const purchaserInfo = await Purchases.getPurchaserInfo();
if (typeof purchaserInfo.entitlements.active.pro_cat !== "undefined") {
this.setState({
load: "Cats",
loading: false
});
} else {
this.setState({
load: "Upsell",
loading: false
});
}
} catch (e) {
// eslint-disable-next-line no-console
console.log(`Error ${JSON.stringify(e)}`);
onPress={async () => {
const aPackage = this.state.offerings.current.lifetime;
try {
const purchaseMade = await Purchases.purchasePackage(aPackage, {oldSKU: "old", prorationMode: Purchases.PRORATION_MODE.DEFERRED}, Purchases.PURCHASE_TYPE.SUBS);
checkIfPro(purchaseMade.purchaserInfo, this.props.navigation);
} catch (e) {
if (!e.userCancelled) {
// eslint-disable-next-line no-console
console.log(`Error handling ${JSON.stringify(e)}`);
} else {
// eslint-disable-next-line no-console
console.log(`User cancelled ${JSON.stringify(e)}`);
}
}
}}
title={this.state.proMonthlyPrice}
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");
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");
}
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");
}
}
onPress={async () => {
const product = this.state.offerings.current.annual.product.identifier;
try {
const purchaseMade = await Purchases.purchaseProduct(product);
checkIfPro(purchaseMade.purchaserInfo, this.props.navigation);
} catch (e) {
if (!e.userCancelled) {
// eslint-disable-next-line no-console
console.log(`Error handling ${JSON.stringify(e)}`);
} else {
// eslint-disable-next-line no-console
console.log(`User cancelled ${JSON.stringify(e)}`);
}
}
}}
title={this.state.proAnnualPrice}
async componentDidMount() {
Purchases.setDebugLogsEnabled(true);
Purchases.setup("api_key");
try {
const purchaserInfo = await Purchases.getPurchaserInfo();
if (typeof purchaserInfo.entitlements.active.pro_cat !== "undefined") {
this.setState({
load: "Cats",
loading: false
});
} else {
this.setState({
load: "Upsell",
loading: false
});
}
} catch (e) {
// eslint-disable-next-line no-console