mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-06 11:52:58 +00:00
Merge tag 'v7.0.4' into dev
This commit is contained in:
@@ -24,13 +24,19 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_peer_values.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
#include "settings/sections/settings_premium.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "main/main_session.h"
|
||||
#include "menu/menu_send.h"
|
||||
#include "settings/sections/settings_premium.h"
|
||||
#include "ui/text/text_custom_emoji.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "window/section_memento.h"
|
||||
#include "window/window_slide_animation.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "window/themes/window_theme.h"
|
||||
|
||||
#include "styles/style_polls.h"
|
||||
|
||||
#include <rpl/range.h>
|
||||
|
||||
// AyuGram includes
|
||||
@@ -40,6 +46,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
namespace Window {
|
||||
namespace {
|
||||
|
||||
constexpr auto kReactionRestrictionToastDuration = 5 * crl::time(1000);
|
||||
|
||||
[[nodiscard]] rpl::producer<QString> PeerThemeTokenValue(
|
||||
not_null<PeerData*> peer) {
|
||||
return peer->session().changes().peerFlagsValue(
|
||||
@@ -245,6 +253,14 @@ Main::Session &AbstractSectionWidget::session() const {
|
||||
return _controller->session();
|
||||
}
|
||||
|
||||
SendMenu::Details AbstractSectionWidget::sendMenuDetails() const {
|
||||
return {};
|
||||
}
|
||||
|
||||
bool AbstractSectionWidget::processChosenSticker(ChatHelpers::FileChosen &&) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SectionWidget::SectionWidget(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController*> controller,
|
||||
@@ -334,7 +350,7 @@ void SectionWidget::PaintBackground(
|
||||
const auto fill = QSize(widget->width(), fillHeight);
|
||||
const auto &state = theme->backgroundState(fill);
|
||||
const auto make = [&] {
|
||||
return std::make_unique<Ui::Text::LimitedLoopsEmoji>(
|
||||
return MakeWrappedEmoji<Ui::Text::LimitedLoopsEmoji>(
|
||||
controller->session().data().customEmojiManager().create(
|
||||
id,
|
||||
crl::guard(widget, [=] { widget->update(); }),
|
||||
@@ -599,6 +615,15 @@ bool ShowSendPremiumError(
|
||||
return true;
|
||||
}
|
||||
|
||||
void ShowReactRestrictionToast(not_null<SessionController*> controller) {
|
||||
controller->showToast({
|
||||
.text = { tr::lng_restricted_send_reactions_click(tr::now) },
|
||||
.iconLottie = u"ban"_q,
|
||||
.iconLottieSize = st::pollToastIconSize,
|
||||
.duration = kReactionRestrictionToastDuration,
|
||||
});
|
||||
}
|
||||
|
||||
bool ShowReactPremiumError(
|
||||
not_null<SessionController*> controller,
|
||||
not_null<HistoryItem*> item,
|
||||
@@ -609,8 +634,14 @@ bool ShowReactPremiumError(
|
||||
}
|
||||
ShowPremiumPreviewBox(controller, PremiumFeature::TagsForMessages);
|
||||
return true;
|
||||
} else if (!item->canReact()) {
|
||||
ShowReactRestrictionToast(controller);
|
||||
return true;
|
||||
} else if (controller->session().premium()
|
||||
|| ranges::contains(item->chosenReactions(), id)
|
||||
|| ranges::contains(
|
||||
item->reactions(),
|
||||
id,
|
||||
&Data::MessageReaction::id)
|
||||
|| item->history()->peer->isBroadcast()) {
|
||||
return false;
|
||||
} else if (!id.custom()) {
|
||||
|
||||
Reference in New Issue
Block a user