From f40ccdae41444508deba57d9799a03223d7d6511 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Sun, 5 Oct 2025 01:11:09 +0500 Subject: [PATCH] mobile: add null checks --- .../app/components/sheets/paywall/index.tsx | 9 +++++---- .../app/components/sheets/plan-limits/index.tsx | 8 ++++---- .../app/screens/settings/settings-data.tsx | 8 ++++---- .../app/screens/settings/user-section.jsx | 17 +++++++++-------- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/apps/mobile/app/components/sheets/paywall/index.tsx b/apps/mobile/app/components/sheets/paywall/index.tsx index 195352a10..8d043fd85 100644 --- a/apps/mobile/app/components/sheets/paywall/index.tsx +++ b/apps/mobile/app/components/sheets/paywall/index.tsx @@ -56,15 +56,16 @@ export default function PaywallSheet(props: { const isSubscribedOnWeb = (PremiumService.get() && - pricingPlans.user?.subscription.provider === + pricingPlans.user?.subscription?.provider === SubscriptionProvider.PADDLE) || - pricingPlans.user?.subscription.provider === + pricingPlans.user?.subscription?.provider === SubscriptionProvider.STREETWRITERS; const isCurrentPlatform = - (pricingPlans.user?.subscription.provider === SubscriptionProvider.APPLE && + (pricingPlans.user?.subscription?.provider === SubscriptionProvider.APPLE && Platform.OS === "ios") || - (pricingPlans.user?.subscription.provider === SubscriptionProvider.GOOGLE && + (pricingPlans.user?.subscription?.provider === + SubscriptionProvider.GOOGLE && Platform.OS === "android"); return !pricingPlans.currentPlan ? null : ( diff --git a/apps/mobile/app/components/sheets/plan-limits/index.tsx b/apps/mobile/app/components/sheets/plan-limits/index.tsx index d5170a07a..68ec57bcc 100644 --- a/apps/mobile/app/components/sheets/plan-limits/index.tsx +++ b/apps/mobile/app/components/sheets/plan-limits/index.tsx @@ -35,9 +35,9 @@ export function PlanLimits() { }, []); const isCurrentPlatform = - (user?.subscription.provider === SubscriptionProvider.APPLE && + (user?.subscription?.provider === SubscriptionProvider.APPLE && Platform.OS === "ios") || - (user?.subscription.provider === SubscriptionProvider.GOOGLE && + (user?.subscription?.provider === SubscriptionProvider.GOOGLE && Platform.OS === "android"); return ( @@ -84,8 +84,8 @@ export function PlanLimits() { ))} - {(user?.subscription.provider === SubscriptionProvider.PADDLE || - user?.subscription.provider === SubscriptionProvider.STREETWRITERS || + {(user?.subscription?.provider === SubscriptionProvider.PADDLE || + user?.subscription?.provider === SubscriptionProvider.STREETWRITERS || !isCurrentPlatform) && PremiumService.get() ? null : (