2019-12-09 12:59:08 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "mtproto/sender.h"
|
2019-12-09 13:57:33 +00:00
|
|
|
#include "base/timer.h"
|
2019-12-09 12:59:08 +00:00
|
|
|
|
|
|
|
class ApiWrap;
|
|
|
|
|
2019-12-09 13:57:33 +00:00
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
|
|
|
|
2019-12-09 12:59:08 +00:00
|
|
|
namespace Api {
|
|
|
|
|
|
|
|
class SensitiveContent final {
|
|
|
|
public:
|
|
|
|
explicit SensitiveContent(not_null<ApiWrap*> api);
|
|
|
|
|
|
|
|
void reload();
|
|
|
|
void update(bool enabled);
|
|
|
|
|
|
|
|
[[nodiscard]] bool enabledCurrent() const;
|
|
|
|
[[nodiscard]] rpl::producer<bool> enabled() const;
|
|
|
|
[[nodiscard]] rpl::producer<bool> canChange() const;
|
|
|
|
|
|
|
|
private:
|
2019-12-09 13:57:33 +00:00
|
|
|
const not_null<Main::Session*> _session;
|
2019-12-09 12:59:08 +00:00
|
|
|
MTP::Sender _api;
|
|
|
|
mtpRequestId _requestId = 0;
|
|
|
|
rpl::variable<bool> _enabled = false;
|
|
|
|
rpl::variable<bool> _canChange = false;
|
2019-12-09 13:57:33 +00:00
|
|
|
base::Timer _appConfigReloadTimer;
|
2019-12-09 12:59:08 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Api
|