mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-22 10:17:10 +00:00
Make sure colors are ready for webview.
This commit is contained in:
parent
b754ad5248
commit
dcac27e072
@ -885,7 +885,28 @@ void WebViewInstance::activate() {
|
||||
}
|
||||
}
|
||||
|
||||
void WebViewInstance::requestFullBot() {
|
||||
if (_bot->isFullLoaded()) {
|
||||
return;
|
||||
}
|
||||
_bot->updateFull();
|
||||
_bot->session().changes().peerUpdates(
|
||||
_bot,
|
||||
Data::PeerUpdate::Flag::FullInfo
|
||||
) | rpl::start_with_next([=] {
|
||||
if (_botFullWaitingArgs.has_value()) {
|
||||
auto args = *base::take(_botFullWaitingArgs);
|
||||
if (args.url.isEmpty()) {
|
||||
showGame();
|
||||
} else {
|
||||
show(std::move(args));
|
||||
}
|
||||
}
|
||||
}, _lifetime);
|
||||
}
|
||||
|
||||
void WebViewInstance::resolve() {
|
||||
requestFullBot();
|
||||
v::match(_source, [&](WebViewSourceButton data) {
|
||||
confirmOpen([=] {
|
||||
if (data.simple) {
|
||||
@ -1307,6 +1328,10 @@ void WebViewInstance::maybeChooseAndRequestButton(PeerTypes supported) {
|
||||
}
|
||||
|
||||
void WebViewInstance::show(ShowArgs &&args) {
|
||||
if (!_bot->isFullLoaded()) {
|
||||
_botFullWaitingArgs.emplace(std::move(args));
|
||||
return;
|
||||
}
|
||||
auto title = args.title.isEmpty()
|
||||
? Info::Profile::NameValue(_bot)
|
||||
: rpl::single(args.title);
|
||||
@ -1373,6 +1398,10 @@ void WebViewInstance::show(ShowArgs &&args) {
|
||||
void WebViewInstance::showGame() {
|
||||
Expects(v::is<WebViewSourceGame>(_source));
|
||||
|
||||
if (!_bot->isFullLoaded()) {
|
||||
_botFullWaitingArgs.emplace();
|
||||
return;
|
||||
}
|
||||
const auto game = v::get<WebViewSourceGame>(_source);
|
||||
_panelUrl = QString::fromUtf8(_button.url);
|
||||
_panel = Ui::BotWebView::Show({
|
||||
|
@ -231,6 +231,7 @@ public:
|
||||
|
||||
private:
|
||||
void resolve();
|
||||
void requestFullBot();
|
||||
|
||||
bool openAppFromBotMenuLink();
|
||||
|
||||
@ -313,6 +314,8 @@ private:
|
||||
const WebViewButton _button;
|
||||
const WebViewSource _source;
|
||||
|
||||
std::optional<ShowArgs> _botFullWaitingArgs;
|
||||
|
||||
BotAppData *_app = nullptr;
|
||||
QString _appStartParam;
|
||||
bool _dataSent = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user