From 86da8a3620d13f944bd96e98eb6fd311640337f7 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Thu, 2 Oct 2025 09:08:59 +0500 Subject: [PATCH] mobile: add limit on 2fa sms setup --- apps/mobile/app/screens/settings/2fa.tsx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/mobile/app/screens/settings/2fa.tsx b/apps/mobile/app/screens/settings/2fa.tsx index b1bd0b17b..29a73cd2f 100644 --- a/apps/mobile/app/screens/settings/2fa.tsx +++ b/apps/mobile/app/screens/settings/2fa.tsx @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { sanitizeFilename } from "@notesnook/common"; +import { sanitizeFilename, useIsFeatureAvailable } from "@notesnook/common"; import { strings } from "@notesnook/intl"; import { useThemeColors, VariantsWithStaticColors } from "@notesnook/theme"; import Clipboard from "@react-native-clipboard/clipboard"; @@ -54,6 +54,7 @@ import { eCloseSheet } from "../../utils/events"; import { AppFontSize } from "../../utils/size"; import { sleep } from "../../utils/time"; import { DefaultAppStyles } from "../../utils/styles"; +import PaywallSheet from "../../components/sheets/paywall"; const mfaMethods: MFAMethod[] = [ { id: "app", @@ -98,6 +99,7 @@ type MFAStepProps = { export const MFAMethodsPickerStep = ({ recovery, onSuccess }: MFAStepProps) => { const { colors } = useThemeColors(); const user = useUserStore((state) => state.user); + const featureAvailable = useIsFeatureAvailable("sms2FA"); const getMethods = () => { if (!recovery) return mfaMethods; @@ -116,6 +118,22 @@ export const MFAMethodsPickerStep = ({ recovery, onSuccess }: MFAStepProps) => { { + if ( + item.id === "sms" && + featureAvailable && + !featureAvailable?.isAllowed + ) { + ToastManager.show({ + message: featureAvailable?.error, + type: "info", + context: "local", + actionText: strings.upgrade(), + func: () => { + PaywallSheet.present(featureAvailable); + } + }); + return; + } onSuccess && onSuccess(item); }} style={{