1 /* 2 This file is part of Telegram Desktop, 3 the official desktop application for the Telegram messaging service. 4 5 For license and copyright information please follow this link: 6 https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL 7 */ 8 #pragma once 9 10 #include "mtproto/sender.h" 11 12 class ApiWrap; 13 14 namespace Api { 15 16 class SelfDestruct final { 17 public: 18 explicit SelfDestruct(not_null<ApiWrap*> api); 19 20 void reload(); 21 void updateAccountTTL(int days); 22 void updateDefaultHistoryTTL(TimeId period); 23 24 [[nodiscard]] rpl::producer<int> daysAccountTTL() const; 25 [[nodiscard]] rpl::producer<TimeId> periodDefaultHistoryTTL() const; 26 [[nodiscard]] TimeId periodDefaultHistoryTTLCurrent() const; 27 28 private: 29 MTP::Sender _api; 30 struct { 31 mtpRequestId requestId = 0; 32 rpl::variable<int> days = 0; 33 } _accountTTL; 34 35 struct { 36 mtpRequestId requestId = 0; 37 rpl::variable<TimeId> period = 0; 38 } _defaultHistoryTTL; 39 40 }; 41 42 } // namespace Api