mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
Display a disclaimer about proxy sponsor.
This commit is contained in:
parent
d3f85b4c4e
commit
5a1d4d55c6
@ -442,6 +442,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_proxy_credentials_optional" = "Credentials (optional)";
|
||||
"lng_proxy_credentials" = "Credentials";
|
||||
"lng_proxy_description" = "Your saved proxy list will be here.";
|
||||
"lng_proxy_sponsor" = "Proxy sponsor";
|
||||
"lng_proxy_sponsor_about" = "This channel is shown by your proxy server.\nTo remove this channel from your chats list,\ndisable the proxy in Telegram Settings.";
|
||||
|
||||
"lng_settings_blocked_users" = "Blocked users";
|
||||
"lng_settings_last_seen_privacy" = "Last seen privacy";
|
||||
|
@ -288,6 +288,8 @@ AuthSession::AuthSession(UserId userId)
|
||||
subscribe(Global::RefConnectionTypeChanged(), [=] {
|
||||
_api->refreshProxyPromotion();
|
||||
});
|
||||
_api->refreshProxyPromotion();
|
||||
|
||||
Window::Theme::Background()->start();
|
||||
}
|
||||
|
||||
|
@ -1601,13 +1601,21 @@ void Session::setProxyPromoted(PeerData *promoted) {
|
||||
if (const auto history = App::historyLoaded(_proxyPromoted)) {
|
||||
history->cacheProxyPromoted(false);
|
||||
}
|
||||
_proxyPromoted = promoted;
|
||||
const auto old = std::exchange(_proxyPromoted, promoted);
|
||||
if (_proxyPromoted) {
|
||||
const auto history = App::history(_proxyPromoted);
|
||||
history->cacheProxyPromoted(true);
|
||||
if (!history->lastMessageKnown()) {
|
||||
_session->api().requestDialogEntry(history);
|
||||
}
|
||||
Notify::peerUpdatedDelayed(
|
||||
_proxyPromoted,
|
||||
Notify::PeerUpdate::Flag::ChannelPromotedChanged);
|
||||
}
|
||||
if (old) {
|
||||
Notify::peerUpdatedDelayed(
|
||||
old,
|
||||
Notify::PeerUpdate::Flag::ChannelPromotedChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,9 @@ void Entry::cacheProxyPromoted(bool promoted) {
|
||||
_isProxyPromoted = promoted;
|
||||
updateChatListSortPosition();
|
||||
updateChatListEntry();
|
||||
if (!_isProxyPromoted) {
|
||||
updateChatListExistence();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ void paintRow(
|
||||
|
||||
const auto promoted = chat.entry()->useProxyPromotion();
|
||||
if (promoted) {
|
||||
const auto text = QString("Proxy sponsor");
|
||||
const auto text = lang(lng_proxy_sponsor);
|
||||
paintRowTopRight(p, text, rectForName, active, selected);
|
||||
} else if (from && !(flags & Flag::FeedSearchResult)) {
|
||||
if (const auto chatTypeIcon = ChatTypeIcon(from, active, selected)) {
|
||||
|
@ -456,3 +456,9 @@ historyGroupWidthMin: minPhotoSize;
|
||||
historyGroupSkip: 4px;
|
||||
historyGroupRadialSize: 44px;
|
||||
historyGroupRadialLine: 3px;
|
||||
|
||||
historyAboutProxy: FlatLabel(defaultFlatLabel) {
|
||||
align: align(top);
|
||||
textFg: windowSubTextFg;
|
||||
}
|
||||
historyAboutProxyPadding: margins(20px, 10px, 20px, 10px);
|
||||
|
@ -617,7 +617,8 @@ HistoryWidget::HistoryWidget(
|
||||
| UpdateFlag::MembersChanged
|
||||
| UpdateFlag::UserOnlineChanged
|
||||
| UpdateFlag::NotificationsEnabled
|
||||
| UpdateFlag::ChannelAmIn;
|
||||
| UpdateFlag::ChannelAmIn
|
||||
| UpdateFlag::ChannelPromotedChanged;
|
||||
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(changes, [this](const Notify::PeerUpdate &update) {
|
||||
if (update.peer == _peer) {
|
||||
if (update.flags & UpdateFlag::ChannelRightsChanged) {
|
||||
@ -652,6 +653,13 @@ HistoryWidget::HistoryWidget(
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
if (update.flags & UpdateFlag::ChannelPromotedChanged) {
|
||||
refreshAboutProxyPromotion();
|
||||
updateHistoryGeometry();
|
||||
updateControlsVisibility();
|
||||
updateControlsGeometry();
|
||||
this->update();
|
||||
}
|
||||
if (update.flags & (UpdateFlag::UserIsBlocked
|
||||
| UpdateFlag::AdminsChanged
|
||||
| UpdateFlag::MembersChanged
|
||||
@ -2085,6 +2093,7 @@ void HistoryWidget::updateControlsVisibility() {
|
||||
if (_reportSpamPanel) {
|
||||
_reportSpamPanel->show();
|
||||
}
|
||||
refreshAboutProxyPromotion();
|
||||
if (!editingMessage() && (isBlocked() || isJoinChannel() || isMuteUnmute() || isBotStart())) {
|
||||
if (isBlocked()) {
|
||||
_joinChannel->hide();
|
||||
@ -2246,6 +2255,24 @@ void HistoryWidget::updateControlsVisibility() {
|
||||
updateMouseTracking();
|
||||
}
|
||||
|
||||
void HistoryWidget::refreshAboutProxyPromotion() {
|
||||
if (_history->useProxyPromotion()) {
|
||||
if (!_aboutProxyPromotion) {
|
||||
_aboutProxyPromotion = object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||
this,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
this,
|
||||
lang(lng_proxy_sponsor_about),
|
||||
Ui::FlatLabel::InitType::Simple,
|
||||
st::historyAboutProxy),
|
||||
st::historyAboutProxyPadding);
|
||||
}
|
||||
_aboutProxyPromotion->show();
|
||||
} else {
|
||||
_aboutProxyPromotion.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::updateMouseTracking() {
|
||||
bool trackMouse = !_fieldBarCancel->isHidden() || _pinnedBar;
|
||||
setMouseTracking(trackMouse);
|
||||
@ -3911,6 +3938,12 @@ void HistoryWidget::moveFieldControls() {
|
||||
_unblock->setGeometry(fullWidthButtonRect);
|
||||
_joinChannel->setGeometry(fullWidthButtonRect);
|
||||
_muteUnmute->setGeometry(fullWidthButtonRect);
|
||||
|
||||
if (_aboutProxyPromotion) {
|
||||
_aboutProxyPromotion->moveToLeft(
|
||||
0,
|
||||
fullWidthButtonRect.y() - _aboutProxyPromotion->height());
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::updateTabbedSelectorToggleTooltipGeometry() {
|
||||
@ -4729,6 +4762,10 @@ void HistoryWidget::updateHistoryGeometry(bool initial, bool loadedDown, const S
|
||||
auto newScrollHeight = height() - _topBar->height();
|
||||
if (!editingMessage() && (isBlocked() || isBotStart() || isJoinChannel() || isMuteUnmute())) {
|
||||
newScrollHeight -= _unblock->height();
|
||||
if (_aboutProxyPromotion) {
|
||||
_aboutProxyPromotion->resizeToWidth(width());
|
||||
newScrollHeight -= _aboutProxyPromotion->height();
|
||||
}
|
||||
} else {
|
||||
if (editingMessage() || _canSendMessages) {
|
||||
newScrollHeight -= (_field->height() + 2 * st::historySendPadding);
|
||||
@ -6663,6 +6700,9 @@ void HistoryWidget::paintEvent(QPaintEvent *e) {
|
||||
} else if (isRestrictedWrite()) {
|
||||
drawRestrictedWrite(p);
|
||||
}
|
||||
if (_aboutProxyPromotion) {
|
||||
p.fillRect(_aboutProxyPromotion->geometry(), st::historyReplyBg);
|
||||
}
|
||||
if (_pinnedBar && !_pinnedBar->cancel->isHidden()) {
|
||||
drawPinnedBar(p);
|
||||
}
|
||||
|
@ -461,6 +461,7 @@ private:
|
||||
void setMembersShowAreaActive(bool active);
|
||||
void forwardItems(MessageIdsList &&items);
|
||||
void handleHistoryChange(not_null<const History*> history);
|
||||
void refreshAboutProxyPromotion();
|
||||
|
||||
void highlightMessage(MsgId universalMessageId);
|
||||
void adjustHighlightedMessageToMigrated();
|
||||
@ -783,6 +784,7 @@ private:
|
||||
object_ptr<Ui::FlatButton> _botStart;
|
||||
object_ptr<Ui::FlatButton> _joinChannel;
|
||||
object_ptr<Ui::FlatButton> _muteUnmute;
|
||||
object_ptr<Ui::RpWidget> _aboutProxyPromotion = { nullptr };
|
||||
mtpRequestId _unblockRequest = 0;
|
||||
mtpRequestId _reportSpamRequest = 0;
|
||||
object_ptr<Ui::IconButton> _attachToggle;
|
||||
|
@ -64,6 +64,7 @@ struct PeerUpdate {
|
||||
ChannelRightsChanged = (1 << 17),
|
||||
ChannelStickersChanged = (1 << 18),
|
||||
ChannelPinnedChanged = (1 << 19),
|
||||
ChannelPromotedChanged = (1 << 20),
|
||||
};
|
||||
using Flags = base::flags<Flag>;
|
||||
friend inline constexpr auto is_flag_type(Flag) { return true; }
|
||||
|
Loading…
Reference in New Issue
Block a user