Handle "web_app_request_theme" event in WebView.

This commit is contained in:
John Preston 2022-04-21 10:47:21 +04:00
parent 3cdb82a0bf
commit ce79c1f0c4
2 changed files with 6 additions and 1 deletions

View File

@ -322,7 +322,9 @@ Panel::Panel(
_widget->closeEvents(
) | rpl::start_with_next(_close, _widget->lifetime());
style::PaletteChanged(
rpl::combine(
style::PaletteChanged(),
_themeUpdateForced.events()
) | rpl::filter([=] {
return !_themeUpdateScheduled;
}) | rpl::start_with_next([=] {
@ -564,6 +566,8 @@ bool Panel::createWebview() {
sendDataMessage(list.at(1));
} else if (command == "web_app_setup_main_button") {
processMainButtonMessage(list.at(1));
} else if (command == "web_app_request_theme") {
_themeUpdateForced.fire({});
}
});

View File

@ -88,6 +88,7 @@ private:
QPointer<QWidget> _webviewParent;
std::unique_ptr<Button> _mainButton;
std::unique_ptr<Progress> _progress;
rpl::event_stream<> _themeUpdateForced;
rpl::lifetime _fgLifetime;
rpl::lifetime _bgLifetime;
bool _webviewProgress = false;