mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Close additional windows on passcode lock.
This commit is contained in:
parent
8959679b3c
commit
76314e3c03
2 changed files with 25 additions and 16 deletions
|
@ -188,8 +188,11 @@ Application::Application()
|
||||||
_platformIntegration->init();
|
_platformIntegration->init();
|
||||||
|
|
||||||
passcodeLockChanges(
|
passcodeLockChanges(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=](bool locked) {
|
||||||
_shouldLockAt = 0;
|
_shouldLockAt = 0;
|
||||||
|
if (locked) {
|
||||||
|
closeAdditionalWindows();
|
||||||
|
}
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
|
|
||||||
passcodeLockChanges(
|
passcodeLockChanges(
|
||||||
|
@ -211,6 +214,16 @@ Application::Application()
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::closeAdditionalWindows() {
|
||||||
|
Payments::CheckoutProcess::ClearAll();
|
||||||
|
for (const auto &[index, account] : _domain->accounts()) {
|
||||||
|
if (account->sessionExists()) {
|
||||||
|
account->session().attachWebView().closeAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_iv->closeAll();
|
||||||
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
if (_saveSettingsTimer && _saveSettingsTimer->isActive()) {
|
if (_saveSettingsTimer && _saveSettingsTimer->isActive()) {
|
||||||
Local::writeSettings();
|
Local::writeSettings();
|
||||||
|
@ -230,13 +243,7 @@ Application::~Application() {
|
||||||
//
|
//
|
||||||
// For example Domain::removeRedundantAccounts() is called from
|
// For example Domain::removeRedundantAccounts() is called from
|
||||||
// Domain::finish() and there is a violation on Ensures(started()).
|
// Domain::finish() and there is a violation on Ensures(started()).
|
||||||
Payments::CheckoutProcess::ClearAll();
|
closeAdditionalWindows();
|
||||||
for (const auto &[index, account] : _domain->accounts()) {
|
|
||||||
if (account->sessionExists()) {
|
|
||||||
account->session().attachWebView().closeAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_iv->closeAll();
|
|
||||||
|
|
||||||
_domain->finish();
|
_domain->finish();
|
||||||
|
|
||||||
|
@ -1087,14 +1094,15 @@ void Application::checkSendPaths() {
|
||||||
void Application::checkStartUrl() {
|
void Application::checkStartUrl() {
|
||||||
if (!cStartUrl().isEmpty()) {
|
if (!cStartUrl().isEmpty()) {
|
||||||
const auto url = cStartUrl();
|
const auto url = cStartUrl();
|
||||||
if (url.startsWith("tonsite://", Qt::CaseInsensitive)) {
|
if (!Core::App().passcodeLocked()) {
|
||||||
cSetStartUrl(QString());
|
if (url.startsWith("tonsite://", Qt::CaseInsensitive)) {
|
||||||
iv().showTonSite(url, {});
|
cSetStartUrl(QString());
|
||||||
} else if (_lastActivePrimaryWindow
|
iv().showTonSite(url, {});
|
||||||
&& !_lastActivePrimaryWindow->locked()) {
|
} else if (_lastActivePrimaryWindow) {
|
||||||
cSetStartUrl(QString());
|
cSetStartUrl(QString());
|
||||||
if (!openLocalUrl(url, {})) {
|
if (!openLocalUrl(url, {})) {
|
||||||
cSetStartUrl(url);
|
cSetStartUrl(url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -378,6 +378,7 @@ private:
|
||||||
|
|
||||||
void showOpenGLCrashNotification();
|
void showOpenGLCrashNotification();
|
||||||
void clearPasscodeLock();
|
void clearPasscodeLock();
|
||||||
|
void closeAdditionalWindows();
|
||||||
|
|
||||||
bool openCustomUrl(
|
bool openCustomUrl(
|
||||||
const QString &protocol,
|
const QString &protocol,
|
||||||
|
|
Loading…
Add table
Reference in a new issue