2014-05-30 08:53:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2014-05-30 08:53:19 +00:00
|
|
|
*/
|
2016-03-23 18:43:12 +00:00
|
|
|
#include "mtproto/facade.h"
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2017-03-04 10:23:56 +00:00
|
|
|
#include "storage/localstorage.h"
|
2019-01-21 13:42:21 +00:00
|
|
|
#include "core/application.h"
|
2019-07-24 08:46:23 +00:00
|
|
|
#include "main/main_account.h"
|
2014-11-22 09:45:04 +00:00
|
|
|
|
2016-03-24 08:57:11 +00:00
|
|
|
namespace MTP {
|
2019-12-02 13:10:19 +00:00
|
|
|
namespace details {
|
2019-04-04 15:20:28 +00:00
|
|
|
namespace {
|
2016-03-24 08:57:11 +00:00
|
|
|
|
2016-12-05 11:01:08 +00:00
|
|
|
int PauseLevel = 0;
|
2015-10-15 10:18:24 +00:00
|
|
|
|
2019-04-04 15:20:28 +00:00
|
|
|
} // namespace
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-03-24 08:57:11 +00:00
|
|
|
bool paused() {
|
2016-12-05 11:01:08 +00:00
|
|
|
return PauseLevel > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void pause() {
|
|
|
|
++PauseLevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
void unpause() {
|
|
|
|
--PauseLevel;
|
2017-02-24 17:15:41 +00:00
|
|
|
if (!PauseLevel) {
|
|
|
|
if (auto instance = MainInstance()) {
|
|
|
|
instance->unpaused();
|
2016-02-29 16:53:26 +00:00
|
|
|
}
|
|
|
|
}
|
2016-03-24 08:57:11 +00:00
|
|
|
}
|
2016-02-23 09:52:18 +00:00
|
|
|
|
2019-12-02 13:10:19 +00:00
|
|
|
} // namespace details
|
2015-05-14 16:50:04 +00:00
|
|
|
|
2017-02-24 17:15:41 +00:00
|
|
|
Instance *MainInstance() {
|
2019-07-24 08:46:23 +00:00
|
|
|
return Core::IsAppLaunched()
|
|
|
|
? Core::App().activeAccount().mtp()
|
|
|
|
: nullptr;
|
2016-03-24 08:57:11 +00:00
|
|
|
}
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-03-24 08:57:11 +00:00
|
|
|
} // namespace MTP
|