Replaced title static reaction icon in manage of groups / channels.

This commit is contained in:
23rd 2022-04-26 19:31:19 +03:00 committed by John Preston
parent d117a72e6e
commit 058717532a

View file

@ -18,7 +18,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#include "ui/layers/generic_box.h" #include "ui/layers/generic_box.h"
#include "ui/widgets/buttons.h" #include "ui/widgets/buttons.h"
#include "info/profile/info_profile_icon.h"
#include "settings/settings_common.h" #include "settings/settings_common.h"
#include "styles/style_settings.h" #include "styles/style_settings.h"
#include "styles/style_info.h" #include "styles/style_info.h"
@ -29,6 +28,7 @@ void EditAllowedReactionsBox(
const std::vector<Data::Reaction> &list, const std::vector<Data::Reaction> &list,
const base::flat_set<QString> &selected, const base::flat_set<QString> &selected,
Fn<void(const std::vector<QString> &)> callback) { Fn<void(const std::vector<QString> &)> callback) {
const auto iconHeight = st::editPeerReactionsPreview;
box->setTitle(tr::lng_manage_peer_reactions()); box->setTitle(tr::lng_manage_peer_reactions());
struct State { struct State {
@ -57,10 +57,21 @@ void EditAllowedReactionsBox(
container, container,
tr::lng_manage_peer_reactions_enable(), tr::lng_manage_peer_reactions_enable(),
st::manageGroupButton.button); st::manageGroupButton.button);
Ui::CreateChild<Info::Profile::FloatingIcon>( if (!list.empty()) {
enabled.get(), AddReactionLottieIcon(
st::infoIconReactions, enabled,
st::manageGroupButton.iconPosition); enabled->sizeValue(
) | rpl::map([=](const QSize &size) {
return QPoint(
st::manageGroupButton.iconPosition.x(),
(size.height() - iconHeight) / 2);
}),
iconHeight,
list.front(),
rpl::never<>(),
rpl::never<>(),
&enabled->lifetime());
}
enabled->toggleOn(state->anyToggled.value()); enabled->toggleOn(state->anyToggled.value());
enabled->toggledChanges( enabled->toggledChanges(
) | rpl::filter([=](bool value) { ) | rpl::filter([=](bool value) {
@ -87,7 +98,6 @@ void EditAllowedReactionsBox(
container, container,
rpl::single(entry.title), rpl::single(entry.title),
st::manageGroupButton.button); st::manageGroupButton.button);
const auto iconHeight = st::editPeerReactionsPreview;
AddReactionLottieIcon( AddReactionLottieIcon(
button, button,
button->sizeValue( button->sizeValue(