mobile: fix crash in settings -> user subscription

This commit is contained in:
Ammar Ahmed
2025-05-17 10:05:02 +05:00
committed by Ammar Ahmed
parent 93713d58d4
commit 3e86167842

View File

@@ -82,7 +82,8 @@ export const settingsGroups: SettingSection[] = [
useHook: () => useUserStore((state) => state.user),
hidden: (current) => !current,
name: (current) => {
const user = current as User;
const user = (current as User) || useUserStore.getState().user;
if (!user) return strings.subscribeToPro();
const isBasic = user.subscription?.type === SUBSCRIPTION_STATUS.BASIC;
const isTrial = user.subscription?.type === SUBSCRIPTION_STATUS.TRIAL;
return isBasic || !user.subscription?.type
@@ -96,6 +97,7 @@ export const settingsGroups: SettingSection[] = [
icon: "crown",
description: (current) => {
const user = current as User;
if (!user) return strings.neverHesitate();
const subscriptionDaysLeft =
user &&
getTimeLeft(