Skip to content

Add Mini App and modern bot button support - #10

Merged
AbdulKus merged 2 commits into
mainfrom
feature/mini-apps-and-button-markup
Aug 7, 2026
Merged

Add Mini App and modern bot button support#10
AbdulKus merged 2 commits into
mainfrom
feature/mini-apps-and-button-markup

Conversation

@AbdulKus

@AbdulKus AbdulKus commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Что изменено

  • добавлен встроенный хост Telegram Mini Apps с Telegram WebView JS bridge;
  • поддержаны inline Web App-кнопки, кнопки обычной бот-клавиатуры, startapp и main Mini App-ссылки;
  • callback/giveaway-ссылки на Mini Apps больше не попадают в ветку «не поддерживается»;
  • добавлена обработка основных Mini App events: theme/viewport, back/main button, popup, close, open links и web_app_data_send;
  • добавлены новые стили кнопок primary, danger, success и custom emoji для reply-клавиатуры;
  • добавлены английские и русские строки.

Причина

TDLib уже распознавал новые Web App-типы и поля разметки, но интерфейс Frogram X явно отправлял их в unsupported/TODO.

Проверка

  • git diff --check — успешно;
  • локальный Gradle не запускался из-за отсутствующего дистрибутива Gradle в контейнере; окончательную компиляцию выполняет GitHub Actions.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5701c9a545

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +127 to +131
if (("http".equalsIgnoreCase(scheme) || "https".equalsIgnoreCase(scheme)) &&
(!getArgumentsStrict().webAppUrl.requireSameOrigin || sameOrigin(uri))) {
return false;
}
tdlib.ui().openUrl(this, uri.toString(), new TdlibUi.UrlOpenParameters());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Unload disallowed cross-origin pages

For Mini Apps with requireSameOrigin, a cross-origin POST navigation can still load in this WebView because Android does not call shouldOverrideUrlLoading for POST requests. processSpecial is then reached from onPageFinished, where opening the URL externally does not unload the already-rendered page, leaving that foreign origin with access to the injected TelegramWebviewProxy. Replace the loaded content or otherwise enforce the origin restriction at the resource/navigation layer.

Useful? React with 👍 / 👎.

Comment on lines +208 to +209
mainButton.setVisibility(visible ? View.VISIBLE : View.GONE);
setWebViewBottomInset(visible ? Screen.dp(68f) : 0);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Emit viewport events after WebView size changes

When the main button becomes visible, this inset immediately changes the WebView height, but viewport_changed is only emitted on web_app_ready or an explicit request. Consequently, Mini Apps using Telegram's viewport properties retain the old height after showing or hiding the button; rotation, IME resizing, and other later layout changes have the same problem. Observe WebView layout changes and send the updated viewport after layout settles.

Useful? React with 👍 / 👎.

Comment on lines +182 to +184
} else {
ViewUtils.setBackground(text, coloredButtonBackground(color));
text.setTextColor(Color.WHITE);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve styled-button text colors across theme changes

Styled reply-keyboard buttons are initially assigned white text here, but every generated button remains registered with addThemeTextAccentColorListener. After a theme or auto-night transition, that listener replaces white with the normal theme text color while the hard-coded primary/danger/success background remains, producing incorrect and potentially low-contrast buttons. The theme listener needs to reapply the button's style rather than unconditionally applying the accent text color.

Useful? React with 👍 / 👎.

@AbdulKus
AbdulKus merged commit 51f4007 into main Aug 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant