mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-03 16:15:13 +00:00
Hide payments webview progress when destroying.
This commit is contained in:
@@ -78,6 +78,9 @@ void Panel::requestActivate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Panel::toggleProgress(bool shown) {
|
void Panel::toggleProgress(bool shown) {
|
||||||
|
if (!shown) {
|
||||||
|
_webviewProgress = false;
|
||||||
|
}
|
||||||
if (!_progress) {
|
if (!_progress) {
|
||||||
if (!shown) {
|
if (!shown) {
|
||||||
return;
|
return;
|
||||||
@@ -431,6 +434,22 @@ void Panel::showEditPaymentMethod(const PaymentMethodDetails &method) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Panel::showWebviewProgress() {
|
||||||
|
if (_webviewProgress) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_webviewProgress = true;
|
||||||
|
toggleProgress(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Panel::hideWebviewProgress() {
|
||||||
|
if (!_webviewProgress) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_webviewProgress = false;
|
||||||
|
toggleProgress(false);
|
||||||
|
}
|
||||||
|
|
||||||
bool Panel::showWebview(
|
bool Panel::showWebview(
|
||||||
const QString &url,
|
const QString &url,
|
||||||
bool allowBack,
|
bool allowBack,
|
||||||
@@ -438,7 +457,7 @@ bool Panel::showWebview(
|
|||||||
if (!_webview && !createWebview()) {
|
if (!_webview && !createWebview()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
toggleProgress(true);
|
showWebviewProgress();
|
||||||
_widget->destroyLayer();
|
_widget->destroyLayer();
|
||||||
_webview->navigate(url);
|
_webview->navigate(url);
|
||||||
_widget->setBackAllowed(allowBack);
|
_widget->setBackAllowed(allowBack);
|
||||||
@@ -488,6 +507,7 @@ bool Panel::createWebview() {
|
|||||||
QObject::connect(container.get(), &QObject::destroyed, [=] {
|
QObject::connect(container.get(), &QObject::destroyed, [=] {
|
||||||
if (_webview.get() == raw) {
|
if (_webview.get() == raw) {
|
||||||
_webview = nullptr;
|
_webview = nullptr;
|
||||||
|
hideWebviewProgress();
|
||||||
}
|
}
|
||||||
if (_webviewBottom.get() == bottom) {
|
if (_webviewBottom.get() == bottom) {
|
||||||
_webviewBottom = nullptr;
|
_webviewBottom = nullptr;
|
||||||
@@ -512,11 +532,11 @@ bool Panel::createWebview() {
|
|||||||
if (!_delegate->panelWebviewNavigationAttempt(uri)) {
|
if (!_delegate->panelWebviewNavigationAttempt(uri)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
toggleProgress(true);
|
showWebviewProgress();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
raw->setNavigationDoneHandler([=](bool success) {
|
raw->setNavigationDoneHandler([=](bool success) {
|
||||||
toggleProgress(false);
|
hideWebviewProgress();
|
||||||
});
|
});
|
||||||
|
|
||||||
raw->init(R"(
|
raw->init(R"(
|
||||||
|
@@ -90,6 +90,8 @@ private:
|
|||||||
struct Progress;
|
struct Progress;
|
||||||
|
|
||||||
bool createWebview();
|
bool createWebview();
|
||||||
|
void showWebviewProgress();
|
||||||
|
void hideWebviewProgress();
|
||||||
void showWebviewError(
|
void showWebviewError(
|
||||||
const QString &text,
|
const QString &text,
|
||||||
const Webview::Available &information);
|
const Webview::Available &information);
|
||||||
@@ -109,6 +111,7 @@ private:
|
|||||||
rpl::variable<int> _formScrollTop;
|
rpl::variable<int> _formScrollTop;
|
||||||
QPointer<EditInformation> _weakEditInformation;
|
QPointer<EditInformation> _weakEditInformation;
|
||||||
QPointer<EditCard> _weakEditCard;
|
QPointer<EditCard> _weakEditCard;
|
||||||
|
bool _webviewProgress = false;
|
||||||
bool _testMode = false;
|
bool _testMode = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Submodule Telegram/lib_webview updated: fa6828443c...d7caf94d64
Reference in New Issue
Block a user