diff --git a/Telegram/SourceFiles/boxes/reactions_settings_box.cpp b/Telegram/SourceFiles/boxes/reactions_settings_box.cpp index b580c3f97..30c37795d 100644 --- a/Telegram/SourceFiles/boxes/reactions_settings_box.cpp +++ b/Telegram/SourceFiles/boxes/reactions_settings_box.cpp @@ -520,11 +520,6 @@ void ReactionsSettingsBox( rpl::single(base::duplicate(r.title)), st::settingsButton)); - const auto premium = r.premium; - if (premium && !premiumPossible) { - continue; - } - const auto iconSize = st::settingsReactionSize; const auto left = button->st().iconLeft; auto iconPositionValue = button->sizeValue( @@ -556,12 +551,6 @@ void ReactionsSettingsBox( &button->lifetime()); } button->setClickedCallback([=, id = r.id] { - if (premium && !controller->session().premium()) { - ShowPremiumPreviewBox( - controller, - PremiumPreview::InfiniteReactions); - return; - } checkButton(button); state->selectedId = id; }); diff --git a/Telegram/SourceFiles/chat_helpers/chat_helpers.style b/Telegram/SourceFiles/chat_helpers/chat_helpers.style index c79dc5d46..2df12fbec 100644 --- a/Telegram/SourceFiles/chat_helpers/chat_helpers.style +++ b/Telegram/SourceFiles/chat_helpers/chat_helpers.style @@ -71,7 +71,6 @@ ComposeIcons { menuSpoilerOff: icon; stripBubble: icon; - stripPremiumLocked: icon; stripExpandPanel: icon; stripExpandDropdown: icon; } @@ -609,10 +608,6 @@ defaultComposeIcons: ComposeIcons { { "chat/reactions_bubble_shadow", windowShadowFg }, { "chat/reactions_bubble", windowBg }, }; - stripPremiumLocked: icon{ - { "chat/reactions_premium_bg", historyPeerArchiveUserpicBg }, - { "chat/reactions_premium_star", historyPeerUserpicFg }, - }; stripExpandPanel: icon{ { "chat/reactions_round_big", windowBgRipple }, { "chat/reactions_expand_panel", windowSubTextFg }, diff --git a/Telegram/SourceFiles/data/data_message_reactions.cpp b/Telegram/SourceFiles/data/data_message_reactions.cpp index e5a521780..0519263b3 100644 --- a/Telegram/SourceFiles/data/data_message_reactions.cpp +++ b/Telegram/SourceFiles/data/data_message_reactions.cpp @@ -209,13 +209,6 @@ PossibleItemReactionsRef LookupPossibleReactions( } else if (id.custom() && allowed.type == AllowedReactionsType::Default) { return false; - } else if (reaction.premium - && !session->premium() - && !ranges::contains(all, id, &MessageReaction::id)) { - if (premiumPossible) { - result.morePremiumAvailable = true; - } - return false; } return true; }); @@ -248,7 +241,6 @@ PossibleItemReactions::PossibleItemReactions( : recent(other.recent | ranges::views::transform([](const auto &value) { return *value; }) | ranges::to_vector) -, morePremiumAvailable(other.morePremiumAvailable) , customAllowed(other.customAllowed) , tags(other.tags){ } @@ -1139,7 +1131,6 @@ std::optional Reactions::parse(const MTPAvailableReaction &entry) { *data.varound_animation()).get() : nullptr), .active = !data.is_inactive(), - .premium = data.is_premium(), }) : std::nullopt; }); diff --git a/Telegram/SourceFiles/data/data_message_reactions.h b/Telegram/SourceFiles/data/data_message_reactions.h index 5e56e1c05..9d67e2e2c 100644 --- a/Telegram/SourceFiles/data/data_message_reactions.h +++ b/Telegram/SourceFiles/data/data_message_reactions.h @@ -37,12 +37,10 @@ struct Reaction { DocumentData *aroundAnimation = nullptr; int count = 0; bool active = false; - bool premium = false; }; struct PossibleItemReactionsRef { std::vector> recent; - bool morePremiumAvailable = false; bool customAllowed = false; bool tags = false; }; @@ -52,7 +50,6 @@ struct PossibleItemReactions { explicit PossibleItemReactions(const PossibleItemReactionsRef &other); std::vector recent; - bool morePremiumAvailable = false; bool customAllowed = false; bool tags = false; }; diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index a50bce0ee..f7c684a38 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -386,14 +386,6 @@ HistoryInner::HistoryInner( reactionChosen(reaction); }, lifetime()); - _reactionsManager->premiumPromoChosen( - ) | rpl::start_with_next([=](FullMsgId context) { - _reactionsManager->updateButton({}); - ShowPremiumPreviewBox( - _controller, - PremiumPreview::InfiniteReactions); - }, lifetime()); - session().data().peerDecorationsUpdated( ) | rpl::start_with_next([=] { update(); @@ -2644,9 +2636,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { desiredPosition, reactItem, [=](ChosenReaction reaction) { reactionChosen(reaction); }, - [=](FullMsgId context) { ShowPremiumPreviewBox( - controller, - PremiumPreview::InfiniteReactions); }, + TextWithEntities(), _controller->cachedReactionIconFactory().createMethod()) : AttachSelectorResult::Skipped; if (attached == AttachSelectorResult::Failed) { diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp index 6dcc3497f..82044ad63 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp @@ -398,14 +398,6 @@ ListWidget::ListWidget( reactionChosen(reaction); }, lifetime()); - _reactionsManager->premiumPromoChosen( - ) | rpl::start_with_next([=] { - _reactionsManager->updateButton({}); - ShowPremiumPreviewBox( - _controller, - PremiumPreview::InfiniteReactions); - }, lifetime()); - Reactions::SetupManagerList( _reactionsManager.get(), _reactionsItem.value()); @@ -2641,9 +2633,7 @@ void ListWidget::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { desiredPosition, reactItem, [=](ChosenReaction reaction) { reactionChosen(reaction); }, - [=](FullMsgId context) { ShowPremiumPreviewBox( - _controller, - PremiumPreview::InfiniteReactions); }, + TextWithEntities(), _controller->cachedReactionIconFactory().createMethod()) : AttachSelectorResult::Skipped; if (attached == AttachSelectorResult::Failed) { diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_button.cpp b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_button.cpp index 171ad9d03..a0372f91a 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_button.cpp +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_button.cpp @@ -448,8 +448,6 @@ void Manager::applyList(const Data::PossibleItemReactionsRef &reactions) { reactions.recent, (/*reactions.customAllowed ? Button::Expand - : reactions.morePremiumAvailable - ? Button::Premium : */Button::None)); _tagsStrip = reactions.tags; } @@ -519,14 +517,7 @@ ClickHandlerPtr Manager::computeButtonLink(QPoint position) const { int(_strip.count() - 1)); _strip.setSelected(index); const auto selected = _strip.selected(); - if (selected == Strip::AddedButton::Premium) { - if (!_premiumPromoLink) { - _premiumPromoLink = std::make_shared([=] { - _premiumPromoChosen.fire_copy(_buttonContext); - }); - } - return _premiumPromoLink; - } else if (selected == Strip::AddedButton::Expand) { + if (selected == Strip::AddedButton::Expand) { if (!_expandLink) { _expandLink = std::make_shared([=] { _expandChosen.fire_copy(_buttonContext); diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_button.h b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_button.h index eb9c7fc5d..495f33847 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_button.h +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_button.h @@ -155,9 +155,6 @@ public: [[nodiscard]] rpl::producer chosen() const { return _chosen.events(); } - [[nodiscard]] rpl::producer premiumPromoChosen() const { - return _premiumPromoChosen.events(); - } [[nodiscard]] rpl::producer expandChosen() const { return _expandChosen.events(); } @@ -227,10 +224,8 @@ private: QColor _gradient; rpl::event_stream _chosen; - rpl::event_stream _premiumPromoChosen; rpl::event_stream _expandChosen; mutable base::flat_map _links; - mutable ClickHandlerPtr _premiumPromoLink; mutable ClickHandlerPtr _expandLink; rpl::variable _uniqueLimit = 0; diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp index e7b62bf3c..172803a44 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp @@ -278,8 +278,7 @@ int Selector::recentCount() const { } int Selector::countSkipLeft() const { - const auto addedToMax = _reactions.customAllowed - || _reactions.morePremiumAvailable; + const auto addedToMax = _reactions.customAllowed; const auto max = recentCount() + (addedToMax ? 1 : 0); return std::max( (st::reactStripMinWidth - (max * _size)) / 2, @@ -287,8 +286,7 @@ int Selector::countSkipLeft() const { } int Selector::countWidth(int desiredWidth, int maxWidth) { - const auto addedToMax = _reactions.customAllowed - || _reactions.morePremiumAvailable; + const auto addedToMax = _reactions.customAllowed; const auto max = recentCount() + (addedToMax ? 1 : 0); const auto desiredColumns = std::max( (desiredWidth - 2 * _skipx + _size - 1) / _size, @@ -298,13 +296,9 @@ int Selector::countWidth(int desiredWidth, int maxWidth) { (maxWidth - 2 * _skipx) / _size); _columns = _strip ? std::min(possibleColumns, max) : kDefaultColumns; _small = (possibleColumns - _columns > 1); - _recentRows = (recentCount() - + (_reactions.morePremiumAvailable ? 1 : 0) - + _columns - 1) / _columns; + _recentRows = (recentCount() + _columns - 1) / _columns; const auto added = (_columns < max || _reactions.customAllowed) ? Strip::AddedButton::Expand - : _reactions.morePremiumAvailable - ? Strip::AddedButton::Premium : Strip::AddedButton::None; if (_strip) { const auto &real = _reactions.recent; @@ -731,9 +725,7 @@ void Selector::mouseReleaseEvent(QMouseEvent *e) { } _pressed = -1; const auto selected = _strip->selected(); - if (selected == Strip::AddedButton::Premium) { - _premiumPromoChosen.fire({}); - } else if (selected == Strip::AddedButton::Expand) { + if (selected == Strip::AddedButton::Expand) { expand(); } else if (const auto id = std::get_if(&selected)) { if (!id->empty()) { @@ -993,6 +985,7 @@ bool AdjustMenuGeometryForSelector( return menu->prepareGeometryFor(desiredPosition); } +#if 0 // not ready AttachSelectorResult MakeJustSelectorMenu( not_null menu, not_null controller, @@ -1062,6 +1055,7 @@ AttachSelectorResult MakeJustSelectorMenu( return AttachSelectorResult::Attached; } +#endif AttachSelectorResult AttachSelectorToMenu( not_null menu, @@ -1069,7 +1063,7 @@ AttachSelectorResult AttachSelectorToMenu( QPoint desiredPosition, not_null item, Fn chosen, - Fn showPremiumPromo, + TextWithEntities description, IconFactory iconFactory) { const auto result = AttachSelectorToMenu( menu, @@ -1090,11 +1084,6 @@ AttachSelectorResult AttachSelectorToMenu( chosen(std::move(reaction)); }, selector->lifetime()); - selector->premiumPromoChosen() | rpl::start_with_next([=] { - menu->hideMenu(); - showPremiumPromo(itemId); - }, selector->lifetime()); - const auto weak = base::make_weak(controller); controller->enableGifPauseReason( Window::GifPauseReason::MediaPreview); @@ -1116,7 +1105,7 @@ auto AttachSelectorToMenu( const Data::PossibleItemReactionsRef &reactions, IconFactory iconFactory) -> base::expected, AttachSelectorResult> { - if (reactions.recent.empty() && !reactions.morePremiumAvailable) { + if (reactions.recent.empty()) { return base::make_unexpected(AttachSelectorResult::Skipped); } const auto withSearch = reactions.customAllowed; diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.h b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.h index 201a6a38c..b81ea4bca 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.h +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.h @@ -106,9 +106,6 @@ public: [[nodiscard]] rpl::producer chosen() const { return _chosen.events(); } - [[nodiscard]] rpl::producer<> premiumPromoChosen() const { - return _premiumPromoChosen.events(); - } [[nodiscard]] rpl::producer<> willExpand() const { return _willExpand.events(); } @@ -184,7 +181,6 @@ private: std::unique_ptr _strip; rpl::event_stream _chosen; - rpl::event_stream<> _premiumPromoChosen; rpl::event_stream<> _willExpand; rpl::event_stream<> _escapes; @@ -231,6 +227,7 @@ enum class AttachSelectorResult { Attached, }; +#if 0 // not ready AttachSelectorResult MakeJustSelectorMenu( not_null menu, not_null controller, @@ -238,6 +235,7 @@ AttachSelectorResult MakeJustSelectorMenu( ChatHelpers::EmojiListMode mode, std::vector recent, Fn chosen); +#endif AttachSelectorResult AttachSelectorToMenu( not_null menu, @@ -245,7 +243,7 @@ AttachSelectorResult AttachSelectorToMenu( QPoint desiredPosition, not_null item, Fn chosen, - Fn showPremiumPromo, + TextWithEntities description, IconFactory iconFactory); [[nodiscard]] auto AttachSelectorToMenu( diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_strip.cpp b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_strip.cpp index f9c27b15c..7f36f6630 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_strip.cpp +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_strip.cpp @@ -169,9 +169,7 @@ void Strip::paintOne( QPoint position, QRectF target, bool allowAppearStart) { - if (icon.added == AddedButton::Premium) { - paintPremiumIcon(p, position, target); - } else if (icon.added == AddedButton::Expand) { + if (icon.added == AddedButton::Expand) { paintExpandIcon(p, position, target); } else { const auto paintFrame = [&](not_null animation) { @@ -248,30 +246,6 @@ int Strip::fillChosenIconGetIndex(ChosenReaction &chosen) const { 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( QPainter &p, QPoint position, diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_strip.h b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_strip.h index e8a98fd49..f11ea7253 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_strip.h +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_strip.h @@ -58,7 +58,6 @@ public: enum class AddedButton : uchar { None, Expand, - Premium, }; void applyList( const std::vector> &list, @@ -110,7 +109,6 @@ private: }; void clearStateForHidden(ReactionIcons &icon); - void paintPremiumIcon(QPainter &p, QPoint position, QRectF target) const; void paintExpandIcon(QPainter &p, QPoint position, QRectF target) const; void clearStateForSelectFinished(ReactionIcons &icon); diff --git a/Telegram/SourceFiles/media/stories/media_stories_reactions.cpp b/Telegram/SourceFiles/media/stories/media_stories_reactions.cpp index fd4a0ea8a..9e1be003c 100644 --- a/Telegram/SourceFiles/media/stories/media_stories_reactions.cpp +++ b/Telegram/SourceFiles/media/stories/media_stories_reactions.cpp @@ -646,7 +646,7 @@ void Reactions::Panel::attachToReactionButton( void Reactions::Panel::create() { auto reactions = LookupPossibleReactions( &_controller->uiShow()->session()); - if (reactions.recent.empty() && !reactions.morePremiumAvailable) { + if (reactions.recent.empty()) { return; } _parent = std::make_unique(_controller->wrap().get()); @@ -685,13 +685,6 @@ void Reactions::Panel::create() { hide(mode); }, _selector->lifetime()); - _selector->premiumPromoChosen() | rpl::start_with_next([=] { - hide(mode); - ShowPremiumPreviewBox( - _controller->uiShow(), - PremiumPreview::InfiniteReactions); - }, _selector->lifetime()); - const auto desiredWidth = st::storiesReactionsWidth; const auto maxWidth = desiredWidth * 2; const auto width = _selector->countWidth(desiredWidth, maxWidth); diff --git a/Telegram/SourceFiles/media/view/media_view.style b/Telegram/SourceFiles/media/view/media_view.style index 1d33b03b8..b856f3cac 100644 --- a/Telegram/SourceFiles/media/view/media_view.style +++ b/Telegram/SourceFiles/media/view/media_view.style @@ -638,10 +638,6 @@ storiesEmojiPan: EmojiPan(defaultEmojiPan) { { "chat/reactions_bubble_shadow", windowShadowFg }, { "chat/reactions_bubble", storiesComposeBg }, }; - stripPremiumLocked: icon{ - { "chat/reactions_premium_bg", storiesComposeBgRipple }, - { "chat/reactions_premium_star", storiesComposeGrayIcon }, - }; stripExpandPanel: icon{ { "chat/reactions_round_big", storiesComposeBgRipple }, { "chat/reactions_expand_panel", storiesComposeGrayIcon }, diff --git a/Telegram/SourceFiles/window/section_widget.cpp b/Telegram/SourceFiles/window/section_widget.cpp index 8da39b10e..f9b2a5a39 100644 --- a/Telegram/SourceFiles/window/section_widget.cpp +++ b/Telegram/SourceFiles/window/section_widget.cpp @@ -536,15 +536,8 @@ bool ShowReactPremiumError( if (i != end(list)) { return false; } - } else { - 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; - } - } + } else if (!id.custom()) { + return false; } ShowPremiumPreviewBox(controller, PremiumPreview::InfiniteReactions); return true;