A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
mobile: fix pricing on github release
Ammar Ahmedda06afda8a94
diff --git a/apps/mobile/app/components/paywall/index.tsx b/apps/mobile/app/components/paywall/index.tsxindex a007769d5..6f7a7bca5 100644--- a/apps/mobile/app/components/paywall/index.tsx+++ b/apps/mobile/app/components/paywall/index.tsx@@ -940,19 +940,22 @@ const PricingPlanCard = ({regionalDiscount?.sku ||`notesnook.${plan.id}.${annualBilling ? "yearly" : "monthly"}`];- const price = pricingPlans?.getPrice(- product as RNIap.Subscription,- pricingPlans.hasTrialOffer(plan.id, product?.productId) ? 1 : 0,- annualBilling- );const WebPlan = pricingPlans?.getWebPlan(plan.id,annualBilling ? "yearly" : "monthly");+ const price = pricingPlans?.getPrice(+ pricingPlans.isGithubRelease && WebPlan+ ? WebPlan+ : (product as RNIap.Subscription),+ pricingPlans.hasTrialOffer(plan.id, product?.productId) ? 1 : 0,+ annualBilling+ );+useEffect(() => {- if (pricingPlans?.isGithubRelease) return;+ if (pricingPlans?.isGithubRelease || !annualBilling) return;pricingPlans?.getRegionalDiscount(plan.id,@@ -963,7 +966,13 @@ const PricingPlanCard = ({.then((value) => {setRegionaDiscount(value);});- }, []);+ }, [annualBilling]);++ useEffect(() => {+ if (!annualBilling) {+ setRegionaDiscount(undefined);+ }+ }, [annualBilling]);const isSubscribed =product?.productId &&@@ -994,8 +1003,8 @@ const PricingPlanCard = ({: "monthly"}`: pricingPlans.isGithubRelease- ? (WebPlan?.period as string)- : (product?.productId as string)+ ? (WebPlan?.period as string)+ : (product?.productId as string));setStep(Steps.buy);}}@@ -1117,12 +1126,12 @@ const PricingPlanCard = ({{annualBilling? strings.billedAnnually(pricingPlans?.getStandardPrice(- (product as RNIap.Subscription) || (WebPlan as Plan)+ (product || WebPlan) as any) as string): strings.billedMonthly(pricingPlans?.getStandardPrice(- (product as RNIap.Subscription) || (WebPlan as Plan)+ (product || WebPlan) as any) as string)}</Paragraph>diff --git a/apps/mobile/app/components/sheets/buy-plan/index.tsx b/apps/mobile/app/components/sheets/buy-plan/index.tsxindex 0692a2312..e073e599f 100644--- a/apps/mobile/app/components/sheets/buy-plan/index.tsx+++ b/apps/mobile/app/components/sheets/buy-plan/index.tsx@@ -73,6 +73,13 @@ export const BuyPlan = (props: {}}><Paragraph>{strings.finishPurchaseInBrowser()}</Paragraph>+ <Button+ title={strings.next()}+ type="accent"+ onPress={() => {+ pricingPlans.finish();+ }}+ /><Buttontitle={strings.goBack()}onPress={() => {diff --git a/apps/mobile/app/hooks/use-pricing-plans.ts b/apps/mobile/app/hooks/use-pricing-plans.tsindex f854bc93c..3e4c6d461 100644--- a/apps/mobile/app/hooks/use-pricing-plans.ts+++ b/apps/mobile/app/hooks/use-pricing-plans.ts@@ -272,9 +272,9 @@ const usePricingPlans = (options?: PricingPlansOptions) => {if (!(product as Plan)?.price) return null;return `${(product as Plan).price.currency} ${(product as Plan).period === "yearly"- ? ((product as Plan).price.gross / 12).toFixed(2)+ ? (product as Plan).price.gross: (product as Plan).period === "5-year"- ? ((product as Plan).price.gross / (12 * 5)).toFixed(2)+ ? (product as Plan).price.gross: (product as Plan).price.gross}`;}diff --git a/apps/mobile/app/services/premium.ts b/apps/mobile/app/services/premium.tsindex 8ca5bd9d9..7a187d16a 100644--- a/apps/mobile/app/services/premium.ts+++ b/apps/mobile/app/services/premium.ts@@ -58,6 +58,7 @@ async function setPremiumStatus() {async function loadProductsAndSubs() {try {+ if (Config.GITHUB_RELEASE === "true") throw new Error("Github release");if (!subs || subs.length === 0) {subs = await RNIap.getSubscriptions({skus: itemSkus