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> => {
|
addActionHandler('requestAppWebView', async (global, actions, payload): Promise<void> => {
|
||||||
const {
|
const {
|
||||||
botId, appName, startApp, theme, isWriteAllowed, isFromConfirm,
|
botId, appName, startApp, theme, isWriteAllowed, isFromConfirm, shouldSkipBotTrustRequest,
|
||||||
tabId = getCurrentTabId(),
|
tabId = getCurrentTabId(),
|
||||||
} = payload;
|
} = payload;
|
||||||
|
|
||||||
@ -719,7 +719,10 @@ addActionHandler('requestAppWebView', async (global, actions, payload): Promise<
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (botApp.isInactive || !selectIsTrustedBot(global, botId)) {
|
const shouldRequestBotTrust = !shouldSkipBotTrustRequest && (botApp.isInactive || !selectIsTrustedBot(global, botId));
|
||||||
|
|
||||||
|
if (shouldRequestBotTrust) {
|
||||||
|
payload.shouldSkipBotTrustRequest = true;
|
||||||
global = updateTabState(global, {
|
global = updateTabState(global, {
|
||||||
botTrustRequest: {
|
botTrustRequest: {
|
||||||
botId,
|
botId,
|
||||||
|
|||||||
@ -2891,6 +2891,7 @@ export async function checkWebAppExists<T extends GlobalState>(
|
|||||||
if (!botName || !appName) return false;
|
if (!botName || !appName) return false;
|
||||||
global = getGlobal();
|
global = getGlobal();
|
||||||
const chatByUsername = await fetchChatByUsername(global, botName);
|
const chatByUsername = await fetchChatByUsername(global, botName);
|
||||||
|
global = getGlobal();
|
||||||
const bot = chatByUsername && selectUser(global, chatByUsername.id);
|
const bot = chatByUsername && selectUser(global, chatByUsername.id);
|
||||||
const botApp = bot && await callApi('fetchBotApp', {
|
const botApp = bot && await callApi('fetchBotApp', {
|
||||||
bot,
|
bot,
|
||||||
|
|||||||
@ -2961,6 +2961,7 @@ export interface ActionPayloads {
|
|||||||
startApp?: string;
|
startApp?: string;
|
||||||
isWriteAllowed?: boolean;
|
isWriteAllowed?: boolean;
|
||||||
isFromConfirm?: boolean;
|
isFromConfirm?: boolean;
|
||||||
|
shouldSkipBotTrustRequest?: boolean;
|
||||||
} & WithTabId;
|
} & WithTabId;
|
||||||
loadPreviewMedias: {
|
loadPreviewMedias: {
|
||||||
botId: string;
|
botId: string;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user