mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
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:
@@ -1,4 +1,5 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { usePlatform } from '@/platform';
|
||||
import { useBlockingStore } from '../../store/blocking';
|
||||
|
||||
/**
|
||||
@@ -18,12 +19,18 @@ import { useBlockingStore } from '../../store/blocking';
|
||||
*/
|
||||
export default function AccountDeletedScreen() {
|
||||
const { t } = useTranslation();
|
||||
const { openTelegramLink } = usePlatform();
|
||||
const info = useBlockingStore((state) => state.accountDeletedInfo);
|
||||
|
||||
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 = () => {
|
||||
if (deepLink) {
|
||||
window.open(deepLink, '_blank', 'noopener,noreferrer');
|
||||
openTelegramLink(deepLink);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user