fix(blocking): open bot deep-link via platform adapter, not window.open

Inside the Telegram WebView, window.open is intercepted by the
client and the new-tab fallback is blocked on most platforms
(Android, iOS). Use usePlatform().openTelegramLink(url) — same
pattern as the rest of the codebase (Support.tsx, etc.). The
TelegramAdapter dispatches to the WebApp SDK's openTelegramLink in
TG and falls back to window.open in the standalone web build, so
both runtimes work.
This commit is contained in:
Fringg
2026-05-16 05:25:41 +03:00
parent 16b47119c9
commit 8c336d16c7

View File

@@ -1,4 +1,5 @@
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { usePlatform } from '@/platform';
import { useBlockingStore } from '../../store/blocking'; import { useBlockingStore } from '../../store/blocking';
/** /**
@@ -18,12 +19,18 @@ import { useBlockingStore } from '../../store/blocking';
*/ */
export default function AccountDeletedScreen() { export default function AccountDeletedScreen() {
const { t } = useTranslation(); const { t } = useTranslation();
const { openTelegramLink } = usePlatform();
const info = useBlockingStore((state) => state.accountDeletedInfo); const info = useBlockingStore((state) => state.accountDeletedInfo);
const deepLink = info?.telegram_deep_link?.trim() || null; const deepLink = info?.telegram_deep_link?.trim() || null;
// Route through the platform adapter, not raw window.open. Inside the
// Telegram WebView, window.open is intercepted by the client and the
// new-tab fallback is blocked on most platforms (Android, iOS). The
// TelegramAdapter dispatches to the WebApp SDK's openTelegramLink in
// Telegram and falls back to window.open in the standalone web build.
const handleOpenBot = () => { const handleOpenBot = () => {
if (deepLink) { if (deepLink) {
window.open(deepLink, '_blank', 'noopener,noreferrer'); openTelegramLink(deepLink);
} }
}; };