mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Support mixed custom / default recent emoji.
This commit is contained in:
@@ -371,17 +371,7 @@ std::unique_ptr<Ui::Text::CustomEmoji> CustomEmojiManager::create(
|
||||
auto i = _instances.find(parsed.id);
|
||||
if (i == end(_instances)) {
|
||||
using Loading = Ui::CustomEmoji::Loading;
|
||||
auto loader = std::make_unique<CustomEmojiLoader>(
|
||||
_owner,
|
||||
parsed,
|
||||
SizeTag::Normal);
|
||||
if (loader->resolving()) {
|
||||
_loaders[parsed.id].push_back(base::make_weak(loader.get()));
|
||||
_pendingForRequest.emplace(parsed.id);
|
||||
if (!_requestId && _pendingForRequest.size() == 1) {
|
||||
crl::on_main(this, [=] { request(); });
|
||||
}
|
||||
}
|
||||
auto loader = createLoader(parsed.id, SizeTag::Normal);
|
||||
const auto repaint = [=](
|
||||
not_null<Ui::CustomEmoji::Instance*> instance,
|
||||
Ui::CustomEmoji::RepaintRequest request) {
|
||||
@@ -406,6 +396,25 @@ std::unique_ptr<Ui::CustomEmoji::Loader> CustomEmojiManager::createLoader(
|
||||
return std::make_unique<CustomEmojiLoader>(document, tag);
|
||||
}
|
||||
|
||||
std::unique_ptr<Ui::CustomEmoji::Loader> CustomEmojiManager::createLoader(
|
||||
DocumentId documentId,
|
||||
SizeTag tag) {
|
||||
const auto selfId = _owner->session().userId().bare;
|
||||
auto result = std::make_unique<CustomEmojiLoader>(
|
||||
_owner,
|
||||
CustomEmojiId{ .selfId = selfId, .id = documentId },
|
||||
tag);
|
||||
if (result->resolving()) {
|
||||
_loaders[documentId].push_back(base::make_weak(result.get()));
|
||||
_pendingForRequest.emplace(documentId);
|
||||
if (!_requestId && _pendingForRequest.size() == 1) {
|
||||
crl::on_main(this, [=] { request(); });
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void CustomEmojiManager::request() {
|
||||
auto ids = QVector<MTPlong>();
|
||||
ids.reserve(std::min(kMaxPerRequest, int(_pendingForRequest.size())));
|
||||
|
@@ -45,6 +45,9 @@ public:
|
||||
[[nodiscard]] std::unique_ptr<Ui::CustomEmoji::Loader> createLoader(
|
||||
not_null<DocumentData*> document,
|
||||
SizeTag tag);
|
||||
[[nodiscard]] std::unique_ptr<Ui::CustomEmoji::Loader> createLoader(
|
||||
DocumentId documentId,
|
||||
SizeTag tag);
|
||||
|
||||
[[nodiscard]] Main::Session &session() const;
|
||||
[[nodiscard]] Session &owner() const;
|
||||
|
@@ -99,7 +99,7 @@ public:
|
||||
uint64 id = 0;
|
||||
uint64 accessHash = 0;
|
||||
uint64 hash = 0;
|
||||
uint64 thumbnailDocumentId = 0;
|
||||
DocumentId thumbnailDocumentId = 0;
|
||||
QString title, shortName;
|
||||
int count = 0;
|
||||
StickersSetFlags flags;
|
||||
|
Reference in New Issue
Block a user