ZaStoGram_desktop/Telegram/SourceFiles/wallet/wallet_session_waits.h
John Preston 7de38f53cd Used served gifts in wallet collectibles instead of lookups.
Task: 2026/10/14/use-the-served-gift-in-wallet-collectibles-instead-of-slug-lookups
2026-10-20 17:07:51 +04:00

45 lines
931 B
C++

/*
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
namespace Gram {
struct NftItem;
} // namespace Gram
namespace Wallet {
struct CollectibleRecord;
class CollectibleWaits final {
public:
explicit CollectibleWaits(Fn<void()> changed);
[[nodiscard]] uint64 add(
Fn<bool(const Gram::NftItem &)> matches,
Fn<void(bool arrived)> done);
void cancel(uint64 id);
[[nodiscard]] bool empty() const;
void settle(
const std::vector<CollectibleRecord> *page,
crl::time sentAt);
private:
struct Entry {
uint64 id = 0;
Fn<bool(const Gram::NftItem &)> matches;
Fn<void(bool)> done;
crl::time armedAt = 0;
};
const Fn<void()> _changed;
std::vector<Entry> _entries;
uint64 _lastId = 0;
};
} // namespace Wallet