Slightly improved style of menu for sponsored messages.

This commit is contained in:
23rd 2023-03-03 13:46:33 +03:00
parent ec6dda47ae
commit 728ec0974a
9 changed files with 27 additions and 19 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 546 B

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 949 B

After

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -158,7 +158,7 @@ void FillSponsoredMessagesMenu(
auto item = base::make_unique_q<Ui::Menu::MultilineAction>(
menu,
st::defaultMenu,
st::historyHasCustomEmoji,
st::historySponsorInfoItem,
st::historyHasCustomEmojiPosition,
base::duplicate(i));
item->clicks(
@ -173,29 +173,14 @@ void FillSponsoredMessagesMenu(
CreateAddActionCallback(menu)(MenuCallback::Args{
.text = tr::lng_sponsored_info_menu(tr::now),
.handler = nullptr,
.icon = nullptr,
.icon = &st::menuIconChannel,
.fillSubmenu = std::move(fillSubmenu),
});
menu->addSeparator();
menu->addSeparator(&st::expandedMenuSeparator);
}
{
auto item = base::make_unique_q<Ui::Menu::MultilineAction>(
menu,
st::menuWithIcons,
st::historyHasCustomEmoji,
st::historySponsoredAboutMenuLabelPosition,
TextWithEntities{ tr::lng_sponsored_title(tr::now) },
&st::menuIconInfo);
item->clicks(
) | rpl::start_with_next([=] {
controller->show(Box(Ui::AboutSponsoredBox));
}, item->lifetime());
menu->addAction(std::move(item));
}
menu->addSeparator();
menu->addAction(tr::lng_sponsored_hide_ads(tr::now), [=] {
Settings::ShowPremium(controller, "no_ads");
}, &st::menuIconBlock);
}, &st::menuIconCancel);
}
} // namespace
@ -2530,6 +2515,21 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
HistoryView::CopyPostLink(controller, itemId, HistoryView::Context::History);
}, &st::menuIconLink);
}
if (item && item->isSponsored()) {
_menu->addSeparator(&st::expandedMenuSeparator);
auto item = base::make_unique_q<Ui::Menu::MultilineAction>(
_menu,
st::menuWithIcons,
st::historyHasCustomEmoji,
st::historySponsoredAboutMenuLabelPosition,
TextWithEntities{ tr::lng_sponsored_title(tr::now) },
&st::menuIconInfo);
item->clicks(
) | rpl::start_with_next([=] {
controller->show(Box(Ui::AboutSponsoredBox));
}, item->lifetime());
_menu->addAction(std::move(item));
}
if (isUponSelected > 1) {
if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) {
_menu->addAction(tr::lng_context_forward_selected(tr::now), [=] {

View File

@ -1232,6 +1232,13 @@ msgServiceGiftBoxTitlePadding: margins(0px, 5px, 0px, 2px);
msgServiceGiftBoxStickerTop: -19px;
msgServiceGiftBoxStickerSize: size(140px, 140px);
historySponsorInfoItem: FlatLabel(defaultFlatLabel) {
style: TextStyle(defaultTextStyle) {
font: font(12px);
}
minWidth: 136px;
maxHeight: 40px;
}
historyHasCustomEmoji: FlatLabel(defaultFlatLabel) {
style: TextStyle(defaultTextStyle) {
font: font(11px);

View File

@ -103,6 +103,7 @@ menuIconPhotoSuggest: icon {{ "menu/photo_suggest", menuIconColor }};
menuIconNewWindow: icon {{ "menu/new_window", menuIconColor }};
menuIconChatBubble: icon {{ "menu/chat_bubble", menuIconColor }};
menuIconPhone: icon {{ "menu/phone", menuIconColor }};
menuIconChannel: icon {{ "menu/channel", menuIconColor }};
menuIconTTLAny: icon {{ "menu/auto_delete_plain", menuIconColor }};
menuIconTTLAnyTextPosition: point(11px, 22px);