From 23131c5fc0ced105ef67d0b2fce5cf1b4b453986 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Tue, 26 Apr 2022 18:06:44 +0200 Subject: [PATCH] Web Bots: More fixes (#1846) --- src/components/main/WebAppModal.tsx | 6 ++++-- src/components/main/hooks/useWebAppFrame.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/main/WebAppModal.tsx b/src/components/main/WebAppModal.tsx index 964baa4fa..21ea544c3 100644 --- a/src/components/main/WebAppModal.tsx +++ b/src/components/main/WebAppModal.tsx @@ -49,6 +49,7 @@ type StateProps = { const MAIN_BUTTON_ANIMATION_TIME = 250; const PROLONG_INTERVAL = 45000; // 45s const ANIMATION_WAIT = 400; +const LINK_PREFIX = 'https://t.me/'; const WebAppModal: FC = ({ webApp, @@ -73,8 +74,9 @@ const WebAppModal: FC = ({ closeWebApp(); } - if (eventType === 'open_tg_link') { - openTelegramLink({ url: event.eventData }); + if (eventType === 'web_app_open_tg_link') { + const linkUrl = LINK_PREFIX + event.eventData.path_full; + openTelegramLink({ url: linkUrl }); closeWebApp(); } diff --git a/src/components/main/hooks/useWebAppFrame.ts b/src/components/main/hooks/useWebAppFrame.ts index b24a03d10..fbf142331 100644 --- a/src/components/main/hooks/useWebAppFrame.ts +++ b/src/components/main/hooks/useWebAppFrame.ts @@ -18,8 +18,10 @@ export type WebAppInboundEvent = { is_progress_visible: boolean; }; } | { - eventType: 'open_tg_link'; - eventData: string; + eventType: 'web_app_open_tg_link'; + eventData: { + path_full: string; + }; } | { eventType: 'web_app_request_viewport' | 'web_app_request_theme' | 'web_app_ready' | 'web_app_expand' | 'web_app_close' | 'iframe_ready';