Try to optimize sticker set handling (less reload)

This commit is contained in:
Sebastian Wolf 2022-01-07 23:00:28 +01:00
parent 932f483b7a
commit 60c1ed6bb1
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
2 changed files with 3 additions and 3 deletions

View file

@ -178,9 +178,8 @@ Page {
updateGroupStatusText();
}
if (stickerManager.needsReload()) {
Debug.log("[ChatPage] Stickers will be reloaded!");
Debug.log("[ChatPage] Recent stickers will be reloaded!");
tdLibWrapper.getRecentStickers();
tdLibWrapper.getInstalledStickerSets();
stickerManager.setNeedsReload(false);
}
tdLibWrapper.getChatPinnedMessage(chatInformation.id);
@ -1448,6 +1447,7 @@ Page {
target: stickerPickerLoader.item
onStickerPicked: {
Debug.log("Sticker picked: " + stickerId);
stickerManager.setNeedsReload(true);
tdLibWrapper.sendStickerMessage(chatInformation.id, stickerId, newMessageColumn.replyToMessageId);
stickerPickerLoader.active = false;
attachmentOptionsFlickable.isNeeded = false;

View file

@ -27,6 +27,7 @@ StickerManager::StickerManager(TDLibWrapper *tdLibWrapper, QObject *parent) : QO
{
LOG("Initializing...");
this->tdLibWrapper = tdLibWrapper;
this->reloadNeeded = false;
connect(this->tdLibWrapper, SIGNAL(recentStickersUpdated(QVariantList)), this, SLOT(handleRecentStickersUpdated(QVariantList)));
connect(this->tdLibWrapper, SIGNAL(stickersReceived(QVariantList)), this, SLOT(handleStickersReceived(QVariantList)));
@ -157,7 +158,6 @@ void StickerManager::handleStickerSetReceived(const QVariantMap &stickerSet)
QVariantMap thumbnailLocalFile = thumbnailFile.value("local").toMap();
if (!thumbnailLocalFile.value("is_downloading_completed").toBool()) {
tdLibWrapper->downloadFile(thumbnailFile.value("id").toInt());
this->reloadNeeded = true;
}
}
}