mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Improved ability set emoji status locally in profile top bar.
This commit is contained in:
@@ -1857,7 +1857,7 @@ void EditPeerProfileColorSection(
|
||||
: std::optional<Ui::ColorCollectible>();
|
||||
|
||||
const auto resetUnique = [=] {
|
||||
preview->setLocalCollectible(nullptr);
|
||||
preview->setLocalEmojiStatusId({});
|
||||
state->buyCollectible = nullptr;
|
||||
state->collectible.force_assign(std::nullopt);
|
||||
};
|
||||
@@ -1976,9 +1976,8 @@ void EditPeerProfileColorSection(
|
||||
: std::optional<Ui::ColorCollectible>();
|
||||
preview->setColorProfileIndex(std::nullopt);
|
||||
preview->setPatternEmojiId(selected->pattern.document->id);
|
||||
const auto emojiStatuses = &session->data().emojiStatuses();
|
||||
const auto id = emojiStatuses->fromUniqueGift(*selected);
|
||||
preview->setLocalCollectible(id.collectible);
|
||||
preview->setLocalEmojiStatusId(
|
||||
session->data().emojiStatuses().fromUniqueGift(*selected));
|
||||
resetWrap->toggle(true, anim::type::normal);
|
||||
}, state->collectible.value(), true, state->selectedGiftId.value());
|
||||
}
|
||||
|
||||
@@ -902,14 +902,10 @@ void TopBar::setPatternEmojiId(std::optional<DocumentId> patternEmojiId) {
|
||||
updateCollectibleStatus();
|
||||
}
|
||||
|
||||
void TopBar::setLocalCollectible(
|
||||
std::shared_ptr<Data::EmojiStatusCollectible> collectible) {
|
||||
_localCollectible = collectible;
|
||||
if (collectible) {
|
||||
_badgeContent = Badge::Content{
|
||||
BadgeType::Premium,
|
||||
EmojiStatusId{ .collectible = collectible },
|
||||
};
|
||||
void TopBar::setLocalEmojiStatusId(EmojiStatusId emojiStatusId) {
|
||||
_localCollectible = emojiStatusId.collectible;
|
||||
if (emojiStatusId) {
|
||||
_badgeContent = Badge::Content{ BadgeType::Premium, emojiStatusId };
|
||||
} else {
|
||||
_badgeContent = BadgeContentForPeer(_peer);
|
||||
}
|
||||
|
||||
@@ -116,8 +116,7 @@ public:
|
||||
void setEnableBackButtonValue(rpl::producer<bool> &&producer);
|
||||
void setColorProfileIndex(std::optional<uint8> index);
|
||||
void setPatternEmojiId(std::optional<DocumentId> patternEmojiId);
|
||||
void setLocalCollectible(
|
||||
std::shared_ptr<Data::EmojiStatusCollectible> collectible);
|
||||
void setLocalEmojiStatusId(EmojiStatusId emojiStatusId);
|
||||
void addTopBarMenuButton(
|
||||
not_null<Window::SessionController*> controller,
|
||||
Wrap wrap,
|
||||
|
||||
Reference in New Issue
Block a user