Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix pricingPhases undefined error

Ammar Ahmed82b28f8263ec
diff --git a/apps/mobile/app/components/premium/component.js b/apps/mobile/app/components/premium/component.js
index 138267d88..952657a87 100644
--- a/apps/mobile/app/components/premium/component.js
+++ b/apps/mobile/app/components/premium/component.js
@@ -167,7 +167,7 @@ export const Component = ({ close, promo }) => {
>
(
{Platform.OS === "android"
- ? pricing.product?.subscriptionOfferDetails[0].pricingPhases
+ ? pricing.product?.subscriptionOfferDetails[0]?.pricingPhases
.pricingPhaseList?.[0].formattedPrice
: pricing.product?.localizedPrice}{" "}
/ mo)
diff --git a/apps/mobile/app/components/premium/pricing-item.tsx b/apps/mobile/app/components/premium/pricing-item.tsx
index 38c147a0d..53dfcf6f8 100644
--- a/apps/mobile/app/components/premium/pricing-item.tsx
+++ b/apps/mobile/app/components/premium/pricing-item.tsx
@@ -85,7 +85,7 @@ export const PricingItem = ({
>
{Platform.OS === "android"
? (product.data as RNIap.SubscriptionAndroid | undefined)
- ?.subscriptionOfferDetails[0].pricingPhases
+ ?.subscriptionOfferDetails?.[0]?.pricingPhases
.pricingPhaseList?.[0]?.formattedPrice
: (product.data as RNIap.SubscriptionIOS | undefined)
?.localizedPrice}
diff --git a/apps/mobile/app/components/premium/pricing-plans.tsx b/apps/mobile/app/components/premium/pricing-plans.tsx
index a50dba3c5..0298231f0 100644
--- a/apps/mobile/app/components/premium/pricing-plans.tsx
+++ b/apps/mobile/app/components/premium/pricing-plans.tsx
@@ -393,7 +393,7 @@ export const PricingPlans = ({
>
{Platform.OS === "android"
? (product.data as RNIap.SubscriptionAndroid)
- ?.subscriptionOfferDetails[0].pricingPhases
+ ?.subscriptionOfferDetails[0]?.pricingPhases
.pricingPhaseList?.[0]?.formattedPrice
: (product.data as RNIap.SubscriptionIOS)
?.introductoryPrice ||
diff --git a/apps/mobile/app/screens/settings/subscription.js b/apps/mobile/app/screens/settings/subscription.js
index c208a0e73..98fca8b1f 100644
--- a/apps/mobile/app/screens/settings/subscription.js
+++ b/apps/mobile/app/screens/settings/subscription.js
@@ -90,7 +90,7 @@ export const Subscription = () => {
function getPrice() {
return Platform.OS === "android"
- ? monthlyPlan?.product?.subscriptionOfferDetails[0].pricingPhases
+ ? monthlyPlan?.product?.subscriptionOfferDetails[0]?.pricingPhases
.pricingPhaseList?.[0]?.formattedPrice
: monthlyPlan?.product?.localizedPrice;
}