mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Hide webview while showing a box in payments.
This commit is contained in:
parent
1e660fc2a2
commit
4ef550da9b
1 changed files with 21 additions and 0 deletions
|
@ -49,6 +49,7 @@ struct Panel::WebviewWithLifetime {
|
|||
Webview::WindowConfig config = Webview::WindowConfig());
|
||||
|
||||
Webview::Window window;
|
||||
QPointer<RpWidget> lastHidingBox;
|
||||
rpl::lifetime lifetime;
|
||||
};
|
||||
|
||||
|
@ -687,6 +688,26 @@ rpl::producer<> Panel::backRequests() const {
|
|||
}
|
||||
|
||||
void Panel::showBox(object_ptr<BoxContent> box) {
|
||||
if (const auto widget = _webview ? _webview->window.widget() : nullptr) {
|
||||
const auto hideNow = !widget->isHidden();
|
||||
if (hideNow || _webview->lastHidingBox) {
|
||||
const auto raw = _webview->lastHidingBox = box.data();
|
||||
box->boxClosing(
|
||||
) | rpl::start_with_next([=] {
|
||||
const auto widget = _webview
|
||||
? _webview->window.widget()
|
||||
: nullptr;
|
||||
if (widget
|
||||
&& widget->isHidden()
|
||||
&& _webview->lastHidingBox == raw) {
|
||||
widget->show();
|
||||
}
|
||||
}, _webview->lifetime);
|
||||
if (hideNow) {
|
||||
widget->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
_widget->showBox(
|
||||
std::move(box),
|
||||
LayerOption::KeepOther,
|
||||
|
|
Loading…
Add table
Reference in a new issue