Fix animated stickers extension.
GitOrigin-RevId: 69d65bd19e46fe2eb2dc6ebb4afd6dd64164ffc9
This commit is contained in:
parent
7081198275
commit
e76c98ad74
@ -25267,7 +25267,7 @@ void MessagesManager::on_get_channel_dialog(DialogId dialog_id, MessageId last_m
|
||||
// There are many ways of handling a gap in a channel:
|
||||
// 1) Delete all known messages in the chat, begin from scratch. It is easy to implement, but suddenly disappearing
|
||||
// messages looks awful for the user.
|
||||
// 2) Save all messages loaded in the memory until application restart, but delete all messages from database.
|
||||
// 2) Save all messages loaded in the memory until application restart, but delete all messages from the database.
|
||||
// Messages left in the memory must be lazily updated using calls to getHistory. It looks much smoothly for the
|
||||
// user, he will need to redownload messages only after client restart. Unsynchronized messages left in the
|
||||
// memory shouldn't be saved to database, results of getHistory and getMessage must be used to update state of
|
||||
|
@ -1272,11 +1272,13 @@ std::pair<int64, FileId> StickersManager::on_get_sticker_document(
|
||||
return {};
|
||||
}
|
||||
|
||||
bool is_animated = document->mime_type_ == "application/x-tgsticker";
|
||||
int64 document_id = document->id_;
|
||||
FileId sticker_id = td_->file_manager_->register_remote(
|
||||
FullRemoteFileLocation(FileType::Sticker, document_id, document->access_hash_, dc_id,
|
||||
document->file_reference_.as_slice().str()),
|
||||
FileLocationSource::FromServer, DialogId(), document->size_, 0, PSTRING() << document_id << ".webp");
|
||||
FileId sticker_id =
|
||||
td_->file_manager_->register_remote(FullRemoteFileLocation(FileType::Sticker, document_id, document->access_hash_,
|
||||
dc_id, document->file_reference_.as_slice().str()),
|
||||
FileLocationSource::FromServer, DialogId(), document->size_, 0,
|
||||
PSTRING() << document_id << (is_animated ? ".tgs" : ".webp"));
|
||||
|
||||
PhotoSize thumbnail;
|
||||
for (auto &thumb : document->thumbs_) {
|
||||
@ -1291,8 +1293,7 @@ std::pair<int64, FileId> StickersManager::on_get_sticker_document(
|
||||
}
|
||||
}
|
||||
|
||||
create_sticker(sticker_id, std::move(thumbnail), dimensions, std::move(sticker),
|
||||
document->mime_type_ == "application/x-tgsticker", nullptr);
|
||||
create_sticker(sticker_id, std::move(thumbnail), dimensions, std::move(sticker), is_animated, nullptr);
|
||||
return {document_id, sticker_id};
|
||||
}
|
||||
|
||||
|
@ -1343,16 +1343,16 @@ Result<FileId> FileManager::merge(FileId x_file_id, FileId y_file_id, bool no_sy
|
||||
return Status::Error("Can't merge files. Different encryption keys");
|
||||
}
|
||||
}
|
||||
if (trusted_by_source == 0) { // if new is more trusted
|
||||
if (remote_name_i == 2) {
|
||||
remote_name_i = 0;
|
||||
}
|
||||
if (url_i == 2) {
|
||||
url_i = 0;
|
||||
}
|
||||
if (expected_size_i == 2) {
|
||||
expected_size_i = 0;
|
||||
}
|
||||
|
||||
// prefer more trusted source
|
||||
if (remote_name_i == 2) {
|
||||
remote_name_i = trusted_by_source;
|
||||
}
|
||||
if (url_i == 2) {
|
||||
url_i = trusted_by_source;
|
||||
}
|
||||
if (expected_size_i == 2) {
|
||||
expected_size_i = trusted_by_source;
|
||||
}
|
||||
|
||||
int node_i =
|
||||
|
Reference in New Issue
Block a user