Hide payments webview progress when destroying.
This commit is contained in:
parent
0ead0879d7
commit
73c63cb2c7
|
@ -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;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit fa6828443c71932de74ec2a0ffa5f3e8d3bc894c
|
Subproject commit d7caf94d64aebb6720712150457cfb1c0d5f7ca0
|
Loading…
Reference in New Issue