From 5a228ce5fed6da0af2b55d89f034b9a7919b9e04 Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Thu, 8 Jun 2023 14:05:28 +0500 Subject: [PATCH] mobile: allow changin primary 2fa --- apps/mobile/app/screens/settings/index.tsx | 4 +-- .../app/screens/settings/settings-data.tsx | 25 +++---------------- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/apps/mobile/app/screens/settings/index.tsx b/apps/mobile/app/screens/settings/index.tsx index 186f9f261..71f016667 100644 --- a/apps/mobile/app/screens/settings/index.tsx +++ b/apps/mobile/app/screens/settings/index.tsx @@ -60,8 +60,8 @@ export const Settings = () => { { - if (e.target?.startsWith("SettingsGroup")) { + focus: (e) => { + if (e.target?.startsWith("SettingsHome-")) { useNavigationStore.getState().update({ name: "Settings" }, false); } } diff --git a/apps/mobile/app/screens/settings/settings-data.tsx b/apps/mobile/app/screens/settings/settings-data.tsx index 3d080a5ee..f79a302f9 100644 --- a/apps/mobile/app/screens/settings/settings-data.tsx +++ b/apps/mobile/app/screens/settings/settings-data.tsx @@ -179,17 +179,15 @@ export const settingsGroups: SettingSection[] = [ sections: [ { id: "enable-2fa", - name: "Enable two-factor authentication", + name: "Change primary two-factor authentication", modifer: () => { verifyUser("global", async () => { MFASheet.present(); }); }, useHook: () => useUserStore((state) => state.user), - hidden: (user) => { - return !!(user as User)?.mfa?.isEnabled; - }, - description: "Increased security for your account" + description: + "Change your current two-factor authentication method" }, { id: "2fa-fallback", @@ -241,23 +239,6 @@ export const settingsGroups: SettingSection[] = [ }, description: "View and save recovery codes for to recover your account" - }, - { - id: "disabled-2fa", - name: "Disable two-factor authentication", - modifer: () => { - verifyUser("global", async () => { - await db.mfa?.disable(); - const user = await db.user?.fetchUser(); - useUserStore.getState().setUser(user); - }); - }, - - useHook: () => useUserStore((state) => state.user), - hidden: (user) => { - return !(user as User)?.mfa?.isEnabled; - }, - description: "Decreased security for your account" } ] },