From 28d8607761f38560fbefb6a7521485ed9fd7fb89 Mon Sep 17 00:00:00 2001 From: shahid Date: Thu, 12 Dec 2024 23:04:58 +0530 Subject: [PATCH 1/2] Skip auto-renew survey for users with no billing history when disabling auto-renew --- .../settings/Subscription/SubscriptionSettings/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/settings/Subscription/SubscriptionSettings/index.tsx b/src/pages/settings/Subscription/SubscriptionSettings/index.tsx index 3af05e1ef1cd..29828c44d8cf 100644 --- a/src/pages/settings/Subscription/SubscriptionSettings/index.tsx +++ b/src/pages/settings/Subscription/SubscriptionSettings/index.tsx @@ -24,6 +24,7 @@ function SubscriptionSettings() { const {translate} = useLocalize(); const styles = useThemeStyles(); const theme = useTheme(); + const [account] = useOnyx(ONYXKEYS.ACCOUNT); const [privateSubscription] = useOnyx(ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION); const preferredCurrency = usePreferredCurrency(); const possibleCostSavings = useSubscriptionPossibleCostSavings(); @@ -41,7 +42,11 @@ function SubscriptionSettings() { Subscription.updateSubscriptionAutoRenew(true); return; } - Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION_DISABLE_AUTO_RENEW_SURVEY); + if (!!account?.hasPurchases) { + Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION_DISABLE_AUTO_RENEW_SURVEY); + } else { + Subscription.updateSubscriptionAutoRenew(false); + } }; const handleAutoIncreaseToggle = () => { From 8931dbde831ecfe40fd044fa519d168231dd30b8 Mon Sep 17 00:00:00 2001 From: shahid Date: Thu, 12 Dec 2024 23:32:18 +0530 Subject: [PATCH 2/2] fix eslint error --- .../settings/Subscription/SubscriptionSettings/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/settings/Subscription/SubscriptionSettings/index.tsx b/src/pages/settings/Subscription/SubscriptionSettings/index.tsx index 29828c44d8cf..a624244bafeb 100644 --- a/src/pages/settings/Subscription/SubscriptionSettings/index.tsx +++ b/src/pages/settings/Subscription/SubscriptionSettings/index.tsx @@ -28,7 +28,7 @@ function SubscriptionSettings() { const [privateSubscription] = useOnyx(ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION); const preferredCurrency = usePreferredCurrency(); const possibleCostSavings = useSubscriptionPossibleCostSavings(); - const [isActingAsDelegate] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => account?.delegatedAccess?.delegate}); + const isActingAsDelegate = !!account?.delegatedAccess?.delegate; const [isNoDelegateAccessMenuVisible, setIsNoDelegateAccessMenuVisible] = useState(false); const autoRenewalDate = formatSubscriptionEndDate(privateSubscription?.endDate); @@ -42,7 +42,7 @@ function SubscriptionSettings() { Subscription.updateSubscriptionAutoRenew(true); return; } - if (!!account?.hasPurchases) { + if (account?.hasPurchases) { Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION_DISABLE_AUTO_RENEW_SURVEY); } else { Subscription.updateSubscriptionAutoRenew(false);