mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Added support of service actions for premium gifts.
This commit is contained in:
@@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "history/view/media/history_view_theme_document.h"
|
||||
#include "history/view/media/history_view_slot_machine.h"
|
||||
#include "history/view/media/history_view_dice.h"
|
||||
#include "history/view/media/history_view_service_media_gift.h"
|
||||
#include "dialogs/ui/dialogs_message_view.h"
|
||||
#include "ui/image/image.h"
|
||||
#include "ui/text/format_song_document_name.h"
|
||||
@@ -1718,4 +1719,60 @@ ClickHandlerPtr MediaDice::MakeHandler(
|
||||
});
|
||||
}
|
||||
|
||||
MediaGiftBox::MediaGiftBox(not_null<HistoryItem*> parent, int months)
|
||||
: Media(parent)
|
||||
, _months(months) {
|
||||
}
|
||||
|
||||
std::unique_ptr<Media> MediaGiftBox::clone(not_null<HistoryItem*> parent) {
|
||||
return std::make_unique<MediaGiftBox>(parent, _months);
|
||||
}
|
||||
|
||||
int MediaGiftBox::months() const {
|
||||
return _months;
|
||||
}
|
||||
|
||||
bool MediaGiftBox::allowsRevoke(TimeId now) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
TextWithEntities MediaGiftBox::notificationText() const {
|
||||
return {};
|
||||
}
|
||||
|
||||
QString MediaGiftBox::pinnedTextSubstring() const {
|
||||
return {};
|
||||
}
|
||||
|
||||
TextForMimeData MediaGiftBox::clipboardText() const {
|
||||
return {};
|
||||
}
|
||||
|
||||
bool MediaGiftBox::forceForwardedInfo() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MediaGiftBox::updateInlineResultMedia(const MTPMessageMedia &media) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MediaGiftBox::updateSentMedia(const MTPMessageMedia &media) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_ptr<HistoryView::Media> MediaGiftBox::createView(
|
||||
not_null<HistoryView::Element*> message,
|
||||
not_null<HistoryItem*> realParent,
|
||||
HistoryView::Element *replacing) {
|
||||
return std::make_unique<HistoryView::MediaGift>(message, this);
|
||||
}
|
||||
|
||||
bool MediaGiftBox::activated() const {
|
||||
return _activated;
|
||||
}
|
||||
|
||||
void MediaGiftBox::setActivated(bool activated) {
|
||||
_activated = activated;
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
|
@@ -475,6 +475,36 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class MediaGiftBox final : public Media {
|
||||
public:
|
||||
MediaGiftBox(not_null<HistoryItem*> parent, int months);
|
||||
|
||||
std::unique_ptr<Media> clone(not_null<HistoryItem*> parent) override;
|
||||
|
||||
[[nodiscard]] int months() const;
|
||||
|
||||
[[nodiscard]] bool activated() const;
|
||||
void setActivated(bool activated);
|
||||
|
||||
bool allowsRevoke(TimeId now) const override;
|
||||
TextWithEntities notificationText() const override;
|
||||
QString pinnedTextSubstring() const override;
|
||||
TextForMimeData clipboardText() const override;
|
||||
bool forceForwardedInfo() const override;
|
||||
|
||||
bool updateInlineResultMedia(const MTPMessageMedia &media) override;
|
||||
bool updateSentMedia(const MTPMessageMedia &media) override;
|
||||
std::unique_ptr<HistoryView::Media> createView(
|
||||
not_null<HistoryView::Element*> message,
|
||||
not_null<HistoryItem*> realParent,
|
||||
HistoryView::Element *replacing = nullptr) override;
|
||||
|
||||
private:
|
||||
int _months = 0;
|
||||
bool _activated = false;
|
||||
|
||||
};
|
||||
|
||||
[[nodiscard]] TextForMimeData WithCaptionClipboardText(
|
||||
const QString &attachType,
|
||||
TextForMimeData &&caption);
|
||||
|
Reference in New Issue
Block a user