stickers_gift_box_pack.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. class DocumentData;
  9. namespace Data {
  10. struct FileOrigin;
  11. } // namespace Data
  12. namespace Main {
  13. class Session;
  14. } // namespace Main
  15. namespace Stickers {
  16. class GiftBoxPack final {
  17. public:
  18. explicit GiftBoxPack(not_null<Main::Session*> session);
  19. ~GiftBoxPack();
  20. void load();
  21. [[nodiscard]] int monthsForStars(int stars) const;
  22. [[nodiscard]] DocumentData *lookup(int months) const;
  23. [[nodiscard]] Data::FileOrigin origin() const;
  24. [[nodiscard]] rpl::producer<> updated() const;
  25. private:
  26. using SetId = uint64;
  27. void applySet(const MTPDmessages_stickerSet &data);
  28. const not_null<Main::Session*> _session;
  29. const std::vector<int> _localMonths;
  30. rpl::event_stream<> _updated;
  31. std::vector<DocumentData*> _documents;
  32. SetId _setId = 0;
  33. uint64 _accessHash = 0;
  34. mtpRequestId _requestId = 0;
  35. };
  36. } // namespace Stickers