mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Specify gift box sticker explicitly.
This commit is contained in:
parent
1e7117dd67
commit
94e4a8981f
5 changed files with 10 additions and 15 deletions
|
@ -96,10 +96,4 @@ void GiftBoxPack::applySet(const MTPDmessages_stickerSet &data) {
|
|||
}
|
||||
}
|
||||
|
||||
bool GiftBoxPack::isGiftSticker(not_null<DocumentData*> document) const {
|
||||
return _setId
|
||||
&& document->sticker()
|
||||
&& (document->sticker()->set.id == _setId);
|
||||
}
|
||||
|
||||
} // namespace Stickers
|
||||
|
|
|
@ -23,8 +23,6 @@ public:
|
|||
void load();
|
||||
[[nodiscard]] DocumentData *lookup(int months) const;
|
||||
|
||||
[[nodiscard]] bool isGiftSticker(not_null<DocumentData*> document) const;
|
||||
|
||||
private:
|
||||
using SetId = uint64;
|
||||
void applySet(const MTPDmessages_stickerSet &data);
|
||||
|
|
|
@ -232,6 +232,7 @@ void MediaGift::ensureStickerCreated() const {
|
|||
const auto skipPremiumEffect = false;
|
||||
_sticker.emplace(_parent, document, skipPremiumEffect, _parent);
|
||||
_sticker->setDiceIndex(sticker->alt, 1);
|
||||
_sticker->setGiftBoxSticker(true);
|
||||
_sticker->initSize();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,9 +21,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "core/application.h"
|
||||
#include "core/core_settings.h"
|
||||
#include "core/click_handler_types.h"
|
||||
#include "main/main_session.h"
|
||||
#include "main/main_account.h"
|
||||
#include "main/main_app_config.h"
|
||||
#include "window/window_session_controller.h" // isGifPausedAtLeastFor.
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_document.h"
|
||||
|
@ -32,7 +29,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_file_origin.h"
|
||||
#include "lottie/lottie_single_player.h"
|
||||
#include "media/clip/media_clip_reader.h"
|
||||
#include "chat_helpers/stickers_gift_box_pack.h"
|
||||
#include "chat_helpers/stickers_lottie.h"
|
||||
#include "styles/style_chat.h"
|
||||
|
||||
|
@ -223,7 +219,8 @@ Sticker::Sticker(
|
|||
, _oncePlayed(false)
|
||||
, _premiumEffectPlayed(false)
|
||||
, _nextLastDiceFrame(false)
|
||||
, _skipPremiumEffect(skipPremiumEffect) {
|
||||
, _skipPremiumEffect(skipPremiumEffect)
|
||||
, _giftBoxSticker(false) {
|
||||
if ((_dataMedia = _data->activeMediaView())) {
|
||||
dataMediaCreated();
|
||||
} else {
|
||||
|
@ -271,8 +268,7 @@ bool Sticker::isEmojiSticker() const {
|
|||
|
||||
void Sticker::initSize() {
|
||||
if (isEmojiSticker() || _diceIndex >= 0) {
|
||||
const auto &session = _data->owner().session();
|
||||
if (session.giftBoxStickersPacks().isGiftSticker(_data)) {
|
||||
if (_giftBoxSticker) {
|
||||
_size = st::msgServiceGiftBoxStickerSize;
|
||||
} else {
|
||||
_size = EmojiSize();
|
||||
|
@ -622,6 +618,10 @@ void Sticker::setCustomEmojiPart(
|
|||
_cachingTag = tag;
|
||||
}
|
||||
|
||||
void Sticker::setGiftBoxSticker(bool giftBoxSticker) {
|
||||
_giftBoxSticker = giftBoxSticker;
|
||||
}
|
||||
|
||||
void Sticker::setupPlayer() {
|
||||
Expects(_dataMedia != nullptr);
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ public:
|
|||
|
||||
void setDiceIndex(const QString &emoji, int index);
|
||||
void setCustomEmojiPart(int size, ChatHelpers::StickerLottieSize tag);
|
||||
void setGiftBoxSticker(bool giftBoxSticker);
|
||||
[[nodiscard]] bool atTheEnd() const {
|
||||
return (_frameIndex >= 0) && (_frameIndex + 1 == _framesCount);
|
||||
}
|
||||
|
@ -158,6 +159,7 @@ private:
|
|||
mutable bool _premiumEffectPlayed : 1;
|
||||
mutable bool _nextLastDiceFrame : 1;
|
||||
bool _skipPremiumEffect : 1;
|
||||
bool _giftBoxSticker : 1;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue