Telegram-Mini-Apps / telegram-apps

Made from scratch TypeScript packages, examples and documentation you will surely need to start developing on Telegram Mini Apps.
https://docs.telegram-mini-apps.com/
MIT License
693 stars 192 forks source link

[Bug]: miniApp.mount() throws an error if version is not enough to change some of the colors #503

Closed iuriiiurevich closed 1 month ago

iuriiiurevich commented 1 month ago

Telegram Application

Telegram for Android, Telegram for iOS, Telegram for macOS, Telegram Desktop, Telegram Web A, Telegram Web K

Describe the Bug

For example, if you call miniApp.mount() in Telegram version 7.2, the following error will be thrown:

Method "web_app_set_bottom_bar_color" is unsupported in Mini Apps version 7.2

To Reproduce

  1. Add miniApp.mount() to any miniapp that uses @telegram-apps v2
  2. Open the miniapp in Telegram version < 7.10 (or mock such version)
  3. See "unsupported" error

Expected Behavior

No error :)

heyqbnk commented 1 month ago

Working on the solution

heyqbnk commented 1 month ago

Should be fine in 2.5.0

iuriiiurevich commented 1 month ago

@heyqbnk There is still one buggy case. In Telegram version ≥6.1 <6.9 the following code:

if (miniApp.mount.isSupported()) {
  miniApp.mount();
}

throws

Parameter "color" of "web_app_set_header_color" method is unsupported in Mini Apps version 6.1

heyqbnk commented 1 month ago

Thank you for attention! Try 2.5.1