Mini Apps: Fix modal freeze when opening mini app via button (#4994)

This commit is contained in:
Alexander Zinchuk 2024-09-24 14:48:47 +02:00
parent 10629eb69a
commit 8f9731a5cf
3 changed files with 7 additions and 2 deletions

View File

@ -670,7 +670,7 @@ addActionHandler('loadPreviewMedias', async (global, actions, payload): Promise<
addActionHandler('requestAppWebView', async (global, actions, payload): Promise<void> => {
const {
botId, appName, startApp, theme, isWriteAllowed, isFromConfirm,
botId, appName, startApp, theme, isWriteAllowed, isFromConfirm, shouldSkipBotTrustRequest,
tabId = getCurrentTabId(),
} = payload;
@ -719,7 +719,10 @@ addActionHandler('requestAppWebView', async (global, actions, payload): Promise<
return;
}
if (botApp.isInactive || !selectIsTrustedBot(global, botId)) {
const shouldRequestBotTrust = !shouldSkipBotTrustRequest && (botApp.isInactive || !selectIsTrustedBot(global, botId));
if (shouldRequestBotTrust) {
payload.shouldSkipBotTrustRequest = true;
global = updateTabState(global, {
botTrustRequest: {
botId,

View File

@ -2891,6 +2891,7 @@ export async function checkWebAppExists<T extends GlobalState>(
if (!botName || !appName) return false;
global = getGlobal();
const chatByUsername = await fetchChatByUsername(global, botName);
global = getGlobal();
const bot = chatByUsername && selectUser(global, chatByUsername.id);
const botApp = bot && await callApi('fetchBotApp', {
bot,

View File

@ -2961,6 +2961,7 @@ export interface ActionPayloads {
startApp?: string;
isWriteAllowed?: boolean;
isFromConfirm?: boolean;
shouldSkipBotTrustRequest?: boolean;
} & WithTabId;
loadPreviewMedias: {
botId: string;