Web Bots: More fixes (#1846)

This commit is contained in:
Alexander Zinchuk 2022-04-26 18:06:44 +02:00
parent 5b03ef2c39
commit 23131c5fc0
2 changed files with 8 additions and 4 deletions

View File

@ -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<OwnProps & StateProps> = ({
webApp,
@ -73,8 +74,9 @@ const WebAppModal: FC<OwnProps & StateProps> = ({
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();
}

View File

@ -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';