Added box for ad description.
This commit is contained in:
parent
c5140f34a7
commit
ad328d35a2
|
@ -174,6 +174,8 @@ PRIVATE
|
||||||
boxes/peers/edit_peer_permissions_box.h
|
boxes/peers/edit_peer_permissions_box.h
|
||||||
boxes/about_box.cpp
|
boxes/about_box.cpp
|
||||||
boxes/about_box.h
|
boxes/about_box.h
|
||||||
|
boxes/about_sponsored_box.cpp
|
||||||
|
boxes/about_sponsored_box.h
|
||||||
boxes/abstract_box.cpp
|
boxes/abstract_box.cpp
|
||||||
boxes/abstract_box.h
|
boxes/abstract_box.h
|
||||||
boxes/add_contact_box.cpp
|
boxes/add_contact_box.cpp
|
||||||
|
|
|
@ -2894,6 +2894,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_view_button_group" = "View group";
|
"lng_view_button_group" = "View group";
|
||||||
"lng_view_button_channel" = "View channel";
|
"lng_view_button_channel" = "View channel";
|
||||||
|
|
||||||
|
"lng_sponsored_title" = "What are sponsored messages?";
|
||||||
|
"lng_sponsored_info_description1" = "Unlike other apps, Telegram never uses your private data to target ads. You are seeing this message only because someone chose this public one-to-many channel as a space to promote their messages. This means that no user data is mined or analyzed to display ads, and every user viewing a channel on Telegram sees the same sponsored message.";
|
||||||
|
"lng_sponsored_info_description2" = "Unlike other apps, Telegram doesn\'t track whether you tapped on a sponsored message and doesn\'t profile you based on your activity. We also prevent external links in sponsored messages to ensure that third parties can’t spy on our users. We believe that everyone has the right to privacy, and technological platforms should respect that.";
|
||||||
|
"lng_sponsored_info_description3" = "Telegram offers free and unlimited service to hundreds of millions of users, which involves significant server and traffic costs. In order to remain independent and stay true to its values, Telegram developed a paid tool to promote messages with user privacy in mind. We welcome responsible advertisers at:";
|
||||||
|
"lng_sponsored_info_description4" = "Ads should no longer be synonymous with abuse of user privacy. Let us redefine how a tech company should operate – together.";
|
||||||
|
|
||||||
// Wnd specific
|
// Wnd specific
|
||||||
|
|
||||||
"lng_wnd_choose_program_menu" = "Choose Default Program...";
|
"lng_wnd_choose_program_menu" = "Choose Default Program...";
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
#include "boxes/about_sponsored_box.h"
|
||||||
|
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
|
#include "ui/widgets/buttons.h"
|
||||||
|
#include "ui/widgets/labels.h"
|
||||||
|
#include "styles/style_boxes.h"
|
||||||
|
#include "styles/style_layers.h"
|
||||||
|
|
||||||
|
#include <QtGui/QDesktopServices>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
constexpr auto kUrl = "https://telegram.org/ads"_cs;
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
void AboutSponsoredBox(not_null<Ui::GenericBox*> box) {
|
||||||
|
box->setTitle(tr::lng_sponsored_title());
|
||||||
|
box->setWidth(st::boxWideWidth);
|
||||||
|
box->addButton(tr::lng_box_ok(), [=] { box->closeBox(); });
|
||||||
|
|
||||||
|
const auto addUrl = [&] {
|
||||||
|
const auto &st = st::sponsoredUrlButton;
|
||||||
|
const auto row = box->addRow(object_ptr<RpWidget>(box));
|
||||||
|
row->resize(0, st.height + st.padding.top() + st.padding.bottom());
|
||||||
|
const auto button = Ui::CreateChild<RoundButton>(
|
||||||
|
row,
|
||||||
|
rpl::single<QString>(kUrl.utf8()),
|
||||||
|
st);
|
||||||
|
button->setBrushOverride(Qt::NoBrush);
|
||||||
|
button->setPenOverride(QPen(st::historyLinkInFg));
|
||||||
|
button->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
|
||||||
|
rpl::combine(
|
||||||
|
row->sizeValue(),
|
||||||
|
button->sizeValue()
|
||||||
|
) | rpl::start_with_next([=](
|
||||||
|
const QSize &rowSize,
|
||||||
|
const QSize &buttonSize) {
|
||||||
|
button->moveToLeft(
|
||||||
|
(rowSize.width() - buttonSize.width()) / 2,
|
||||||
|
(rowSize.height() - buttonSize.height()) / 2);
|
||||||
|
}, row->lifetime());
|
||||||
|
button->addClickHandler([=] {
|
||||||
|
QDesktopServices::openUrl({ kUrl.utf8() });
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const auto &stLabel = st::aboutLabel;
|
||||||
|
const auto info1 = box->addRow(object_ptr<FlatLabel>(box, stLabel));
|
||||||
|
info1->setText(tr::lng_sponsored_info_description1(tr::now));
|
||||||
|
box->addSkip(st::sponsoredInfoSkip);
|
||||||
|
|
||||||
|
const auto info2 = box->addRow(object_ptr<FlatLabel>(box, stLabel));
|
||||||
|
info2->setText(tr::lng_sponsored_info_description2(tr::now));
|
||||||
|
box->addSkip(st::sponsoredInfoSkip);
|
||||||
|
|
||||||
|
const auto info3 = box->addRow(object_ptr<FlatLabel>(box, stLabel));
|
||||||
|
info3->setText(tr::lng_sponsored_info_description3(tr::now));
|
||||||
|
box->addSkip(st::sponsoredUrlButtonSkip);
|
||||||
|
|
||||||
|
addUrl();
|
||||||
|
box->addSkip(st::sponsoredUrlButtonSkip);
|
||||||
|
|
||||||
|
const auto info4 = box->addRow(object_ptr<FlatLabel>(box, stLabel));
|
||||||
|
info4->setText(tr::lng_sponsored_info_description4(tr::now));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Ui
|
|
@ -0,0 +1,16 @@
|
||||||
|
/*
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui/layers/generic_box.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
|
||||||
|
void AboutSponsoredBox(not_null<Ui::GenericBox*> box);
|
||||||
|
|
||||||
|
} // namespace Ui
|
|
@ -973,3 +973,22 @@ autolockTimeField: InputField(scheduleTimeField) {
|
||||||
heightMin: 20px;
|
heightMin: 20px;
|
||||||
}
|
}
|
||||||
autolockTimeWidth: 52px;
|
autolockTimeWidth: 52px;
|
||||||
|
|
||||||
|
sponsoredInfoSkip: 22px;
|
||||||
|
sponsoredUrlButtonSkip: 11px;
|
||||||
|
sponsoredUrlButton: RoundButton(defaultActiveButton) {
|
||||||
|
height: 32px;
|
||||||
|
width: -42px;
|
||||||
|
textBg: transparent;
|
||||||
|
textBgOver: transparent;
|
||||||
|
radius: roundRadiusLarge;
|
||||||
|
padding: margins(2px, 2px, 2px, 2px);
|
||||||
|
textFg: historyLinkInFg;
|
||||||
|
textFgOver: historyLinkInFg;
|
||||||
|
textTop: 7px;
|
||||||
|
font: normalFont;
|
||||||
|
|
||||||
|
ripple: RippleAnimation(defaultRippleAnimation) {
|
||||||
|
color: windowBgOver;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "history/view/history_view_cursor_state.h"
|
#include "history/view/history_view_cursor_state.h"
|
||||||
#include "history/view/history_view_context_menu.h"
|
#include "history/view/history_view_context_menu.h"
|
||||||
#include "history/view/history_view_emoji_interactions.h"
|
#include "history/view/history_view_emoji_interactions.h"
|
||||||
#include "ui/chat/chat_theme.h"
|
|
||||||
#include "ui/chat/chat_style.h"
|
#include "ui/chat/chat_style.h"
|
||||||
#include "ui/widgets/popup_menu.h"
|
#include "ui/widgets/popup_menu.h"
|
||||||
#include "ui/image/image.h"
|
#include "ui/image/image.h"
|
||||||
|
@ -41,6 +40,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "window/window_peer_menu.h"
|
#include "window/window_peer_menu.h"
|
||||||
#include "window/window_controller.h"
|
#include "window/window_controller.h"
|
||||||
#include "window/notifications_manager.h"
|
#include "window/notifications_manager.h"
|
||||||
|
#include "boxes/about_sponsored_box.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
#include "boxes/sticker_set_box.h"
|
#include "boxes/sticker_set_box.h"
|
||||||
#include "chat_helpers/message_field.h"
|
#include "chat_helpers/message_field.h"
|
||||||
|
@ -1871,6 +1871,11 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (msg && view && !link && (view->hasVisibleText() || mediaHasTextForCopy)) {
|
if (msg && view && !link && (view->hasVisibleText() || mediaHasTextForCopy)) {
|
||||||
|
if (item->isSponsored()) {
|
||||||
|
_menu->addAction(tr::lng_sponsored_title({}), [=] {
|
||||||
|
_controller->show(Box(Ui::AboutSponsoredBox));
|
||||||
|
});
|
||||||
|
}
|
||||||
_menu->addAction(tr::lng_context_copy_text(tr::now), [=] {
|
_menu->addAction(tr::lng_context_copy_text(tr::now), [=] {
|
||||||
copyContextText(itemId);
|
copyContextText(itemId);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7182fad08a004b86697af27c971c16bb12c8b421
|
Subproject commit 165147063811463505e0928160392488782b5201
|
Loading…
Reference in New Issue