init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
This commit is contained in:
51
Telegram/SourceFiles/api/api_sensitive_content.h
Normal file
51
Telegram/SourceFiles/api/api_sensitive_content.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
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"
|
||||
#include "base/timer.h"
|
||||
|
||||
class ApiWrap;
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
namespace Api {
|
||||
|
||||
class SensitiveContent final {
|
||||
public:
|
||||
explicit SensitiveContent(not_null<ApiWrap*> api);
|
||||
|
||||
void preload();
|
||||
void reload(bool force = false);
|
||||
void update(bool enabled);
|
||||
|
||||
[[nodiscard]] bool loaded() const;
|
||||
[[nodiscard]] rpl::producer<bool> loadedValue() const;
|
||||
[[nodiscard]] bool enabledCurrent() const;
|
||||
[[nodiscard]] rpl::producer<bool> enabled() const;
|
||||
[[nodiscard]] bool canChangeCurrent() const;
|
||||
[[nodiscard]] rpl::producer<bool> canChange() const;
|
||||
|
||||
private:
|
||||
const not_null<Main::Session*> _session;
|
||||
rpl::event_stream<> _loadedChanged;
|
||||
MTP::Sender _api;
|
||||
mtpRequestId _loadRequestId = 0;
|
||||
mtpRequestId _saveRequestId = 0;
|
||||
rpl::variable<bool> _enabled = false;
|
||||
rpl::variable<bool> _canChange = false;
|
||||
base::Timer _appConfigReloadTimer;
|
||||
bool _appConfigReloadForce = false;
|
||||
bool _loadPending = false;
|
||||
bool _loaded = false;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Api
|
||||
Reference in New Issue
Block a user