mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Update API scheme on layer 142: Premium stickers.
This commit is contained in:
parent
c3386fba52
commit
5874ae7c51
18 changed files with 85 additions and 16 deletions
|
@ -110,7 +110,7 @@ storage.fileMp4#b3cea0e4 = storage.FileType;
|
||||||
storage.fileWebp#1081464c = storage.FileType;
|
storage.fileWebp#1081464c = storage.FileType;
|
||||||
|
|
||||||
userEmpty#d3bc4b7a id:long = User;
|
userEmpty#d3bc4b7a id:long = User;
|
||||||
user#3ff6ecb0 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;
|
user#3ff6ecb0 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;
|
||||||
|
|
||||||
userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
|
userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
|
||||||
userProfilePhoto#82d1f706 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;
|
userProfilePhoto#82d1f706 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;
|
||||||
|
@ -582,7 +582,7 @@ messages.stickerSetNotModified#d3f924eb = messages.StickerSet;
|
||||||
|
|
||||||
botCommand#c27ac8c7 command:string description:string = BotCommand;
|
botCommand#c27ac8c7 command:string description:string = BotCommand;
|
||||||
|
|
||||||
botInfo#cc8ba4d7 flags:# user_id:flags.0?long description:flags.1?string description_photo:flags.4?Photo commands:flags.2?Vector<BotCommand> menu_button:flags.3?BotMenuButton = BotInfo;
|
botInfo#8f300b57 flags:# user_id:flags.0?long description:flags.1?string description_photo:flags.4?Photo description_document:flags.5?Document commands:flags.2?Vector<BotCommand> menu_button:flags.3?BotMenuButton = BotInfo;
|
||||||
|
|
||||||
keyboardButton#a2fa4880 text:string = KeyboardButton;
|
keyboardButton#a2fa4880 text:string = KeyboardButton;
|
||||||
keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton;
|
keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton;
|
||||||
|
|
|
@ -450,6 +450,11 @@ void ApiWrap::sendMessageFail(
|
||||||
? tr::lng_error_noforwards_channel(tr::now)
|
? tr::lng_error_noforwards_channel(tr::now)
|
||||||
: tr::lng_error_noforwards_group(tr::now)
|
: tr::lng_error_noforwards_group(tr::now)
|
||||||
}, .duration = kJoinErrorDuration });
|
}, .duration = kJoinErrorDuration });
|
||||||
|
} else if (error.type() == qstr("PREMIUM_ACCOUNT_REQUIRED")) {
|
||||||
|
Ui::ShowMultilineToast({
|
||||||
|
.text = { u"Premium sticker."_q },
|
||||||
|
.duration = kJoinErrorDuration,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (const auto item = _session->data().message(itemId)) {
|
if (const auto item = _session->data().message(itemId)) {
|
||||||
Assert(randomId != 0);
|
Assert(randomId != 0);
|
||||||
|
|
|
@ -465,7 +465,8 @@ bool DocumentData::checkWallPaperProperties() {
|
||||||
void DocumentData::updateThumbnails(
|
void DocumentData::updateThumbnails(
|
||||||
const InlineImageLocation &inlineThumbnail,
|
const InlineImageLocation &inlineThumbnail,
|
||||||
const ImageWithLocation &thumbnail,
|
const ImageWithLocation &thumbnail,
|
||||||
const ImageWithLocation &videoThumbnail) {
|
const ImageWithLocation &videoThumbnail,
|
||||||
|
bool isPremiumSticker) {
|
||||||
if (!inlineThumbnail.bytes.isEmpty()
|
if (!inlineThumbnail.bytes.isEmpty()
|
||||||
&& _inlineThumbnailBytes.isEmpty()) {
|
&& _inlineThumbnailBytes.isEmpty()) {
|
||||||
_inlineThumbnailBytes = inlineThumbnail.bytes;
|
_inlineThumbnailBytes = inlineThumbnail.bytes;
|
||||||
|
@ -475,6 +476,11 @@ void DocumentData::updateThumbnails(
|
||||||
_flags &= ~Flag::InlineThumbnailIsPath;
|
_flags &= ~Flag::InlineThumbnailIsPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isPremiumSticker) {
|
||||||
|
_flags |= Flag::PremiumSticker;
|
||||||
|
} else {
|
||||||
|
_flags &= ~Flag::PremiumSticker;
|
||||||
|
}
|
||||||
Data::UpdateCloudFile(
|
Data::UpdateCloudFile(
|
||||||
_thumbnail,
|
_thumbnail,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
|
@ -511,6 +517,10 @@ bool DocumentData::isPatternWallPaperSVG() const {
|
||||||
return isWallPaper() && hasMimeType(qstr("application/x-tgwallpattern"));
|
return isWallPaper() && hasMimeType(qstr("application/x-tgwallpattern"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DocumentData::isPremiumSticker() const {
|
||||||
|
return (_flags & Flag::PremiumSticker);
|
||||||
|
}
|
||||||
|
|
||||||
bool DocumentData::hasThumbnail() const {
|
bool DocumentData::hasThumbnail() const {
|
||||||
return _thumbnail.location.valid();
|
return _thumbnail.location.valid();
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,6 @@ struct StickerData : public DocumentAdditionalData {
|
||||||
struct SongData : public DocumentAdditionalData {
|
struct SongData : public DocumentAdditionalData {
|
||||||
int32 duration = 0;
|
int32 duration = 0;
|
||||||
QString title, performer;
|
QString title, performer;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct VoiceData : public DocumentAdditionalData {
|
struct VoiceData : public DocumentAdditionalData {
|
||||||
|
@ -172,6 +171,7 @@ public:
|
||||||
[[nodiscard]] bool isPatternWallPaper() const;
|
[[nodiscard]] bool isPatternWallPaper() const;
|
||||||
[[nodiscard]] bool isPatternWallPaperPNG() const;
|
[[nodiscard]] bool isPatternWallPaperPNG() const;
|
||||||
[[nodiscard]] bool isPatternWallPaperSVG() const;
|
[[nodiscard]] bool isPatternWallPaperSVG() const;
|
||||||
|
[[nodiscard]] bool isPremiumSticker() const;
|
||||||
|
|
||||||
[[nodiscard]] bool hasThumbnail() const;
|
[[nodiscard]] bool hasThumbnail() const;
|
||||||
[[nodiscard]] bool thumbnailLoading() const;
|
[[nodiscard]] bool thumbnailLoading() const;
|
||||||
|
@ -190,7 +190,8 @@ public:
|
||||||
void updateThumbnails(
|
void updateThumbnails(
|
||||||
const InlineImageLocation &inlineThumbnail,
|
const InlineImageLocation &inlineThumbnail,
|
||||||
const ImageWithLocation &thumbnail,
|
const ImageWithLocation &thumbnail,
|
||||||
const ImageWithLocation &videoThumbnail);
|
const ImageWithLocation &videoThumbnail,
|
||||||
|
bool isPremiumSticker);
|
||||||
|
|
||||||
[[nodiscard]] QByteArray inlineThumbnailBytes() const {
|
[[nodiscard]] QByteArray inlineThumbnailBytes() const {
|
||||||
return _inlineThumbnailBytes;
|
return _inlineThumbnailBytes;
|
||||||
|
@ -279,6 +280,7 @@ private:
|
||||||
HasAttachedStickers = 0x040,
|
HasAttachedStickers = 0x040,
|
||||||
InlineThumbnailIsPath = 0x080,
|
InlineThumbnailIsPath = 0x080,
|
||||||
ForceToCache = 0x100,
|
ForceToCache = 0x100,
|
||||||
|
PremiumSticker = 0x200,
|
||||||
};
|
};
|
||||||
using Flags = base::flags<Flag>;
|
using Flags = base::flags<Flag>;
|
||||||
friend constexpr bool is_flag_type(Flag) { return true; };
|
friend constexpr bool is_flag_type(Flag) { return true; };
|
||||||
|
|
|
@ -743,6 +743,7 @@ void DownloadManager::generateEntry(
|
||||||
InlineImageLocation(), // inlineThumbnail
|
InlineImageLocation(), // inlineThumbnail
|
||||||
ImageWithLocation(), // thumbnail
|
ImageWithLocation(), // thumbnail
|
||||||
ImageWithLocation(), // videoThumbnail
|
ImageWithLocation(), // videoThumbnail
|
||||||
|
false, // isPremiumSticker
|
||||||
0, // dc
|
0, // dc
|
||||||
id.size);
|
id.size);
|
||||||
document->setLocation(Core::FileLocation(info));
|
document->setLocation(Core::FileLocation(info));
|
||||||
|
|
|
@ -2672,7 +2672,8 @@ not_null<DocumentData*> Session::processDocument(
|
||||||
qs(data.vmime_type()),
|
qs(data.vmime_type()),
|
||||||
InlineImageLocation(),
|
InlineImageLocation(),
|
||||||
thumbnail,
|
thumbnail,
|
||||||
ImageWithLocation(),
|
ImageWithLocation(), // videoThumbnail
|
||||||
|
false, // isPremiumSticker
|
||||||
data.vdc_id().v,
|
data.vdc_id().v,
|
||||||
data.vsize().v);
|
data.vsize().v);
|
||||||
}, [&](const MTPDdocumentEmpty &data) {
|
}, [&](const MTPDdocumentEmpty &data) {
|
||||||
|
@ -2690,6 +2691,7 @@ not_null<DocumentData*> Session::document(
|
||||||
const InlineImageLocation &inlineThumbnail,
|
const InlineImageLocation &inlineThumbnail,
|
||||||
const ImageWithLocation &thumbnail,
|
const ImageWithLocation &thumbnail,
|
||||||
const ImageWithLocation &videoThumbnail,
|
const ImageWithLocation &videoThumbnail,
|
||||||
|
bool isPremiumSticker,
|
||||||
int32 dc,
|
int32 dc,
|
||||||
int32 size) {
|
int32 size) {
|
||||||
const auto result = document(id);
|
const auto result = document(id);
|
||||||
|
@ -2703,6 +2705,7 @@ not_null<DocumentData*> Session::document(
|
||||||
inlineThumbnail,
|
inlineThumbnail,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
videoThumbnail,
|
videoThumbnail,
|
||||||
|
isPremiumSticker,
|
||||||
dc,
|
dc,
|
||||||
size);
|
size);
|
||||||
return result;
|
return result;
|
||||||
|
@ -2771,6 +2774,7 @@ DocumentData *Session::documentFromWeb(
|
||||||
InlineImageLocation(),
|
InlineImageLocation(),
|
||||||
ImageWithLocation{ .location = thumbnailLocation },
|
ImageWithLocation{ .location = thumbnailLocation },
|
||||||
ImageWithLocation{ .location = videoThumbnailLocation },
|
ImageWithLocation{ .location = videoThumbnailLocation },
|
||||||
|
false, // isPremiumSticker
|
||||||
session().mainDcId(),
|
session().mainDcId(),
|
||||||
int32(0)); // data.vsize().v
|
int32(0)); // data.vsize().v
|
||||||
result->setWebLocation(WebFileLocation(
|
result->setWebLocation(WebFileLocation(
|
||||||
|
@ -2793,6 +2797,7 @@ DocumentData *Session::documentFromWeb(
|
||||||
InlineImageLocation(),
|
InlineImageLocation(),
|
||||||
ImageWithLocation{ .location = thumbnailLocation },
|
ImageWithLocation{ .location = thumbnailLocation },
|
||||||
ImageWithLocation{ .location = videoThumbnailLocation },
|
ImageWithLocation{ .location = videoThumbnailLocation },
|
||||||
|
false, // isPremiumSticker
|
||||||
session().mainDcId(),
|
session().mainDcId(),
|
||||||
int32(0)); // data.vsize().v
|
int32(0)); // data.vsize().v
|
||||||
result->setContentUrl(qs(data.vurl()));
|
result->setContentUrl(qs(data.vurl()));
|
||||||
|
@ -2820,6 +2825,8 @@ void Session::documentApplyFields(
|
||||||
const auto videoThumbnail = videoThumbnailSize
|
const auto videoThumbnail = videoThumbnailSize
|
||||||
? Images::FromVideoSize(_session, data, *videoThumbnailSize)
|
? Images::FromVideoSize(_session, data, *videoThumbnailSize)
|
||||||
: ImageWithLocation();
|
: ImageWithLocation();
|
||||||
|
const auto isPremiumSticker = videoThumbnailSize
|
||||||
|
&& (videoThumbnailSize->c_videoSize().vtype().v == "fp");
|
||||||
documentApplyFields(
|
documentApplyFields(
|
||||||
document,
|
document,
|
||||||
data.vaccess_hash().v,
|
data.vaccess_hash().v,
|
||||||
|
@ -2830,6 +2837,7 @@ void Session::documentApplyFields(
|
||||||
inlineThumbnail,
|
inlineThumbnail,
|
||||||
prepared,
|
prepared,
|
||||||
videoThumbnail,
|
videoThumbnail,
|
||||||
|
isPremiumSticker,
|
||||||
data.vdc_id().v,
|
data.vdc_id().v,
|
||||||
data.vsize().v);
|
data.vsize().v);
|
||||||
}
|
}
|
||||||
|
@ -2844,6 +2852,7 @@ void Session::documentApplyFields(
|
||||||
const InlineImageLocation &inlineThumbnail,
|
const InlineImageLocation &inlineThumbnail,
|
||||||
const ImageWithLocation &thumbnail,
|
const ImageWithLocation &thumbnail,
|
||||||
const ImageWithLocation &videoThumbnail,
|
const ImageWithLocation &videoThumbnail,
|
||||||
|
bool isPremiumSticker,
|
||||||
int32 dc,
|
int32 dc,
|
||||||
int32 size) {
|
int32 size) {
|
||||||
if (!date) {
|
if (!date) {
|
||||||
|
@ -2854,7 +2863,8 @@ void Session::documentApplyFields(
|
||||||
document->updateThumbnails(
|
document->updateThumbnails(
|
||||||
inlineThumbnail,
|
inlineThumbnail,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
videoThumbnail);
|
videoThumbnail,
|
||||||
|
isPremiumSticker);
|
||||||
document->size = size;
|
document->size = size;
|
||||||
document->setattributes(attributes);
|
document->setattributes(attributes);
|
||||||
|
|
||||||
|
|
|
@ -502,6 +502,7 @@ public:
|
||||||
const InlineImageLocation &inlineThumbnail,
|
const InlineImageLocation &inlineThumbnail,
|
||||||
const ImageWithLocation &thumbnail,
|
const ImageWithLocation &thumbnail,
|
||||||
const ImageWithLocation &videoThumbnail,
|
const ImageWithLocation &videoThumbnail,
|
||||||
|
bool isPremiumSticker,
|
||||||
int32 dc,
|
int32 dc,
|
||||||
int32 size);
|
int32 size);
|
||||||
void documentConvert(
|
void documentConvert(
|
||||||
|
@ -753,6 +754,7 @@ private:
|
||||||
const InlineImageLocation &inlineThumbnail,
|
const InlineImageLocation &inlineThumbnail,
|
||||||
const ImageWithLocation &thumbnail,
|
const ImageWithLocation &thumbnail,
|
||||||
const ImageWithLocation &videoThumbnail,
|
const ImageWithLocation &videoThumbnail,
|
||||||
|
bool isPremiumSticker,
|
||||||
int32 dc,
|
int32 dc,
|
||||||
int32 size);
|
int32 size);
|
||||||
DocumentData *documentFromWeb(
|
DocumentData *documentFromWeb(
|
||||||
|
|
|
@ -46,6 +46,7 @@ enum class UserDataFlag {
|
||||||
CanPinMessages = (1 << 11),
|
CanPinMessages = (1 << 11),
|
||||||
DiscardMinPhoto = (1 << 12),
|
DiscardMinPhoto = (1 << 12),
|
||||||
Self = (1 << 13),
|
Self = (1 << 13),
|
||||||
|
Premium = (1 << 14),
|
||||||
};
|
};
|
||||||
inline constexpr bool is_flag_type(UserDataFlag) { return true; };
|
inline constexpr bool is_flag_type(UserDataFlag) { return true; };
|
||||||
using UserDataFlags = base::flags<UserDataFlag>;
|
using UserDataFlags = base::flags<UserDataFlag>;
|
||||||
|
@ -96,6 +97,9 @@ public:
|
||||||
[[nodiscard]] bool isFake() const {
|
[[nodiscard]] bool isFake() const {
|
||||||
return flags() & UserDataFlag::Fake;
|
return flags() & UserDataFlag::Fake;
|
||||||
}
|
}
|
||||||
|
[[nodiscard]] bool isPremium() const {
|
||||||
|
return flags() & UserDataFlag::Premium;
|
||||||
|
}
|
||||||
[[nodiscard]] bool isBotInlineGeo() const {
|
[[nodiscard]] bool isBotInlineGeo() const {
|
||||||
return flags() & UserDataFlag::BotInlineGeo;
|
return flags() & UserDataFlag::BotInlineGeo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6680,9 +6680,10 @@ bool HistoryWidget::sendExistingDocument(
|
||||||
Ui::MakeInformBox(*error),
|
Ui::MakeInformBox(*error),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return false;
|
return false;
|
||||||
} else if (!_peer || !_peer->canWrite()) {
|
} else if (!_peer
|
||||||
return false;
|
|| !_peer->canWrite()
|
||||||
} else if (showSlowmodeError()) {
|
|| showSlowmodeError()
|
||||||
|
|| ShowSendPremiumError(controller(), document)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ enum class FilterType {
|
||||||
InlineImageLocation(),
|
InlineImageLocation(),
|
||||||
ImageWithLocation(),
|
ImageWithLocation(),
|
||||||
ImageWithLocation(),
|
ImageWithLocation(),
|
||||||
|
false, // isPremiumSticker
|
||||||
owner->session().mainDcId(),
|
owner->session().mainDcId(),
|
||||||
int32(0));
|
int32(0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1090,7 +1090,8 @@ bool RepliesWidget::sendExistingDocument(
|
||||||
Ui::MakeInformBox(*error),
|
Ui::MakeInformBox(*error),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return false;
|
return false;
|
||||||
} else if (showSlowmodeError()) {
|
} else if (showSlowmodeError()
|
||||||
|
|| ShowSendPremiumError(controller(), document)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -685,6 +685,8 @@ bool ScheduledWidget::sendExistingDocument(
|
||||||
Ui::MakeInformBox(*error),
|
Ui::MakeInformBox(*error),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return false;
|
return false;
|
||||||
|
} else if (ShowSendPremiumError(controller(), document)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Api::SendExistingDocument(
|
Api::SendExistingDocument(
|
||||||
|
|
|
@ -462,6 +462,8 @@ void AppendEmojiPacks(
|
||||||
if (const auto error = RestrictionToSendStickers(_controller)) {
|
if (const auto error = RestrictionToSendStickers(_controller)) {
|
||||||
_controller->show(Ui::MakeInformBox(*error));
|
_controller->show(Ui::MakeInformBox(*error));
|
||||||
return true;
|
return true;
|
||||||
|
} else if (ShowSendPremiumError(_controller, document)) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
Api::SendExistingDocument(
|
Api::SendExistingDocument(
|
||||||
Api::MessageToSend(
|
Api::MessageToSend(
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace Serialize {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr auto kVersionTag = int32(0x7FFFFFFF);
|
constexpr auto kVersionTag = int32(0x7FFFFFFF);
|
||||||
constexpr auto kVersion = 3;
|
constexpr auto kVersion = 4;
|
||||||
|
|
||||||
enum StickerSetType {
|
enum StickerSetType {
|
||||||
StickerSetTypeEmpty = 0,
|
StickerSetTypeEmpty = 0,
|
||||||
|
@ -45,6 +45,7 @@ void Document::writeToStream(QDataStream &stream, DocumentData *document) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stream << qint32(document->getDuration());
|
stream << qint32(document->getDuration());
|
||||||
|
stream << qint32(document->isPremiumSticker() ? 1 : 0);
|
||||||
writeImageLocation(stream, document->thumbnailLocation());
|
writeImageLocation(stream, document->thumbnailLocation());
|
||||||
stream << qint32(document->thumbnailByteSize());
|
stream << qint32(document->thumbnailByteSize());
|
||||||
writeImageLocation(stream, document->videoThumbnailLocation());
|
writeImageLocation(stream, document->videoThumbnailLocation());
|
||||||
|
@ -86,6 +87,7 @@ DocumentData *Document::readFromStreamHelper(
|
||||||
}
|
}
|
||||||
|
|
||||||
qint32 duration = -1;
|
qint32 duration = -1;
|
||||||
|
qint32 isPremiumSticker = 0;
|
||||||
if (type == StickerDocument) {
|
if (type == StickerDocument) {
|
||||||
QString alt;
|
QString alt;
|
||||||
qint32 typeOfSet;
|
qint32 typeOfSet;
|
||||||
|
@ -116,6 +118,9 @@ DocumentData *Document::readFromStreamHelper(
|
||||||
}
|
}
|
||||||
if (version >= 3) {
|
if (version >= 3) {
|
||||||
stream >> duration;
|
stream >> duration;
|
||||||
|
if (version >= 4) {
|
||||||
|
stream >> isPremiumSticker;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stream >> duration;
|
stream >> duration;
|
||||||
|
@ -185,6 +190,7 @@ DocumentData *Document::readFromStreamHelper(
|
||||||
.location = *videoThumb,
|
.location = *videoThumb,
|
||||||
.bytesCount = videoThumbnailByteSize
|
.bytesCount = videoThumbnailByteSize
|
||||||
},
|
},
|
||||||
|
(isPremiumSticker == 1),
|
||||||
dc,
|
dc,
|
||||||
size);
|
size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2169,8 +2169,9 @@ void Account::importOldRecentStickers() {
|
||||||
attributes,
|
attributes,
|
||||||
mime,
|
mime,
|
||||||
InlineImageLocation(),
|
InlineImageLocation(),
|
||||||
ImageWithLocation(),
|
ImageWithLocation(), // thumbnail
|
||||||
ImageWithLocation(),
|
ImageWithLocation(), // videoThumbnail
|
||||||
|
false, // isPremiumSticker
|
||||||
dc,
|
dc,
|
||||||
size);
|
size);
|
||||||
if (!doc->sticker()) {
|
if (!doc->sticker()) {
|
||||||
|
|
|
@ -100,12 +100,13 @@ void LoadAndApplyThumbnail(
|
||||||
document->updateThumbnails(
|
document->updateThumbnails(
|
||||||
InlineImageLocation(),
|
InlineImageLocation(),
|
||||||
imageWithLocation,
|
imageWithLocation,
|
||||||
ImageWithLocation{ .location = ImageLocation() });
|
ImageWithLocation{ .location = ImageLocation() },
|
||||||
|
document->isPremiumSticker());
|
||||||
|
|
||||||
document->loadThumbnail(Data::FileOrigin());
|
document->loadThumbnail(Data::FileOrigin());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
void LoadThumbnailFromExternal(not_null<DocumentData*> document) {
|
void LoadThumbnailFromExternal(not_null<DocumentData*> document) {
|
||||||
const auto songData = document->song();
|
const auto songData = document->song();
|
||||||
|
|
|
@ -10,7 +10,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "ui/ui_utility.h"
|
#include "ui/ui_utility.h"
|
||||||
#include "ui/chat/chat_theme.h"
|
#include "ui/chat/chat_theme.h"
|
||||||
|
#include "ui/toasts/common_toasts.h"
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
|
#include "data/data_user.h"
|
||||||
|
#include "data/data_document.h"
|
||||||
#include "data/data_changes.h"
|
#include "data/data_changes.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_cloud_themes.h"
|
#include "data/data_cloud_themes.h"
|
||||||
|
@ -322,4 +325,17 @@ auto ChatThemeValueFromPeer(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ShowSendPremiumError(
|
||||||
|
not_null<SessionController*> controller,
|
||||||
|
not_null<DocumentData*> document) {
|
||||||
|
if (!document->isPremiumSticker()
|
||||||
|
|| document->session().user()->isPremium()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Ui::ShowMultilineToast({
|
||||||
|
.text = { u"Premium sticker."_q },
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
|
|
@ -205,4 +205,8 @@ private:
|
||||||
not_null<PeerData*> peer)
|
not_null<PeerData*> peer)
|
||||||
-> rpl::producer<std::shared_ptr<Ui::ChatTheme>>;
|
-> rpl::producer<std::shared_ptr<Ui::ChatTheme>>;
|
||||||
|
|
||||||
|
[[nodiscard]] bool ShowSendPremiumError(
|
||||||
|
not_null<SessionController*> controller,
|
||||||
|
not_null<DocumentData*> document);
|
||||||
|
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
|
Loading…
Add table
Reference in a new issue