mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Handle "web_app_request_theme" event in WebView.
This commit is contained in:
parent
3cdb82a0bf
commit
ce79c1f0c4
2 changed files with 6 additions and 1 deletions
|
@ -322,7 +322,9 @@ Panel::Panel(
|
||||||
_widget->closeEvents(
|
_widget->closeEvents(
|
||||||
) | rpl::start_with_next(_close, _widget->lifetime());
|
) | rpl::start_with_next(_close, _widget->lifetime());
|
||||||
|
|
||||||
style::PaletteChanged(
|
rpl::combine(
|
||||||
|
style::PaletteChanged(),
|
||||||
|
_themeUpdateForced.events()
|
||||||
) | rpl::filter([=] {
|
) | rpl::filter([=] {
|
||||||
return !_themeUpdateScheduled;
|
return !_themeUpdateScheduled;
|
||||||
}) | rpl::start_with_next([=] {
|
}) | rpl::start_with_next([=] {
|
||||||
|
@ -564,6 +566,8 @@ bool Panel::createWebview() {
|
||||||
sendDataMessage(list.at(1));
|
sendDataMessage(list.at(1));
|
||||||
} else if (command == "web_app_setup_main_button") {
|
} else if (command == "web_app_setup_main_button") {
|
||||||
processMainButtonMessage(list.at(1));
|
processMainButtonMessage(list.at(1));
|
||||||
|
} else if (command == "web_app_request_theme") {
|
||||||
|
_themeUpdateForced.fire({});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ private:
|
||||||
QPointer<QWidget> _webviewParent;
|
QPointer<QWidget> _webviewParent;
|
||||||
std::unique_ptr<Button> _mainButton;
|
std::unique_ptr<Button> _mainButton;
|
||||||
std::unique_ptr<Progress> _progress;
|
std::unique_ptr<Progress> _progress;
|
||||||
|
rpl::event_stream<> _themeUpdateForced;
|
||||||
rpl::lifetime _fgLifetime;
|
rpl::lifetime _fgLifetime;
|
||||||
rpl::lifetime _bgLifetime;
|
rpl::lifetime _bgLifetime;
|
||||||
bool _webviewProgress = false;
|
bool _webviewProgress = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue