Telegram Application
Telegram for iOS
Describe the Bug
tested for both iOS and macOS
iOS: theme_changed event fires whenever night mode is switched only when app is launched from Main App, but not when app is launched from Menu Button
macOS: theme_changed event fires regardless of whether app is launched from Main App or Menu Button (expected behaviour)
To Reproduce
Steps to reproduce the behavior in Test Env:
- Import setDebug from '@tma.js/bridge' and setDebug(true).
- On iOS, launch a miniapp from the Menu Button.
- Open safari devtools (ref) and select opened webview URL under Telegram block.
- Hide the miniapp to tray.
- Go to Telegram Settings and switch Night Mode.
- Witness
theme_changed event not being received, no debug log.
- Repeat above steps for iOS launch from Main App and macOS launch from both Main App and Menu Button to observe the discrepancy.
Also, would be great if there's a isNightMode Method & Event to know when to toggle dark mode, would like to have my own theming and not bind with tg theme params. Currently using a workaround to check themeparams bg-color and they don't follow the same theme on different devices (bg_color on iOS is #000000 while it's #18222D on macOS when Night Mode ), unsure whether Android's bg_color is different, hard to test for all devices.
Expected Behavior
Expected to see log entry from debug mode like this:
[Log] INFO 14:12:55.448 Bridge – "Event received:" (@tma__js_bridge.js, line 903)
{name: "theme_changed", payload: Object}
theme_changed event fires regardless of whether app is launched from Main App or Menu Button, for consistency, else have to manually call web_app_request_theme to check
Telegram Application
Telegram for iOS
Describe the Bug
tested for both iOS and macOS
iOS:
theme_changedevent fires whenever night mode is switched only when app is launched from Main App, but not when app is launched from Menu ButtonmacOS:
theme_changedevent fires regardless of whether app is launched from Main App or Menu Button (expected behaviour)To Reproduce
Steps to reproduce the behavior in Test Env:
theme_changedevent not being received, no debug log.Also, would be great if there's a isNightMode Method & Event to know when to toggle dark mode, would like to have my own theming and not bind with tg theme params. Currently using a workaround to check themeparams bg-color and they don't follow the same theme on different devices (
bg_coloron iOS is#000000while it's#18222Don macOS when Night Mode ), unsure whether Android'sbg_coloris different, hard to test for all devices.Expected Behavior
Expected to see log entry from debug mode like this:
theme_changedevent fires regardless of whether app is launched from Main App or Menu Button, for consistency, else have to manually callweb_app_request_themeto check