mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Remove legacy premium reactions code.
This commit is contained in:
parent
6f57302562
commit
87df90227e
15 changed files with 18 additions and 139 deletions
|
@ -520,11 +520,6 @@ void ReactionsSettingsBox(
|
||||||
rpl::single<QString>(base::duplicate(r.title)),
|
rpl::single<QString>(base::duplicate(r.title)),
|
||||||
st::settingsButton));
|
st::settingsButton));
|
||||||
|
|
||||||
const auto premium = r.premium;
|
|
||||||
if (premium && !premiumPossible) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto iconSize = st::settingsReactionSize;
|
const auto iconSize = st::settingsReactionSize;
|
||||||
const auto left = button->st().iconLeft;
|
const auto left = button->st().iconLeft;
|
||||||
auto iconPositionValue = button->sizeValue(
|
auto iconPositionValue = button->sizeValue(
|
||||||
|
@ -556,12 +551,6 @@ void ReactionsSettingsBox(
|
||||||
&button->lifetime());
|
&button->lifetime());
|
||||||
}
|
}
|
||||||
button->setClickedCallback([=, id = r.id] {
|
button->setClickedCallback([=, id = r.id] {
|
||||||
if (premium && !controller->session().premium()) {
|
|
||||||
ShowPremiumPreviewBox(
|
|
||||||
controller,
|
|
||||||
PremiumPreview::InfiniteReactions);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
checkButton(button);
|
checkButton(button);
|
||||||
state->selectedId = id;
|
state->selectedId = id;
|
||||||
});
|
});
|
||||||
|
|
|
@ -71,7 +71,6 @@ ComposeIcons {
|
||||||
menuSpoilerOff: icon;
|
menuSpoilerOff: icon;
|
||||||
|
|
||||||
stripBubble: icon;
|
stripBubble: icon;
|
||||||
stripPremiumLocked: icon;
|
|
||||||
stripExpandPanel: icon;
|
stripExpandPanel: icon;
|
||||||
stripExpandDropdown: icon;
|
stripExpandDropdown: icon;
|
||||||
}
|
}
|
||||||
|
@ -609,10 +608,6 @@ defaultComposeIcons: ComposeIcons {
|
||||||
{ "chat/reactions_bubble_shadow", windowShadowFg },
|
{ "chat/reactions_bubble_shadow", windowShadowFg },
|
||||||
{ "chat/reactions_bubble", windowBg },
|
{ "chat/reactions_bubble", windowBg },
|
||||||
};
|
};
|
||||||
stripPremiumLocked: icon{
|
|
||||||
{ "chat/reactions_premium_bg", historyPeerArchiveUserpicBg },
|
|
||||||
{ "chat/reactions_premium_star", historyPeerUserpicFg },
|
|
||||||
};
|
|
||||||
stripExpandPanel: icon{
|
stripExpandPanel: icon{
|
||||||
{ "chat/reactions_round_big", windowBgRipple },
|
{ "chat/reactions_round_big", windowBgRipple },
|
||||||
{ "chat/reactions_expand_panel", windowSubTextFg },
|
{ "chat/reactions_expand_panel", windowSubTextFg },
|
||||||
|
|
|
@ -209,13 +209,6 @@ PossibleItemReactionsRef LookupPossibleReactions(
|
||||||
} else if (id.custom()
|
} else if (id.custom()
|
||||||
&& allowed.type == AllowedReactionsType::Default) {
|
&& allowed.type == AllowedReactionsType::Default) {
|
||||||
return false;
|
return false;
|
||||||
} else if (reaction.premium
|
|
||||||
&& !session->premium()
|
|
||||||
&& !ranges::contains(all, id, &MessageReaction::id)) {
|
|
||||||
if (premiumPossible) {
|
|
||||||
result.morePremiumAvailable = true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@ -248,7 +241,6 @@ PossibleItemReactions::PossibleItemReactions(
|
||||||
: recent(other.recent | ranges::views::transform([](const auto &value) {
|
: recent(other.recent | ranges::views::transform([](const auto &value) {
|
||||||
return *value;
|
return *value;
|
||||||
}) | ranges::to_vector)
|
}) | ranges::to_vector)
|
||||||
, morePremiumAvailable(other.morePremiumAvailable)
|
|
||||||
, customAllowed(other.customAllowed)
|
, customAllowed(other.customAllowed)
|
||||||
, tags(other.tags){
|
, tags(other.tags){
|
||||||
}
|
}
|
||||||
|
@ -1139,7 +1131,6 @@ std::optional<Reaction> Reactions::parse(const MTPAvailableReaction &entry) {
|
||||||
*data.varound_animation()).get()
|
*data.varound_animation()).get()
|
||||||
: nullptr),
|
: nullptr),
|
||||||
.active = !data.is_inactive(),
|
.active = !data.is_inactive(),
|
||||||
.premium = data.is_premium(),
|
|
||||||
})
|
})
|
||||||
: std::nullopt;
|
: std::nullopt;
|
||||||
});
|
});
|
||||||
|
|
|
@ -37,12 +37,10 @@ struct Reaction {
|
||||||
DocumentData *aroundAnimation = nullptr;
|
DocumentData *aroundAnimation = nullptr;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
bool active = false;
|
bool active = false;
|
||||||
bool premium = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PossibleItemReactionsRef {
|
struct PossibleItemReactionsRef {
|
||||||
std::vector<not_null<const Reaction*>> recent;
|
std::vector<not_null<const Reaction*>> recent;
|
||||||
bool morePremiumAvailable = false;
|
|
||||||
bool customAllowed = false;
|
bool customAllowed = false;
|
||||||
bool tags = false;
|
bool tags = false;
|
||||||
};
|
};
|
||||||
|
@ -52,7 +50,6 @@ struct PossibleItemReactions {
|
||||||
explicit PossibleItemReactions(const PossibleItemReactionsRef &other);
|
explicit PossibleItemReactions(const PossibleItemReactionsRef &other);
|
||||||
|
|
||||||
std::vector<Reaction> recent;
|
std::vector<Reaction> recent;
|
||||||
bool morePremiumAvailable = false;
|
|
||||||
bool customAllowed = false;
|
bool customAllowed = false;
|
||||||
bool tags = false;
|
bool tags = false;
|
||||||
};
|
};
|
||||||
|
|
|
@ -386,14 +386,6 @@ HistoryInner::HistoryInner(
|
||||||
reactionChosen(reaction);
|
reactionChosen(reaction);
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
_reactionsManager->premiumPromoChosen(
|
|
||||||
) | rpl::start_with_next([=](FullMsgId context) {
|
|
||||||
_reactionsManager->updateButton({});
|
|
||||||
ShowPremiumPreviewBox(
|
|
||||||
_controller,
|
|
||||||
PremiumPreview::InfiniteReactions);
|
|
||||||
}, lifetime());
|
|
||||||
|
|
||||||
session().data().peerDecorationsUpdated(
|
session().data().peerDecorationsUpdated(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
update();
|
update();
|
||||||
|
@ -2644,9 +2636,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||||
desiredPosition,
|
desiredPosition,
|
||||||
reactItem,
|
reactItem,
|
||||||
[=](ChosenReaction reaction) { reactionChosen(reaction); },
|
[=](ChosenReaction reaction) { reactionChosen(reaction); },
|
||||||
[=](FullMsgId context) { ShowPremiumPreviewBox(
|
TextWithEntities(),
|
||||||
controller,
|
|
||||||
PremiumPreview::InfiniteReactions); },
|
|
||||||
_controller->cachedReactionIconFactory().createMethod())
|
_controller->cachedReactionIconFactory().createMethod())
|
||||||
: AttachSelectorResult::Skipped;
|
: AttachSelectorResult::Skipped;
|
||||||
if (attached == AttachSelectorResult::Failed) {
|
if (attached == AttachSelectorResult::Failed) {
|
||||||
|
|
|
@ -398,14 +398,6 @@ ListWidget::ListWidget(
|
||||||
reactionChosen(reaction);
|
reactionChosen(reaction);
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
_reactionsManager->premiumPromoChosen(
|
|
||||||
) | rpl::start_with_next([=] {
|
|
||||||
_reactionsManager->updateButton({});
|
|
||||||
ShowPremiumPreviewBox(
|
|
||||||
_controller,
|
|
||||||
PremiumPreview::InfiniteReactions);
|
|
||||||
}, lifetime());
|
|
||||||
|
|
||||||
Reactions::SetupManagerList(
|
Reactions::SetupManagerList(
|
||||||
_reactionsManager.get(),
|
_reactionsManager.get(),
|
||||||
_reactionsItem.value());
|
_reactionsItem.value());
|
||||||
|
@ -2641,9 +2633,7 @@ void ListWidget::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||||
desiredPosition,
|
desiredPosition,
|
||||||
reactItem,
|
reactItem,
|
||||||
[=](ChosenReaction reaction) { reactionChosen(reaction); },
|
[=](ChosenReaction reaction) { reactionChosen(reaction); },
|
||||||
[=](FullMsgId context) { ShowPremiumPreviewBox(
|
TextWithEntities(),
|
||||||
_controller,
|
|
||||||
PremiumPreview::InfiniteReactions); },
|
|
||||||
_controller->cachedReactionIconFactory().createMethod())
|
_controller->cachedReactionIconFactory().createMethod())
|
||||||
: AttachSelectorResult::Skipped;
|
: AttachSelectorResult::Skipped;
|
||||||
if (attached == AttachSelectorResult::Failed) {
|
if (attached == AttachSelectorResult::Failed) {
|
||||||
|
|
|
@ -448,8 +448,6 @@ void Manager::applyList(const Data::PossibleItemReactionsRef &reactions) {
|
||||||
reactions.recent,
|
reactions.recent,
|
||||||
(/*reactions.customAllowed
|
(/*reactions.customAllowed
|
||||||
? Button::Expand
|
? Button::Expand
|
||||||
: reactions.morePremiumAvailable
|
|
||||||
? Button::Premium
|
|
||||||
: */Button::None));
|
: */Button::None));
|
||||||
_tagsStrip = reactions.tags;
|
_tagsStrip = reactions.tags;
|
||||||
}
|
}
|
||||||
|
@ -519,14 +517,7 @@ ClickHandlerPtr Manager::computeButtonLink(QPoint position) const {
|
||||||
int(_strip.count() - 1));
|
int(_strip.count() - 1));
|
||||||
_strip.setSelected(index);
|
_strip.setSelected(index);
|
||||||
const auto selected = _strip.selected();
|
const auto selected = _strip.selected();
|
||||||
if (selected == Strip::AddedButton::Premium) {
|
if (selected == Strip::AddedButton::Expand) {
|
||||||
if (!_premiumPromoLink) {
|
|
||||||
_premiumPromoLink = std::make_shared<LambdaClickHandler>([=] {
|
|
||||||
_premiumPromoChosen.fire_copy(_buttonContext);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return _premiumPromoLink;
|
|
||||||
} else if (selected == Strip::AddedButton::Expand) {
|
|
||||||
if (!_expandLink) {
|
if (!_expandLink) {
|
||||||
_expandLink = std::make_shared<LambdaClickHandler>([=] {
|
_expandLink = std::make_shared<LambdaClickHandler>([=] {
|
||||||
_expandChosen.fire_copy(_buttonContext);
|
_expandChosen.fire_copy(_buttonContext);
|
||||||
|
|
|
@ -155,9 +155,6 @@ public:
|
||||||
[[nodiscard]] rpl::producer<ChosenReaction> chosen() const {
|
[[nodiscard]] rpl::producer<ChosenReaction> chosen() const {
|
||||||
return _chosen.events();
|
return _chosen.events();
|
||||||
}
|
}
|
||||||
[[nodiscard]] rpl::producer<FullMsgId> premiumPromoChosen() const {
|
|
||||||
return _premiumPromoChosen.events();
|
|
||||||
}
|
|
||||||
[[nodiscard]] rpl::producer<FullMsgId> expandChosen() const {
|
[[nodiscard]] rpl::producer<FullMsgId> expandChosen() const {
|
||||||
return _expandChosen.events();
|
return _expandChosen.events();
|
||||||
}
|
}
|
||||||
|
@ -227,10 +224,8 @@ private:
|
||||||
QColor _gradient;
|
QColor _gradient;
|
||||||
|
|
||||||
rpl::event_stream<ChosenReaction> _chosen;
|
rpl::event_stream<ChosenReaction> _chosen;
|
||||||
rpl::event_stream<FullMsgId> _premiumPromoChosen;
|
|
||||||
rpl::event_stream<FullMsgId> _expandChosen;
|
rpl::event_stream<FullMsgId> _expandChosen;
|
||||||
mutable base::flat_map<ReactionId, ClickHandlerPtr> _links;
|
mutable base::flat_map<ReactionId, ClickHandlerPtr> _links;
|
||||||
mutable ClickHandlerPtr _premiumPromoLink;
|
|
||||||
mutable ClickHandlerPtr _expandLink;
|
mutable ClickHandlerPtr _expandLink;
|
||||||
|
|
||||||
rpl::variable<int> _uniqueLimit = 0;
|
rpl::variable<int> _uniqueLimit = 0;
|
||||||
|
|
|
@ -278,8 +278,7 @@ int Selector::recentCount() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int Selector::countSkipLeft() const {
|
int Selector::countSkipLeft() const {
|
||||||
const auto addedToMax = _reactions.customAllowed
|
const auto addedToMax = _reactions.customAllowed;
|
||||||
|| _reactions.morePremiumAvailable;
|
|
||||||
const auto max = recentCount() + (addedToMax ? 1 : 0);
|
const auto max = recentCount() + (addedToMax ? 1 : 0);
|
||||||
return std::max(
|
return std::max(
|
||||||
(st::reactStripMinWidth - (max * _size)) / 2,
|
(st::reactStripMinWidth - (max * _size)) / 2,
|
||||||
|
@ -287,8 +286,7 @@ int Selector::countSkipLeft() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int Selector::countWidth(int desiredWidth, int maxWidth) {
|
int Selector::countWidth(int desiredWidth, int maxWidth) {
|
||||||
const auto addedToMax = _reactions.customAllowed
|
const auto addedToMax = _reactions.customAllowed;
|
||||||
|| _reactions.morePremiumAvailable;
|
|
||||||
const auto max = recentCount() + (addedToMax ? 1 : 0);
|
const auto max = recentCount() + (addedToMax ? 1 : 0);
|
||||||
const auto desiredColumns = std::max(
|
const auto desiredColumns = std::max(
|
||||||
(desiredWidth - 2 * _skipx + _size - 1) / _size,
|
(desiredWidth - 2 * _skipx + _size - 1) / _size,
|
||||||
|
@ -298,13 +296,9 @@ int Selector::countWidth(int desiredWidth, int maxWidth) {
|
||||||
(maxWidth - 2 * _skipx) / _size);
|
(maxWidth - 2 * _skipx) / _size);
|
||||||
_columns = _strip ? std::min(possibleColumns, max) : kDefaultColumns;
|
_columns = _strip ? std::min(possibleColumns, max) : kDefaultColumns;
|
||||||
_small = (possibleColumns - _columns > 1);
|
_small = (possibleColumns - _columns > 1);
|
||||||
_recentRows = (recentCount()
|
_recentRows = (recentCount() + _columns - 1) / _columns;
|
||||||
+ (_reactions.morePremiumAvailable ? 1 : 0)
|
|
||||||
+ _columns - 1) / _columns;
|
|
||||||
const auto added = (_columns < max || _reactions.customAllowed)
|
const auto added = (_columns < max || _reactions.customAllowed)
|
||||||
? Strip::AddedButton::Expand
|
? Strip::AddedButton::Expand
|
||||||
: _reactions.morePremiumAvailable
|
|
||||||
? Strip::AddedButton::Premium
|
|
||||||
: Strip::AddedButton::None;
|
: Strip::AddedButton::None;
|
||||||
if (_strip) {
|
if (_strip) {
|
||||||
const auto &real = _reactions.recent;
|
const auto &real = _reactions.recent;
|
||||||
|
@ -731,9 +725,7 @@ void Selector::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
}
|
}
|
||||||
_pressed = -1;
|
_pressed = -1;
|
||||||
const auto selected = _strip->selected();
|
const auto selected = _strip->selected();
|
||||||
if (selected == Strip::AddedButton::Premium) {
|
if (selected == Strip::AddedButton::Expand) {
|
||||||
_premiumPromoChosen.fire({});
|
|
||||||
} else if (selected == Strip::AddedButton::Expand) {
|
|
||||||
expand();
|
expand();
|
||||||
} else if (const auto id = std::get_if<Data::ReactionId>(&selected)) {
|
} else if (const auto id = std::get_if<Data::ReactionId>(&selected)) {
|
||||||
if (!id->empty()) {
|
if (!id->empty()) {
|
||||||
|
@ -993,6 +985,7 @@ bool AdjustMenuGeometryForSelector(
|
||||||
return menu->prepareGeometryFor(desiredPosition);
|
return menu->prepareGeometryFor(desiredPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0 // not ready
|
||||||
AttachSelectorResult MakeJustSelectorMenu(
|
AttachSelectorResult MakeJustSelectorMenu(
|
||||||
not_null<Ui::PopupMenu*> menu,
|
not_null<Ui::PopupMenu*> menu,
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
|
@ -1062,6 +1055,7 @@ AttachSelectorResult MakeJustSelectorMenu(
|
||||||
|
|
||||||
return AttachSelectorResult::Attached;
|
return AttachSelectorResult::Attached;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
AttachSelectorResult AttachSelectorToMenu(
|
AttachSelectorResult AttachSelectorToMenu(
|
||||||
not_null<Ui::PopupMenu*> menu,
|
not_null<Ui::PopupMenu*> menu,
|
||||||
|
@ -1069,7 +1063,7 @@ AttachSelectorResult AttachSelectorToMenu(
|
||||||
QPoint desiredPosition,
|
QPoint desiredPosition,
|
||||||
not_null<HistoryItem*> item,
|
not_null<HistoryItem*> item,
|
||||||
Fn<void(ChosenReaction)> chosen,
|
Fn<void(ChosenReaction)> chosen,
|
||||||
Fn<void(FullMsgId)> showPremiumPromo,
|
TextWithEntities description,
|
||||||
IconFactory iconFactory) {
|
IconFactory iconFactory) {
|
||||||
const auto result = AttachSelectorToMenu(
|
const auto result = AttachSelectorToMenu(
|
||||||
menu,
|
menu,
|
||||||
|
@ -1090,11 +1084,6 @@ AttachSelectorResult AttachSelectorToMenu(
|
||||||
chosen(std::move(reaction));
|
chosen(std::move(reaction));
|
||||||
}, selector->lifetime());
|
}, selector->lifetime());
|
||||||
|
|
||||||
selector->premiumPromoChosen() | rpl::start_with_next([=] {
|
|
||||||
menu->hideMenu();
|
|
||||||
showPremiumPromo(itemId);
|
|
||||||
}, selector->lifetime());
|
|
||||||
|
|
||||||
const auto weak = base::make_weak(controller);
|
const auto weak = base::make_weak(controller);
|
||||||
controller->enableGifPauseReason(
|
controller->enableGifPauseReason(
|
||||||
Window::GifPauseReason::MediaPreview);
|
Window::GifPauseReason::MediaPreview);
|
||||||
|
@ -1116,7 +1105,7 @@ auto AttachSelectorToMenu(
|
||||||
const Data::PossibleItemReactionsRef &reactions,
|
const Data::PossibleItemReactionsRef &reactions,
|
||||||
IconFactory iconFactory)
|
IconFactory iconFactory)
|
||||||
-> base::expected<not_null<Selector*>, AttachSelectorResult> {
|
-> base::expected<not_null<Selector*>, AttachSelectorResult> {
|
||||||
if (reactions.recent.empty() && !reactions.morePremiumAvailable) {
|
if (reactions.recent.empty()) {
|
||||||
return base::make_unexpected(AttachSelectorResult::Skipped);
|
return base::make_unexpected(AttachSelectorResult::Skipped);
|
||||||
}
|
}
|
||||||
const auto withSearch = reactions.customAllowed;
|
const auto withSearch = reactions.customAllowed;
|
||||||
|
|
|
@ -106,9 +106,6 @@ public:
|
||||||
[[nodiscard]] rpl::producer<ChosenReaction> chosen() const {
|
[[nodiscard]] rpl::producer<ChosenReaction> chosen() const {
|
||||||
return _chosen.events();
|
return _chosen.events();
|
||||||
}
|
}
|
||||||
[[nodiscard]] rpl::producer<> premiumPromoChosen() const {
|
|
||||||
return _premiumPromoChosen.events();
|
|
||||||
}
|
|
||||||
[[nodiscard]] rpl::producer<> willExpand() const {
|
[[nodiscard]] rpl::producer<> willExpand() const {
|
||||||
return _willExpand.events();
|
return _willExpand.events();
|
||||||
}
|
}
|
||||||
|
@ -184,7 +181,6 @@ private:
|
||||||
std::unique_ptr<Strip> _strip;
|
std::unique_ptr<Strip> _strip;
|
||||||
|
|
||||||
rpl::event_stream<ChosenReaction> _chosen;
|
rpl::event_stream<ChosenReaction> _chosen;
|
||||||
rpl::event_stream<> _premiumPromoChosen;
|
|
||||||
rpl::event_stream<> _willExpand;
|
rpl::event_stream<> _willExpand;
|
||||||
rpl::event_stream<> _escapes;
|
rpl::event_stream<> _escapes;
|
||||||
|
|
||||||
|
@ -231,6 +227,7 @@ enum class AttachSelectorResult {
|
||||||
Attached,
|
Attached,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0 // not ready
|
||||||
AttachSelectorResult MakeJustSelectorMenu(
|
AttachSelectorResult MakeJustSelectorMenu(
|
||||||
not_null<Ui::PopupMenu*> menu,
|
not_null<Ui::PopupMenu*> menu,
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
|
@ -238,6 +235,7 @@ AttachSelectorResult MakeJustSelectorMenu(
|
||||||
ChatHelpers::EmojiListMode mode,
|
ChatHelpers::EmojiListMode mode,
|
||||||
std::vector<DocumentId> recent,
|
std::vector<DocumentId> recent,
|
||||||
Fn<void(ChosenReaction)> chosen);
|
Fn<void(ChosenReaction)> chosen);
|
||||||
|
#endif
|
||||||
|
|
||||||
AttachSelectorResult AttachSelectorToMenu(
|
AttachSelectorResult AttachSelectorToMenu(
|
||||||
not_null<Ui::PopupMenu*> menu,
|
not_null<Ui::PopupMenu*> menu,
|
||||||
|
@ -245,7 +243,7 @@ AttachSelectorResult AttachSelectorToMenu(
|
||||||
QPoint desiredPosition,
|
QPoint desiredPosition,
|
||||||
not_null<HistoryItem*> item,
|
not_null<HistoryItem*> item,
|
||||||
Fn<void(ChosenReaction)> chosen,
|
Fn<void(ChosenReaction)> chosen,
|
||||||
Fn<void(FullMsgId)> showPremiumPromo,
|
TextWithEntities description,
|
||||||
IconFactory iconFactory);
|
IconFactory iconFactory);
|
||||||
|
|
||||||
[[nodiscard]] auto AttachSelectorToMenu(
|
[[nodiscard]] auto AttachSelectorToMenu(
|
||||||
|
|
|
@ -169,9 +169,7 @@ void Strip::paintOne(
|
||||||
QPoint position,
|
QPoint position,
|
||||||
QRectF target,
|
QRectF target,
|
||||||
bool allowAppearStart) {
|
bool allowAppearStart) {
|
||||||
if (icon.added == AddedButton::Premium) {
|
if (icon.added == AddedButton::Expand) {
|
||||||
paintPremiumIcon(p, position, target);
|
|
||||||
} else if (icon.added == AddedButton::Expand) {
|
|
||||||
paintExpandIcon(p, position, target);
|
paintExpandIcon(p, position, target);
|
||||||
} else {
|
} else {
|
||||||
const auto paintFrame = [&](not_null<Ui::AnimatedIcon*> animation) {
|
const auto paintFrame = [&](not_null<Ui::AnimatedIcon*> animation) {
|
||||||
|
@ -248,30 +246,6 @@ int Strip::fillChosenIconGetIndex(ChosenReaction &chosen) const {
|
||||||
return (i - begin(_icons));
|
return (i - begin(_icons));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Strip::paintPremiumIcon(
|
|
||||||
QPainter &p,
|
|
||||||
QPoint position,
|
|
||||||
QRectF target) const {
|
|
||||||
const auto to = QRect(
|
|
||||||
_inner.x() + (_inner.width() - _finalSize) / 2,
|
|
||||||
_inner.y() + (_inner.height() - _finalSize) / 2,
|
|
||||||
_finalSize,
|
|
||||||
_finalSize
|
|
||||||
).translated(position);
|
|
||||||
const auto scale = target.width() / to.width();
|
|
||||||
if (scale != 1.) {
|
|
||||||
p.save();
|
|
||||||
p.translate(target.center());
|
|
||||||
p.scale(scale, scale);
|
|
||||||
p.translate(-target.center());
|
|
||||||
}
|
|
||||||
auto hq = PainterHighQualityEnabler(p);
|
|
||||||
_st.icons.stripPremiumLocked.paintInCenter(p, to);
|
|
||||||
if (scale != 1.) {
|
|
||||||
p.restore();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Strip::paintExpandIcon(
|
void Strip::paintExpandIcon(
|
||||||
QPainter &p,
|
QPainter &p,
|
||||||
QPoint position,
|
QPoint position,
|
||||||
|
|
|
@ -58,7 +58,6 @@ public:
|
||||||
enum class AddedButton : uchar {
|
enum class AddedButton : uchar {
|
||||||
None,
|
None,
|
||||||
Expand,
|
Expand,
|
||||||
Premium,
|
|
||||||
};
|
};
|
||||||
void applyList(
|
void applyList(
|
||||||
const std::vector<not_null<const Data::Reaction*>> &list,
|
const std::vector<not_null<const Data::Reaction*>> &list,
|
||||||
|
@ -110,7 +109,6 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
void clearStateForHidden(ReactionIcons &icon);
|
void clearStateForHidden(ReactionIcons &icon);
|
||||||
void paintPremiumIcon(QPainter &p, QPoint position, QRectF target) const;
|
|
||||||
void paintExpandIcon(QPainter &p, QPoint position, QRectF target) const;
|
void paintExpandIcon(QPainter &p, QPoint position, QRectF target) const;
|
||||||
void clearStateForSelectFinished(ReactionIcons &icon);
|
void clearStateForSelectFinished(ReactionIcons &icon);
|
||||||
|
|
||||||
|
|
|
@ -646,7 +646,7 @@ void Reactions::Panel::attachToReactionButton(
|
||||||
void Reactions::Panel::create() {
|
void Reactions::Panel::create() {
|
||||||
auto reactions = LookupPossibleReactions(
|
auto reactions = LookupPossibleReactions(
|
||||||
&_controller->uiShow()->session());
|
&_controller->uiShow()->session());
|
||||||
if (reactions.recent.empty() && !reactions.morePremiumAvailable) {
|
if (reactions.recent.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_parent = std::make_unique<Ui::RpWidget>(_controller->wrap().get());
|
_parent = std::make_unique<Ui::RpWidget>(_controller->wrap().get());
|
||||||
|
@ -685,13 +685,6 @@ void Reactions::Panel::create() {
|
||||||
hide(mode);
|
hide(mode);
|
||||||
}, _selector->lifetime());
|
}, _selector->lifetime());
|
||||||
|
|
||||||
_selector->premiumPromoChosen() | rpl::start_with_next([=] {
|
|
||||||
hide(mode);
|
|
||||||
ShowPremiumPreviewBox(
|
|
||||||
_controller->uiShow(),
|
|
||||||
PremiumPreview::InfiniteReactions);
|
|
||||||
}, _selector->lifetime());
|
|
||||||
|
|
||||||
const auto desiredWidth = st::storiesReactionsWidth;
|
const auto desiredWidth = st::storiesReactionsWidth;
|
||||||
const auto maxWidth = desiredWidth * 2;
|
const auto maxWidth = desiredWidth * 2;
|
||||||
const auto width = _selector->countWidth(desiredWidth, maxWidth);
|
const auto width = _selector->countWidth(desiredWidth, maxWidth);
|
||||||
|
|
|
@ -638,10 +638,6 @@ storiesEmojiPan: EmojiPan(defaultEmojiPan) {
|
||||||
{ "chat/reactions_bubble_shadow", windowShadowFg },
|
{ "chat/reactions_bubble_shadow", windowShadowFg },
|
||||||
{ "chat/reactions_bubble", storiesComposeBg },
|
{ "chat/reactions_bubble", storiesComposeBg },
|
||||||
};
|
};
|
||||||
stripPremiumLocked: icon{
|
|
||||||
{ "chat/reactions_premium_bg", storiesComposeBgRipple },
|
|
||||||
{ "chat/reactions_premium_star", storiesComposeGrayIcon },
|
|
||||||
};
|
|
||||||
stripExpandPanel: icon{
|
stripExpandPanel: icon{
|
||||||
{ "chat/reactions_round_big", storiesComposeBgRipple },
|
{ "chat/reactions_round_big", storiesComposeBgRipple },
|
||||||
{ "chat/reactions_expand_panel", storiesComposeGrayIcon },
|
{ "chat/reactions_expand_panel", storiesComposeGrayIcon },
|
||||||
|
|
|
@ -536,16 +536,9 @@ bool ShowReactPremiumError(
|
||||||
if (i != end(list)) {
|
if (i != end(list)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (!id.custom()) {
|
||||||
const auto &list = controller->session().data().reactions().list(
|
|
||||||
Data::Reactions::Type::Active);
|
|
||||||
const auto i = ranges::find(list, id, &Data::Reaction::id);
|
|
||||||
if (i == end(list) || !i->premium) {
|
|
||||||
if (!id.custom()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
ShowPremiumPreviewBox(controller, PremiumPreview::InfiniteReactions);
|
ShowPremiumPreviewBox(controller, PremiumPreview::InfiniteReactions);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue