MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / update

Method update

Telegram/SourceFiles/api/api_sensitive_content.cpp:96–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96void SensitiveContent::update(bool enabled) {
97 if (!_canChange.current()) {
98 return;
99 }
100 using Flag = MTPaccount_SetContentSettings::Flag;
101 _api.request(_saveRequestId).cancel();
102 if (const auto load = base::take(_loadRequestId)) {
103 _api.request(load).cancel();
104 _loadPending = true;
105 }
106 const auto finish = [=] {
107 _saveRequestId = 0;
108 if (base::take(_loadPending)) {
109 _appConfigReloadForce = true;
110 reload(true);
111 } else {
112 _appConfigReloadTimer.callOnce(kRefreshAppConfigTimeout);
113 }
114 };
115 _saveRequestId = _api.request(MTPaccount_SetContentSettings(
116 MTP_flags(enabled ? Flag::f_sensitive_enabled : Flag(0))
117 )).done(finish).fail(finish).send();
118 _enabled = enabled;
119}
120
121} // namespace Api

Callers

nothing calls this directly

Calls 8

MTP_flagsFunction · 0.85
FlagEnum · 0.50
currentMethod · 0.45
cancelMethod · 0.45
requestMethod · 0.45
sendMethod · 0.45
failMethod · 0.45
doneMethod · 0.45

Tested by

no test coverage detected