From d0c01a0e5cb656661b75175416ccf98c5aff8911 Mon Sep 17 00:00:00 2001 From: Fringg Date: Wed, 4 Mar 2026 15:30:00 +0300 Subject: [PATCH] fix: replace window.confirm with inline confirmation for unlink window.confirm() is silently suppressed in Telegram Mini Apps and iOS WebView, making unlink completely non-functional on mobile. Replaced with two-click inline confirmation: first click shows destructive "Confirm disconnect?" button, second click executes unlink. Button resets on blur. --- src/locales/en.json | 1 + src/locales/fa.json | 1 + src/locales/ru.json | 1 + src/locales/zh.json | 1 + src/pages/ConnectedAccounts.tsx | 17 ++++++++++++++--- 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index c771ce2..7ce6a4d 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -3607,6 +3607,7 @@ "link": "Connect", "unlink": "Disconnect", "unlinkConfirm": "Are you sure? You won't be able to sign in with this service after disconnecting.", + "unlinkConfirmBtn": "Confirm disconnect?", "cannotUnlinkLast": "Cannot disconnect the last sign-in method", "linkSuccess": "Account connected successfully", "unlinkSuccess": "Account disconnected successfully", diff --git a/src/locales/fa.json b/src/locales/fa.json index b6a3364..b1de938 100644 --- a/src/locales/fa.json +++ b/src/locales/fa.json @@ -3043,6 +3043,7 @@ "link": "اتصال", "unlink": "قطع اتصال", "unlinkConfirm": "آیا مطمئن هستید؟ پس از قطع اتصال نمی‌توانید از طریق این سرویس وارد شوید.", + "unlinkConfirmBtn": "تأیید قطع اتصال؟", "cannotUnlinkLast": "نمی‌توان آخرین روش ورود را قطع کرد", "linkSuccess": "حساب با موفقیت متصل شد", "unlinkSuccess": "اتصال حساب با موفقیت قطع شد", diff --git a/src/locales/ru.json b/src/locales/ru.json index e19a81a..4a1e108 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -4167,6 +4167,7 @@ "link": "Привязать", "unlink": "Отвязать", "unlinkConfirm": "Вы уверены? После отвязки вы не сможете входить через этот сервис.", + "unlinkConfirmBtn": "Точно отвязать?", "cannotUnlinkLast": "Нельзя отвязать последний способ входа", "linkSuccess": "Аккаунт успешно привязан", "unlinkSuccess": "Аккаунт успешно отвязан", diff --git a/src/locales/zh.json b/src/locales/zh.json index 2903c4d..7caeace 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -3042,6 +3042,7 @@ "link": "关联", "unlink": "取消关联", "unlinkConfirm": "确定吗?取消关联后,您将无法通过此服务登录。", + "unlinkConfirmBtn": "确认取消关联?", "cannotUnlinkLast": "无法取消最后一种登录方式", "linkSuccess": "账户关联成功", "unlinkSuccess": "账户取消关联成功", diff --git a/src/pages/ConnectedAccounts.tsx b/src/pages/ConnectedAccounts.tsx index c738561..1a2756f 100644 --- a/src/pages/ConnectedAccounts.tsx +++ b/src/pages/ConnectedAccounts.tsx @@ -1,3 +1,4 @@ +import { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; import { motion } from 'framer-motion'; @@ -126,9 +127,14 @@ export default function ConnectedAccounts() { } }; + const [confirmingUnlink, setConfirmingUnlink] = useState(null); + const handleUnlink = (provider: string) => { - if (window.confirm(t('profile.accounts.unlinkConfirm'))) { + if (confirmingUnlink === provider) { + setConfirmingUnlink(null); unlinkMutation.mutate(provider); + } else { + setConfirmingUnlink(provider); } }; @@ -185,15 +191,20 @@ export default function ConnectedAccounts() { {t('profile.accounts.linked')} {canUnlink(provider) && ( )}