mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Added initial api support of default list for emoji profile.
This commit is contained in:
parent
607e79fca0
commit
6ffdc52b55
3 changed files with 31 additions and 0 deletions
|
@ -425,6 +425,22 @@ void PeerPhoto::requestUserPhotos(
|
|||
_userPhotosRequests.emplace(user, requestId);
|
||||
}
|
||||
|
||||
void PeerPhoto::requestProfileEmojiList() {
|
||||
_api.request(MTPaccount_GetDefaultProfilePhotoEmojis(
|
||||
)).done([=](const MTPEmojiList &result) {
|
||||
result.match([](const MTPDemojiListNotModified &data) {
|
||||
}, [&](const MTPDemojiList &data) {
|
||||
_profileEmojiList = ranges::views::all(
|
||||
data.vdocument_id().v
|
||||
) | ranges::views::transform(&MTPlong::v) | ranges::to_vector;
|
||||
});
|
||||
}).send();
|
||||
}
|
||||
|
||||
std::vector<DocumentId> PeerPhoto::profileEmojiList() const {
|
||||
return _profileEmojiList;
|
||||
}
|
||||
|
||||
// Non-personal photo in case a personal photo is set.
|
||||
void PeerPhoto::registerNonPersonalPhoto(
|
||||
not_null<UserData*> user,
|
||||
|
|
|
@ -44,6 +44,9 @@ public:
|
|||
|
||||
void requestUserPhotos(not_null<UserData*> user, UserPhotoId afterId);
|
||||
|
||||
void requestProfileEmojiList();
|
||||
[[nodiscard]] std::vector<DocumentId> profileEmojiList() const;
|
||||
|
||||
// Non-personal photo in case a personal photo is set.
|
||||
void registerNonPersonalPhoto(
|
||||
not_null<UserData*> user,
|
||||
|
@ -83,6 +86,8 @@ private:
|
|||
not_null<UserData*>,
|
||||
not_null<PhotoData*>> _nonPersonalPhotos;
|
||||
|
||||
std::vector<DocumentId> _profileEmojiList;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Api
|
||||
|
|
|
@ -212,6 +212,16 @@ void UserpicButton::prepare() {
|
|||
prepareUserpicPixmap();
|
||||
}
|
||||
setClickHandlerByRole();
|
||||
if ((_role == Role::ChoosePhoto) || (_role == Role::ChangePhoto)) {
|
||||
const auto api = _controller
|
||||
? &_controller->session().api()
|
||||
: _peer
|
||||
? &_peer->session().api()
|
||||
: nullptr;
|
||||
if (api) {
|
||||
api->peerPhoto().requestProfileEmojiList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UserpicButton::showCustomOnChosen() {
|
||||
|
|
Loading…
Add table
Reference in a new issue