mirror of https://github.com/procxx/kepka.git
Improve sticker file reference refreshing.
This commit is contained in:
parent
131f7ec5bb
commit
a7772b922c
|
@ -2505,9 +2505,11 @@ void ApiWrap::refreshFileReference(
|
||||||
if (additional) {
|
if (additional) {
|
||||||
const auto i = _fileReferenceHandlers.find(origin);
|
const auto i = _fileReferenceHandlers.find(origin);
|
||||||
Assert(i != end(_fileReferenceHandlers));
|
Assert(i != end(_fileReferenceHandlers));
|
||||||
i->second.push_back([=](auto&&) {
|
if (i->second.size() == 1) {
|
||||||
additional();
|
i->second.push_back([=](auto&&) {
|
||||||
});
|
additional();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const auto fail = [&] {
|
const auto fail = [&] {
|
||||||
|
|
|
@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "core/update_checker.h"
|
#include "core/update_checker.h"
|
||||||
|
|
||||||
AboutBox::AboutBox(QWidget *parent)
|
AboutBox::AboutBox(QWidget *parent)
|
||||||
: _version(this, lng_about_version(lt_version, QString::fromLatin1(AppVersionStr.c_str()) + (AppBetaVersion ? " beta" : "") + (cAlphaVersion() ? qsl(" alpha %1").arg(cAlphaVersion()) : QString())), st::aboutVersionLink)
|
: _version(this, lng_about_version(lt_version, QString::fromLatin1(AppVersionStr.c_str()) + (cAlphaVersion() ? qsl(" alpha %1").arg(cAlphaVersion()) : (AppBetaVersion ? " beta" : ""))), st::aboutVersionLink)
|
||||||
, _text1(this, lang(lng_about_text_1), Ui::FlatLabel::InitType::Rich, st::aboutLabel)
|
, _text1(this, lang(lng_about_text_1), Ui::FlatLabel::InitType::Rich, st::aboutLabel)
|
||||||
, _text2(this, lang(lng_about_text_2), Ui::FlatLabel::InitType::Rich, st::aboutLabel)
|
, _text2(this, lang(lng_about_text_2), Ui::FlatLabel::InitType::Rich, st::aboutLabel)
|
||||||
, _text3(this, st::aboutLabel) {
|
, _text3(this, st::aboutLabel) {
|
||||||
|
@ -99,11 +99,10 @@ QString telegramFaqLink() {
|
||||||
|
|
||||||
QString currentVersionText() {
|
QString currentVersionText() {
|
||||||
auto result = QString::fromLatin1(AppVersionStr.c_str());
|
auto result = QString::fromLatin1(AppVersionStr.c_str());
|
||||||
if (AppBetaVersion) {
|
|
||||||
result += " beta";
|
|
||||||
}
|
|
||||||
if (cAlphaVersion()) {
|
if (cAlphaVersion()) {
|
||||||
result += qsl(" alpha %1").arg(cAlphaVersion() % 1000);
|
result += qsl(" alpha %1").arg(cAlphaVersion() % 1000);
|
||||||
|
} else if (AppBetaVersion) {
|
||||||
|
result += " beta";
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1071,6 +1071,15 @@ void DocumentData::refreshFileReference(const QByteArray &value) {
|
||||||
_fileReference = value;
|
_fileReference = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DocumentData::refreshStickerThumbFileReference() {
|
||||||
|
if (const auto data = sticker()) {
|
||||||
|
if (thumb->loading()) {
|
||||||
|
data->loc.refreshFileReference(
|
||||||
|
thumb->location().fileReference());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString DocumentData::filename() const {
|
QString DocumentData::filename() const {
|
||||||
return _filename;
|
return _filename;
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,6 +166,7 @@ public:
|
||||||
MTPInputDocument mtpInput() const;
|
MTPInputDocument mtpInput() const;
|
||||||
QByteArray fileReference() const;
|
QByteArray fileReference() const;
|
||||||
void refreshFileReference(const QByteArray &value);
|
void refreshFileReference(const QByteArray &value);
|
||||||
|
void refreshStickerThumbFileReference();
|
||||||
|
|
||||||
// When we have some client-side generated document
|
// When we have some client-side generated document
|
||||||
// (for example for displaying an external inline bot result)
|
// (for example for displaying an external inline bot result)
|
||||||
|
|
|
@ -25,8 +25,9 @@ namespace {
|
||||||
|
|
||||||
void SendToBannedHelp(const QString &phone) {
|
void SendToBannedHelp(const QString &phone) {
|
||||||
const auto version = QString::fromLatin1(AppVersionStr.c_str())
|
const auto version = QString::fromLatin1(AppVersionStr.c_str())
|
||||||
+ (AppBetaVersion ? " beta" : "")
|
+ (cAlphaVersion()
|
||||||
+ (cAlphaVersion() ? qsl(" alpha %1").arg(cAlphaVersion()) : QString());
|
? qsl(" alpha %1").arg(cAlphaVersion())
|
||||||
|
: (AppBetaVersion ? " beta" : ""));
|
||||||
|
|
||||||
const auto subject = qsl("Banned phone number: ") + phone;
|
const auto subject = qsl("Banned phone number: ") + phone;
|
||||||
|
|
||||||
|
|
|
@ -3210,7 +3210,7 @@ template <typename CheckSet>
|
||||||
void _writeStickerSets(FileKey &stickersKey, CheckSet checkSet, const Stickers::Order &order) {
|
void _writeStickerSets(FileKey &stickersKey, CheckSet checkSet, const Stickers::Order &order) {
|
||||||
if (!_working()) return;
|
if (!_working()) return;
|
||||||
|
|
||||||
auto &sets = Auth().data().stickerSets();
|
const auto &sets = Auth().data().stickerSets();
|
||||||
if (sets.isEmpty()) {
|
if (sets.isEmpty()) {
|
||||||
if (stickersKey) {
|
if (stickersKey) {
|
||||||
clearKey(stickersKey);
|
clearKey(stickersKey);
|
||||||
|
@ -3223,7 +3223,7 @@ void _writeStickerSets(FileKey &stickersKey, CheckSet checkSet, const Stickers::
|
||||||
int32 setsCount = 0;
|
int32 setsCount = 0;
|
||||||
QByteArray hashToWrite;
|
QByteArray hashToWrite;
|
||||||
quint32 size = sizeof(quint32) + Serialize::bytearraySize(hashToWrite);
|
quint32 size = sizeof(quint32) + Serialize::bytearraySize(hashToWrite);
|
||||||
for_const (auto &set, sets) {
|
for (const auto &set : sets) {
|
||||||
auto result = checkSet(set);
|
auto result = checkSet(set);
|
||||||
if (result == StickerSetCheckResult::Abort) {
|
if (result == StickerSetCheckResult::Abort) {
|
||||||
return;
|
return;
|
||||||
|
@ -3233,7 +3233,8 @@ void _writeStickerSets(FileKey &stickersKey, CheckSet checkSet, const Stickers::
|
||||||
|
|
||||||
// id + access + title + shortName + stickersCount + hash + flags + installDate
|
// id + access + title + shortName + stickersCount + hash + flags + installDate
|
||||||
size += sizeof(quint64) * 2 + Serialize::stringSize(set.title) + Serialize::stringSize(set.shortName) + sizeof(quint32) + sizeof(qint32) * 3;
|
size += sizeof(quint64) * 2 + Serialize::stringSize(set.title) + Serialize::stringSize(set.shortName) + sizeof(quint32) + sizeof(qint32) * 3;
|
||||||
for_const (auto &sticker, set.stickers) {
|
for (const auto sticker : std::as_const(set.stickers)) {
|
||||||
|
sticker->refreshStickerThumbFileReference();
|
||||||
size += Serialize::Document::sizeInStream(sticker);
|
size += Serialize::Document::sizeInStream(sticker);
|
||||||
}
|
}
|
||||||
size += sizeof(qint32); // dates count
|
size += sizeof(qint32); // dates count
|
||||||
|
|
Loading…
Reference in New Issue