mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Process gift updates in list.
This commit is contained in:
@@ -69,6 +69,7 @@ struct CreditsHistoryEntry final {
|
||||
bool converted = false;
|
||||
bool anonymous = false;
|
||||
bool savedToProfile = false;
|
||||
bool fromGiftsList = false;
|
||||
bool reaction = false;
|
||||
bool refunded = false;
|
||||
bool pending = false;
|
||||
|
@@ -579,6 +579,10 @@ const Invoice *Media::invoice() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const GiftCode *Media::gift() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CloudImage *Media::location() const {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -2331,8 +2335,8 @@ not_null<PeerData*> MediaGiftBox::from() const {
|
||||
return _from;
|
||||
}
|
||||
|
||||
const GiftCode &MediaGiftBox::data() const {
|
||||
return _data;
|
||||
const GiftCode *MediaGiftBox::gift() const {
|
||||
return &_data;
|
||||
}
|
||||
|
||||
TextWithEntities MediaGiftBox::notificationText() const {
|
||||
|
@@ -172,6 +172,7 @@ public:
|
||||
virtual const Call *call() const;
|
||||
virtual GameData *game() const;
|
||||
virtual const Invoice *invoice() const;
|
||||
virtual const GiftCode *gift() const;
|
||||
virtual CloudImage *location() const;
|
||||
virtual PollData *poll() const;
|
||||
virtual const WallPaper *paper() const;
|
||||
@@ -621,7 +622,7 @@ public:
|
||||
std::unique_ptr<Media> clone(not_null<HistoryItem*> parent) override;
|
||||
|
||||
[[nodiscard]] not_null<PeerData*> from() const;
|
||||
[[nodiscard]] const GiftCode &data() const;
|
||||
[[nodiscard]] const GiftCode *gift() const override;
|
||||
|
||||
TextWithEntities notificationText() const override;
|
||||
QString pinnedTextSubstring() const override;
|
||||
|
@@ -1645,6 +1645,14 @@ rpl::producer<not_null<HistoryItem*>> Session::newItemAdded() const {
|
||||
return _newItemAdded.events();
|
||||
}
|
||||
|
||||
void Session::notifyGiftUpdate(GiftUpdate &&update) {
|
||||
_giftUpdates.fire(std::move(update));
|
||||
}
|
||||
|
||||
rpl::producer<GiftUpdate> Session::giftUpdates() const {
|
||||
return _giftUpdates.events();
|
||||
}
|
||||
|
||||
HistoryItem *Session::changeMessageId(PeerId peerId, MsgId wasId, MsgId nowId) {
|
||||
const auto list = messagesListForInsert(peerId);
|
||||
const auto i = list->find(wasId);
|
||||
|
@@ -77,6 +77,18 @@ struct RepliesReadTillUpdate {
|
||||
bool out = false;
|
||||
};
|
||||
|
||||
struct GiftUpdate {
|
||||
enum class Action : uchar {
|
||||
Save,
|
||||
Unsave,
|
||||
Convert,
|
||||
Delete,
|
||||
};
|
||||
|
||||
FullMsgId itemId;
|
||||
Action action = {};
|
||||
};
|
||||
|
||||
class Session final {
|
||||
public:
|
||||
using ViewElement = HistoryView::Element;
|
||||
@@ -281,6 +293,8 @@ public:
|
||||
[[nodiscard]] rpl::producer<not_null<const ViewElement*>> viewLayoutChanged() const;
|
||||
void notifyNewItemAdded(not_null<HistoryItem*> item);
|
||||
[[nodiscard]] rpl::producer<not_null<HistoryItem*>> newItemAdded() const;
|
||||
void notifyGiftUpdate(GiftUpdate &&update);
|
||||
[[nodiscard]] rpl::producer<GiftUpdate> giftUpdates() const;
|
||||
void requestItemRepaint(not_null<const HistoryItem*> item);
|
||||
[[nodiscard]] rpl::producer<not_null<const HistoryItem*>> itemRepaintRequest() const;
|
||||
void requestViewRepaint(not_null<const ViewElement*> view);
|
||||
@@ -924,6 +938,7 @@ private:
|
||||
rpl::event_stream<not_null<const HistoryItem*>> _itemLayoutChanges;
|
||||
rpl::event_stream<not_null<const ViewElement*>> _viewLayoutChanges;
|
||||
rpl::event_stream<not_null<HistoryItem*>> _newItemAdded;
|
||||
rpl::event_stream<GiftUpdate> _giftUpdates;
|
||||
rpl::event_stream<not_null<const HistoryItem*>> _itemRepaintRequest;
|
||||
rpl::event_stream<not_null<const ViewElement*>> _viewRepaintRequest;
|
||||
rpl::event_stream<not_null<const HistoryItem*>> _itemResizeRequest;
|
||||
|
Reference in New Issue
Block a user