Added initial learn about as divider text to channel earn info section.

This commit is contained in:
23rd 2024-03-20 01:02:36 +03:00 committed by John Preston
parent a7df074b8f
commit a45a9e6515
3 changed files with 62 additions and 1 deletions

View file

@ -0,0 +1,11 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
using "ui/basic.style";
using "boxes/boxes.style";
channelEarnLearnArrowMargins: margins(-2px, 5px, 0px, 0px);

View file

@ -7,7 +7,20 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "info/channel_statistics/earn/info_earn_inner_widget.h"
#include "core/ui_integration.h" // Core::MarkedTextContext.
#include "data/data_peer.h"
#include "data/data_session.h"
#include "data/data_session.h"
#include "data/stickers/data_custom_emoji.h"
#include "info/info_controller.h"
#include "lang/lang_keys.h"
#include "main/main_session.h"
#include "ui/text/text_utilities.h"
#include "ui/vertical_list.h"
#include "ui/widgets/labels.h"
#include "styles/style_channel_earn.h"
#include "styles/style_chat.h"
#include "styles/style_layers.h"
namespace Info::ChannelEarn {
namespace {
@ -27,6 +40,42 @@ void InnerWidget::load() {
}
void InnerWidget::fill() {
const auto container = this;
const auto session = &_peer->session();
{
const auto emoji = Ui::Text::SingleCustomEmoji(
session->data().customEmojiManager().registerInternalEmoji(
st::topicButtonArrow,
st::channelEarnLearnArrowMargins,
false));
auto label = object_ptr<Ui::FlatLabel>(
container,
st::boxDividerLabel);
const auto raw = label.data();
tr::lng_channel_earn_about(
lt_link,
tr::lng_channel_earn_about_link(
lt_emoji,
rpl::single(emoji),
Ui::Text::RichLangValue
) | rpl::map([](TextWithEntities text) {
return Ui::Text::Link(std::move(text), 1);
}),
Ui::Text::RichLangValue
) | rpl::start_with_next([=](const TextWithEntities &text) {
raw->setMarkedText(
text,
Core::MarkedTextContext{ .session = session });
}, label->lifetime());
label->setLink(1, std::make_shared<LambdaClickHandler>([=] {
}));
container->add(object_ptr<Ui::DividerLabel>(
container,
std::move(label),
st::defaultBoxDividerLabelPadding,
RectPart::Top | RectPart::Bottom));
}
}
void InnerWidget::saveState(not_null<Memento*> memento) {
@ -36,7 +85,7 @@ void InnerWidget::saveState(not_null<Memento*> memento) {
void InnerWidget::restoreState(not_null<Memento*> memento) {
// _state = memento->state();
// if (!_state.link.isEmpty()) {
// fill();
fill();
// } else {
// load();
// }

View file

@ -24,6 +24,7 @@ set(style_files
export/view/export.style
info/info.style
info/channel_statistics/boosts/giveaway/giveaway.style
info/channel_statistics/earn/channel_earn.style
info/userpic/info_userpic_builder.style
intro/intro.style
iv/iv.style