Mini Apps: Fix modal freeze when opening mini app via button (#4994)
This commit is contained in:
parent
10629eb69a
commit
8f9731a5cf
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -2961,6 +2961,7 @@ export interface ActionPayloads {
|
||||
startApp?: string;
|
||||
isWriteAllowed?: boolean;
|
||||
isFromConfirm?: boolean;
|
||||
shouldSkipBotTrustRequest?: boolean;
|
||||
} & WithTabId;
|
||||
loadPreviewMedias: {
|
||||
botId: string;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user