diff --git a/src/global/actions/api/bots.ts b/src/global/actions/api/bots.ts index fe492f796..c5e7cfbd9 100644 --- a/src/global/actions/api/bots.ts +++ b/src/global/actions/api/bots.ts @@ -21,7 +21,6 @@ import { getCurrentTabId } from '../../../util/establishMultitabRole'; import { getTranslationFn } from '../../../util/localization'; import { formatStarsAsText } from '../../../util/localization/format'; import { oldTranslate } from '../../../util/oldLangProvider'; -import PopupManager from '../../../util/PopupManager'; import requestActionTimeout from '../../../util/requestActionTimeout'; import { debounce } from '../../../util/schedulers'; import { getServerTime } from '../../../util/serverTime'; @@ -73,7 +72,6 @@ import { getPeerStarsForMessage } from './messages'; import { getIsWebAppsFullscreenSupported } from '../../../hooks/useAppLayout'; -const GAMEE_URL = 'https://prizes.gamee.com/'; const TOP_PEERS_REQUEST_COOLDOWN = 60; // 1 min const runDebouncedForSearch = debounce((cb) => cb(), 500, false); let botFatherId: string | null; @@ -1287,8 +1285,6 @@ async function sendBotCommand( }); } -let gameePopups: PopupManager | undefined; - async function answerCallbackButton( global: T, actions: RequiredGlobalActions, chat: ApiChat, messageId: number, data?: string, isGame = false, @@ -1298,16 +1294,6 @@ async function answerCallbackButton( showDialog, showNotification, openUrl, openGame, } = actions; - if (isGame) { - if (!gameePopups) { - gameePopups = new PopupManager('popup,width=800,height=600', () => { - showNotification({ message: 'Allow browser to open popup window', tabId }); - }); - } - - gameePopups.preOpenIfNeeded(); - } - const result = await callApi('answerCallbackButton', { chatId: chat.id, accessHash: chat.accessHash, @@ -1327,15 +1313,9 @@ async function answerCallbackButton( showNotification({ message, tabId }); } else if (url) { if (isGame) { - // Workaround for Gamee embedding bug - if (url.includes(GAMEE_URL)) { - gameePopups!.open(url); - } else { - gameePopups!.cancelPreOpen(); - openGame({ - url, chatId: chat.id, messageId, tabId, - }); - } + openGame({ + url, chatId: chat.id, messageId, tabId, + }); } else { openUrl({ url, tabId }); } diff --git a/src/util/PopupManager.ts b/src/util/PopupManager.ts deleted file mode 100644 index 52dc86a0f..000000000 --- a/src/util/PopupManager.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { IS_ANDROID, IS_IOS } from './browser/windowEnvironment'; - -const SHOULD_PRE_OPEN = IS_IOS || IS_ANDROID; - -export default class PopupManager { - private preOpened?: WindowProxy | null; - - constructor(private features?: string, private onFail?: NoneToVoidFunction) { - } - - preOpenIfNeeded() { - if (!SHOULD_PRE_OPEN) return; - - this.preOpened = window.open('about:blank', undefined, this.features); - if (this.preOpened) { - this.preOpened.blur(); - } else { - this.onFail?.(); - } - } - - open(url: string) { - if (this.preOpened) { - this.preOpened.location.href = url; - this.preOpened.focus(); - this.preOpened = undefined; - - return; - } - - if (!SHOULD_PRE_OPEN) { - const popup = window.open(url, undefined, this.features); - if (popup) { - popup.focus(); - } else { - this.onFail?.(); - } - } - } - - cancelPreOpen() { - this.preOpened?.close(); - this.preOpened = undefined; - } -}