INNER CODE UNIT · TypeScript
isSubscribed
Flaque/quirk · src/payments/index.ts:40
export const isSubscribed = async (): Promise<boolean> => {
try {
if (await isGrandfatheredIntoFreeSubscription()) {
return true;
}
const purchaserInfo = await Purchases.getPurchaserInfo();
return isValidPurchaserInfo(purchaserInfo);
} catch (err) {
log("User let in on error", err);
Sentry.captureException(err);
return true; // TODO set this to false once you figure out the error
}
};
export const latestExpirationDate = async (): Promise<string> => {
const purchaserInfo = await Purchases.getPurchaserInfo();
return purchaserInfo.latestExpirationDate;