mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Show only one placeholder for premium reactions.
This commit is contained in:
@@ -19,6 +19,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_document_media.h"
|
||||
#include "lottie/lottie_icon.h"
|
||||
#include "storage/localimageloader.h"
|
||||
#include "ui/image/image_location_factory.h"
|
||||
#include "base/timer_rpl.h"
|
||||
#include "apiwrap.h"
|
||||
#include "styles/style_chat.h"
|
||||
@@ -73,7 +75,6 @@ void Reactions::refresh() {
|
||||
|
||||
const std::vector<Reaction> &Reactions::list(Type type) const {
|
||||
switch (type) {
|
||||
case Type::ActiveNonPremium: return _activeNonPremium;
|
||||
case Type::Active: return _active;
|
||||
case Type::All: return _available;
|
||||
}
|
||||
@@ -302,7 +303,6 @@ void Reactions::updateFromData(const MTPDmessages_availableReactions &data) {
|
||||
_iconsCache.emplace(document, document->createMediaView());
|
||||
}
|
||||
};
|
||||
_activeNonPremium.clear();
|
||||
_active.clear();
|
||||
_available.clear();
|
||||
_active.reserve(list.size());
|
||||
@@ -317,9 +317,6 @@ void Reactions::updateFromData(const MTPDmessages_availableReactions &data) {
|
||||
toCache(parsed->selectAnimation);
|
||||
toCache(parsed->centerIcon);
|
||||
toCache(parsed->aroundAnimation);
|
||||
if (!parsed->premium) {
|
||||
_activeNonPremium.push_back(*parsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -339,6 +336,7 @@ std::optional<Reaction> Reactions::parse(const MTPAvailableReaction &entry) {
|
||||
}
|
||||
const auto selectAnimation = _owner->processDocument(
|
||||
data.vselect_animation());
|
||||
static auto test = 0; AssertIsDebug();
|
||||
return known
|
||||
? std::make_optional(Reaction{
|
||||
.emoji = emoji,
|
||||
@@ -359,7 +357,7 @@ std::optional<Reaction> Reactions::parse(const MTPAvailableReaction &entry) {
|
||||
*data.varound_animation()).get()
|
||||
: nullptr),
|
||||
.active = !data.is_inactive(),
|
||||
.premium = data.is_premium(),
|
||||
.premium = (data.is_premium() || ((++test) % 2)),
|
||||
})
|
||||
: std::nullopt;
|
||||
});
|
||||
|
@@ -40,7 +40,6 @@ public:
|
||||
void refresh();
|
||||
|
||||
enum class Type {
|
||||
ActiveNonPremium,
|
||||
Active,
|
||||
All,
|
||||
};
|
||||
@@ -103,7 +102,6 @@ private:
|
||||
|
||||
const not_null<Session*> _owner;
|
||||
|
||||
std::vector<Reaction> _activeNonPremium;
|
||||
std::vector<Reaction> _active;
|
||||
std::vector<Reaction> _available;
|
||||
QString _favorite;
|
||||
|
@@ -323,6 +323,15 @@ rpl::producer<bool> CanManageGroupCallValue(not_null<PeerData*> peer) {
|
||||
return rpl::single(false);
|
||||
}
|
||||
|
||||
rpl::producer<bool> AmPremiumValue(not_null<Main::Session*> session) {
|
||||
return session->user()->flagsValue(
|
||||
) | rpl::filter([=](UserData::Flags::Change change) {
|
||||
return (change.diff & UserDataFlag::Premium);
|
||||
}) | rpl::map([=] {
|
||||
return session->user()->isPremium();
|
||||
});
|
||||
}
|
||||
|
||||
TimeId SortByOnlineValue(not_null<UserData*> user, TimeId now) {
|
||||
if (user->isServiceUser() || user->isBot()) {
|
||||
return -1;
|
||||
|
@@ -104,12 +104,18 @@ inline auto PeerFullFlagValue(
|
||||
[[nodiscard]] rpl::producer<bool> CanWriteValue(ChatData *chat);
|
||||
[[nodiscard]] rpl::producer<bool> CanWriteValue(ChannelData *channel);
|
||||
[[nodiscard]] rpl::producer<bool> CanWriteValue(not_null<PeerData*> peer);
|
||||
[[nodiscard]] rpl::producer<bool> CanPinMessagesValue(not_null<PeerData*> peer);
|
||||
[[nodiscard]] rpl::producer<bool> CanManageGroupCallValue(not_null<PeerData*> peer);
|
||||
[[nodiscard]] rpl::producer<bool> CanPinMessagesValue(
|
||||
not_null<PeerData*> peer);
|
||||
[[nodiscard]] rpl::producer<bool> CanManageGroupCallValue(
|
||||
not_null<PeerData*> peer);
|
||||
[[nodiscard]] rpl::producer<bool> AmPremiumValue(
|
||||
not_null<Main::Session*> session);
|
||||
|
||||
[[nodiscard]] TimeId SortByOnlineValue(not_null<UserData*> user, TimeId now);
|
||||
[[nodiscard]] crl::time OnlineChangeTimeout(TimeId online, TimeId now);
|
||||
[[nodiscard]] crl::time OnlineChangeTimeout(not_null<UserData*> user, TimeId now);
|
||||
[[nodiscard]] crl::time OnlineChangeTimeout(
|
||||
not_null<UserData*> user,
|
||||
TimeId now);
|
||||
[[nodiscard]] QString OnlineText(TimeId online, TimeId now);
|
||||
[[nodiscard]] QString OnlineText(not_null<UserData*> user, TimeId now);
|
||||
[[nodiscard]] QString OnlineTextFull(not_null<UserData*> user, TimeId now);
|
||||
|
Reference in New Issue
Block a user