release: v1.7.0 — Telegram Mini App embedding enhancements #138

Merged
developer merged 12 commits from development into master 2026-06-24 11:49:44 +00:00
2 changed files with 14 additions and 18 deletions
Showing only changes of commit 4f0cc81dfb - Show all commits
+7 -9
View File
@@ -11,10 +11,6 @@
// Split the message around the {bot} token so the bot handle renders as an inline link.
const parts = $derived(t('friends.staleInvite').split('{bot}'));
// Inside the Mini App with native popups, present the notice as Telegram's own popup instead of
// the in-app modal.
const useNative = insideTelegram() && telegramDialogsAvailable();
function openBot() {
if (username) {
const url = `https://t.me/${username}`;
@@ -25,12 +21,14 @@
dismissStaleInvite();
}
// Native path: raise Telegram's popup when the notice appears; its "open bot" button opens the
// bot chat, any other dismissal just clears the notice. The `shown` guard fires it once per notice.
// Native path: when the notice fires inside the Mini App with native popups, present Telegram's
// own popup instead of the in-app modal. insideTelegram()/dialogs are evaluated at fire time, not
// captured at init: this component mounts before bootstrap loads the SDK, so a captured value
// would be stale. The popup's "open bot" button opens the bot chat; any other dismissal clears the
// notice; the `shown` guard fires it once per notice.
let shown = false;
$effect(() => {
if (!useNative) return;
if (app.staleInvite && !shown) {
if (app.staleInvite && !shown && insideTelegram() && telegramDialogsAvailable()) {
shown = true;
void telegramShowPopup(
botInfoPopup(t('friends.staleInviteTitle'), t('friends.staleInvite'), username ?? '', t('common.ok')),
@@ -41,7 +39,7 @@
});
</script>
{#if app.staleInvite && !useNative}
{#if app.staleInvite && !(insideTelegram() && telegramDialogsAvailable())}
<Modal title={t('friends.staleInviteTitle')} onclose={dismissStaleInvite}>
<p class="msg">{parts[0]}{#if username}<button type="button" class="bot" onclick={openBot}>@{username}</button>{/if}{parts[1] ?? ''}</p>
<button class="ok" onclick={dismissStaleInvite}>{t('common.ok')}</button>
+7 -9
View File
@@ -14,10 +14,6 @@
// as an inline link (the {name} value is substituted first; {bot} is left for the split).
const parts = $derived(t('friends.welcomeRedeem', { name }).split('{bot}'));
// Inside the Mini App with native popups, present the greeting as Telegram's own popup instead of
// the in-app modal.
const useNative = insideTelegram() && telegramDialogsAvailable();
function openBot() {
if (username) {
const url = `https://t.me/${username}`;
@@ -28,12 +24,14 @@
dismissWelcomeRedeem();
}
// Native path: raise Telegram's popup when the greeting appears; its "open bot" button opens the
// bot chat, any other dismissal just clears it. The `shown` guard fires it once per greeting.
// Native path: when the greeting fires inside the Mini App with native popups, present Telegram's
// own popup instead of the in-app modal. insideTelegram()/dialogs are evaluated at fire time, not
// captured at init: this component mounts before bootstrap loads the SDK, so a captured value
// would be stale. The popup's "open bot" button opens the bot chat; any other dismissal clears it;
// the `shown` guard fires it once per greeting.
let shown = false;
$effect(() => {
if (!useNative) return;
if (app.welcomeRedeem && !shown) {
if (app.welcomeRedeem && !shown && insideTelegram() && telegramDialogsAvailable()) {
shown = true;
void telegramShowPopup(
botInfoPopup(t('friends.welcomeRedeemTitle'), t('friends.welcomeRedeem', { name }), username ?? '', t('common.ok')),
@@ -44,7 +42,7 @@
});
</script>
{#if app.welcomeRedeem && !useNative}
{#if app.welcomeRedeem && !(insideTelegram() && telegramDialogsAvailable())}
<Modal title={t('friends.welcomeRedeemTitle')} onclose={dismissWelcomeRedeem}>
<p class="msg">{parts[0]}{#if username}<button type="button" class="bot" onclick={openBot}>@{username}</button>{/if}{parts[1] ?? ''}</p>
<button class="ok" onclick={dismissWelcomeRedeem}>{t('common.ok')}</button>