mobile: add limit on 2fa sms setup

This commit is contained in:
Ammar Ahmed
2025-10-02 09:08:59 +05:00
parent 240d9b533f
commit 86da8a3620

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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) => {
<Pressable
key={item.title}
onPress={() => {
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={{