Improve auction gift display.

This commit is contained in:
John Preston
2025-11-19 19:04:50 +04:00
parent 75a1657c49
commit 312d5f0121
11 changed files with 97 additions and 30 deletions

View File

@@ -104,6 +104,7 @@ struct CreditsHistoryEntry final {
bool converted : 1 = false;
bool anonymous : 1 = false;
bool stargift : 1 = false;
bool auction : 1 = false;
bool postsSearch : 1 = false;
bool giftTransferred : 1 = false;
bool giftRefunded : 1 = false;

View File

@@ -149,6 +149,7 @@ struct GiftCode {
PeerData *stargiftReleasedBy = nullptr;
std::shared_ptr<UniqueGift> unique;
TextWithEntities message;
PeerData *auctionTo = nullptr;
ChannelData *channel = nullptr;
PeerData *channelFrom = nullptr;
uint64 channelSavedId = 0;
@@ -159,6 +160,7 @@ struct GiftCode {
int starsToUpgrade = 0;
int starsUpgradedBySender = 0;
int starsForDetailsRemove = 0;
int starsBid = 0;
int limitedCount = 0;
int limitedLeft = 0;
int64 count = 0;

View File

@@ -1877,6 +1877,14 @@ rpl::producer<GiftsUpdate> Session::giftsUpdates() const {
return _giftsUpdates.events();
}
void Session::notifyGiftAuctionGot(GiftAuctionGot &&update) {
_giftAuctionGots.fire(std::move(update));
}
rpl::producer<GiftAuctionGot> Session::giftAuctionGots() const {
return _giftAuctionGots.events();
}
HistoryItem *Session::changeMessageId(PeerId peerId, MsgId wasId, MsgId nowId) {
const auto list = messagesListForInsert(peerId);
const auto i = list->find(wasId);

View File

@@ -115,6 +115,10 @@ struct GiftsUpdate {
std::vector<Data::SavedStarGiftId> added;
std::vector<Data::SavedStarGiftId> removed;
};
struct GiftAuctionGot {
uint64 giftId = 0;
not_null<PeerData*> to;
};
struct SentToScheduled {
not_null<History*> history;
@@ -361,6 +365,8 @@ public:
[[nodiscard]] rpl::producer<GiftUpdate> giftUpdates() const;
void notifyGiftsUpdate(GiftsUpdate &&update);
[[nodiscard]] rpl::producer<GiftsUpdate> giftsUpdates() const;
void notifyGiftAuctionGot(GiftAuctionGot &&update);
[[nodiscard]] rpl::producer<GiftAuctionGot> giftAuctionGots() const;
void requestItemRepaint(not_null<const HistoryItem*> item);
[[nodiscard]] rpl::producer<not_null<const HistoryItem*>> itemRepaintRequest() const;
void requestViewRepaint(not_null<const ViewElement*> view);
@@ -1075,6 +1081,7 @@ private:
rpl::event_stream<not_null<HistoryItem*>> _newItemAdded;
rpl::event_stream<GiftUpdate> _giftUpdates;
rpl::event_stream<GiftsUpdate> _giftsUpdates;
rpl::event_stream<GiftAuctionGot> _giftAuctionGots;
rpl::event_stream<not_null<const HistoryItem*>> _itemRepaintRequest;
rpl::event_stream<not_null<const ViewElement*>> _viewRepaintRequest;
rpl::event_stream<not_null<const HistoryItem*>> _itemResizeRequest;