Mini Apps: Allow forcing sticker set refresh (#5175)

This commit is contained in:
zubiden 2024-11-27 20:33:22 +04:00 committed by Alexander Zinchuk
parent 1e822ea234
commit 110c59a231
5 changed files with 12 additions and 5 deletions

View File

@ -382,9 +382,9 @@ const WebAppModalTabContent: FC<OwnProps & StateProps> = ({
function handleEvent(event: WebAppInboundEvent) {
const { eventType, eventData } = event;
if (eventType === 'web_app_open_tg_link' && !isPaymentModalOpen) {
if (eventType === 'web_app_open_tg_link') {
const linkUrl = TME_LINK_PREFIX + eventData.path_full;
openTelegramLink({ url: linkUrl });
openTelegramLink({ url: linkUrl, shouldIgnoreCache: eventData.force_request });
closeActiveWebApp();
}

View File

@ -1270,6 +1270,7 @@ addActionHandler('openChatByPhoneNumber', async (global, actions, payload): Prom
addActionHandler('openTelegramLink', async (global, actions, payload): Promise<void> => {
const {
url,
shouldIgnoreCache,
tabId = getCurrentTabId(),
} = payload;
@ -1357,6 +1358,7 @@ addActionHandler('openTelegramLink', async (global, actions, payload): Promise<v
stickerSetInfo: {
shortName: part2,
},
shouldIgnoreCache,
tabId,
});
return;

View File

@ -764,8 +764,8 @@ addActionHandler('loadFeaturedEmojiStickers', async (global): Promise<void> => {
});
addActionHandler('openStickerSet', async (global, actions, payload): Promise<void> => {
const { stickerSetInfo, tabId = getCurrentTabId() } = payload;
if (!selectStickerSet(global, stickerSetInfo)) {
const { stickerSetInfo, shouldIgnoreCache, tabId = getCurrentTabId() } = payload;
if (shouldIgnoreCache || !selectStickerSet(global, stickerSetInfo)) {
await loadStickers(global, actions, stickerSetInfo);
}

View File

@ -1813,6 +1813,7 @@ export interface ActionPayloads {
};
openTelegramLink: {
url: string;
shouldIgnoreCache?: boolean;
} & WithTabId;
resolveBusinessChatLink: {
slug: string;
@ -2997,7 +2998,10 @@ export interface ActionPayloads {
stickerSet: ApiStickerSet;
};
openStickerSet: { stickerSetInfo: ApiStickerSetInfo } & WithTabId;
openStickerSet: {
stickerSetInfo: ApiStickerSetInfo;
shouldIgnoreCache?: boolean;
} & WithTabId;
closeStickerSetModal: WithTabId | undefined;
loadStickersForEmoji: {

View File

@ -47,6 +47,7 @@ export type WebAppInboundEvent =
}> |
WebAppEvent<'web_app_open_tg_link', {
path_full: string;
force_request?: boolean;
}> |
WebAppEvent<'web_app_open_invoice', {
slug: string;