Skip to content

Commit

Permalink
Updated to 5.1.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Jun 2, 2024
2 parents 3f3e3be + a7bffe7 commit 0fc2481
Show file tree
Hide file tree
Showing 30 changed files with 239 additions and 116 deletions.
7 changes: 7 additions & 0 deletions Telegram/Resources/langs/lang.strings
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_sure_ban_admin" = "This user is an admin. Are you sure you want to go ahead and restrict them?";
"lng_sure_enable_socks" = "Are you sure you want to enable this proxy?\n\nServer: {server}\nPort: {port}\n\nYou can change your proxy server later in the Settings (Connection Type).";
"lng_sure_enable" = "Enable";
"lng_proxy_box_title" = "Enable proxy";
"lng_proxy_box_server" = "Server";
"lng_proxy_box_port" = "Port";
"lng_proxy_box_secret" = "Secret";
"lng_proxy_box_status" = "Status";
"lng_proxy_box_username" = "Username";
"lng_proxy_box_password" = "Password";
"lng_proxy_invalid" = "The proxy link is invalid.";
"lng_proxy_unsupported" = "Your Telegram Desktop version doesn't support this proxy type or the proxy link is invalid. Please update Telegram Desktop to the latest version.";

Expand Down
2 changes: 1 addition & 1 deletion Telegram/Resources/uwp/AppX/AppxManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="5.1.0.0" />
Version="5.1.1.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>
Expand Down
8 changes: 4 additions & 4 deletions Telegram/Resources/winrc/Telegram.rc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 5,1,0,0
PRODUCTVERSION 5,1,0,0
FILEVERSION 5,1,1,0
PRODUCTVERSION 5,1,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", ""
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "5.1.0.0"
VALUE "FileVersion", "5.1.1.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "5.1.0.0"
VALUE "ProductVersion", "5.1.1.0"
END
END
BLOCK "VarFileInfo"
Expand Down
8 changes: 4 additions & 4 deletions Telegram/Resources/winrc/Updater.rc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 5,1,0,0
PRODUCTVERSION 5,1,0,0
FILEVERSION 5,1,1,0
PRODUCTVERSION 5,1,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -53,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", ""
VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "5.1.0.0"
VALUE "FileVersion", "5.1.1.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "5.1.0.0"
VALUE "ProductVersion", "5.1.1.0"
END
END
BLOCK "VarFileInfo"
Expand Down
4 changes: 3 additions & 1 deletion Telegram/SourceFiles/apiwrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3383,7 +3383,9 @@ void ApiWrap::forwardMessages(
.date = HistoryItem::NewMessageDate(action.options),
.shortcutId = action.options.shortcutId,
.postAuthor = messagePostAuthor,
.effectId = action.options.effectId,

// forwarded messages don't have effects
//.effectId = action.options.effectId,
}, item);
_session->data().registerMessageRandomId(randomId, newId);
if (!localIds) {
Expand Down
4 changes: 4 additions & 0 deletions Telegram/SourceFiles/boxes/boxes.style
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,10 @@ proxyDropdownUpPosition: point(-2px, 20px);
proxyAboutPadding: margins(22px, 7px, 22px, 14px);
proxyAboutSponsorPadding: margins(22px, 7px, 22px, 0px);

proxyApplyBoxLabel : FlatLabel(defaultFlatLabel) {
maxHeight: 30px;
}

markdownLinkFieldPadding: margins(22px, 0px, 22px, 10px);

termsContent: FlatLabel(defaultFlatLabel) {
Expand Down
116 changes: 71 additions & 45 deletions Telegram/SourceFiles/boxes/connection_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ For license and copyright information please follow this link:
#include "base/qthelp_regex.h"
#include "base/qthelp_url.h"
#include "core/application.h"
#include "core/click_handler_types.h"
#include "core/core_settings.h"
#include "core/local_url_handlers.h"
#include "lang/lang_keys.h"
Expand All @@ -36,7 +35,9 @@ For license and copyright information please follow this link:
#include "ui/widgets/popup_menu.h"
#include "ui/wrap/slide_wrap.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/vertical_list.h"
#include "boxes/abstract_box.h" // Ui::show().
#include "window/window_session_controller.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h"
Expand Down Expand Up @@ -1186,59 +1187,84 @@ ProxiesBoxController::ProxiesBoxController(not_null<Main::Account*> account)
}

void ProxiesBoxController::ShowApplyConfirmation(
Window::SessionController *controller,
Type type,
const QMap<QString, QString> &fields) {
const auto proxy = ProxyDataFromFields(type, fields);
if (proxy) {
static const auto UrlStartRegExp = QRegularExpression(
"^https://",
QRegularExpression::CaseInsensitiveOption);
static const auto UrlEndRegExp = QRegularExpression("/$");
const auto displayed = "https://" + proxy.host + "/";
const auto parsed = QUrl::fromUserInput(displayed);
const auto displayUrl = !UrlClickHandler::IsSuspicious(displayed)
? displayed
: parsed.isValid()
? QString::fromUtf8(parsed.toEncoded())
: UrlClickHandler::ShowEncoded(displayed);
const auto displayServer = QString(
displayUrl
).replace(
UrlStartRegExp,
QString()
).replace(UrlEndRegExp, QString());
const auto text = tr::lng_sure_enable_socks(
tr::now,
lt_server,
displayServer,
lt_port,
QString::number(proxy.port))
+ (proxy.type == Type::Mtproto
? "\n\n" + tr::lng_proxy_sponsor_warning(tr::now)
: QString());
auto callback = [=](Fn<void()> &&close) {
if (!proxy) {
auto box = Ui::MakeInformBox(
(proxy.status() == ProxyData::Status::Unsupported
? tr::lng_proxy_unsupported(tr::now)
: tr::lng_proxy_invalid(tr::now)));
if (controller) {
controller->uiShow()->showBox(std::move(box));
} else {
Ui::show(std::move(box));
}
return;
}
static const auto UrlStartRegExp = QRegularExpression(
"^https://",
QRegularExpression::CaseInsensitiveOption);
static const auto UrlEndRegExp = QRegularExpression("/$");
const auto displayed = "https://" + proxy.host + "/";
const auto parsed = QUrl::fromUserInput(displayed);
const auto displayUrl = !UrlClickHandler::IsSuspicious(displayed)
? displayed
: parsed.isValid()
? QString::fromUtf8(parsed.toEncoded())
: UrlClickHandler::ShowEncoded(displayed);
const auto displayServer = QString(
displayUrl
).replace(
UrlStartRegExp,
QString()
).replace(UrlEndRegExp, QString());
const auto box = [=](not_null<Ui::GenericBox*> box) {
box->setTitle(tr::lng_proxy_box_title());
if (type == Type::Mtproto) {
box->addRow(object_ptr<Ui::FlatLabel>(
box,
tr::lng_proxy_sponsor_warning(),
st::boxDividerLabel));
Ui::AddSkip(box->verticalLayout());
Ui::AddSkip(box->verticalLayout());
}
const auto &stL = st::proxyApplyBoxLabel;
const auto &stSubL = st::boxDividerLabel;
const auto add = [&](const QString &s, tr::phrase<> phrase) {
if (!s.isEmpty()) {
box->addRow(object_ptr<Ui::FlatLabel>(box, s, stL));
box->addRow(object_ptr<Ui::FlatLabel>(box, phrase(), stSubL));
Ui::AddSkip(box->verticalLayout());
Ui::AddSkip(box->verticalLayout());
}
};
if (!displayServer.isEmpty()) {
add(displayServer, tr::lng_proxy_box_server);
}
add(QString::number(proxy.port), tr::lng_proxy_box_port);
if (type == Type::Socks5) {
add(proxy.user, tr::lng_proxy_box_username);
add(proxy.password, tr::lng_proxy_box_password);
} else if (type == Type::Mtproto) {
add(proxy.password, tr::lng_proxy_box_secret);
}
box->addButton(tr::lng_sure_enable(), [=] {
auto &proxies = Core::App().settings().proxy().list();
if (!ranges::contains(proxies, proxy)) {
proxies.push_back(proxy);
}
Core::App().setCurrentProxy(
proxy,
ProxyData::Settings::Enabled);
Core::App().setCurrentProxy(proxy, ProxyData::Settings::Enabled);
Local::writeSettings();
close();
};
Ui::show(
Ui::MakeConfirmBox({
.text = text,
.confirmed = std::move(callback),
.confirmText = tr::lng_sure_enable(),
}),
Ui::LayerOption::KeepOther);
box->closeBox();
});
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
};
if (controller) {
controller->uiShow()->showBox(Box(box));
} else {
Ui::show(Ui::MakeInformBox(
(proxy.status() == ProxyData::Status::Unsupported
? tr::lng_proxy_unsupported(tr::now)
: tr::lng_proxy_invalid(tr::now))));
Ui::show(Box(box));
}
}

Expand Down
5 changes: 5 additions & 0 deletions Telegram/SourceFiles/boxes/connection_box.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ namespace Main {
class Account;
} // namespace Main

namespace Window {
class SessionController;
} // namespace Window

class ProxiesBoxController {
public:
using ProxyData = MTP::ProxyData;
Expand All @@ -38,6 +42,7 @@ class ProxiesBoxController {
explicit ProxiesBoxController(not_null<Main::Account*> account);

static void ShowApplyConfirmation(
Window::SessionController *controller,
Type type,
const QMap<QString, QString> &fields);

Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ void PeerShortInfoCover::paintRadial(QPainter &p) {
QImage PeerShortInfoCover::currentVideoFrame() const {
const auto size = QSize(_st.size, _st.size);
const auto request = Media::Streaming::FrameRequest{
.resize = size * style::DevicePixelRatio(),
.resize = size,
.outer = size,
};
return (_videoInstance
Expand Down
11 changes: 10 additions & 1 deletion Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,20 @@ base::unique_qptr<Ui::PopupMenu> GifsListWidget::fillContextMenu(
const auto send = crl::guard(this, [=](Api::SendOptions options) {
selectInlineResult(selected, options, true);
});
const auto item = _mosaic.maybeItemAt(_selected);
const auto isInlineResult = !item->getPhoto()
&& !item->getDocument()
&& item->getResult();
const auto icons = &st().icons;
auto copyDetails = details;
if (isInlineResult) {
// inline results don't have effects
copyDetails.effectAllowed = false;
}
SendMenu::FillSendMenu(
menu,
_show,
details,
copyDetails,
SendMenu::DefaultCallback(_show, send),
icons);

Expand Down
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/core/local_url_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ bool ApplySocksProxy(
match->captured(1),
qthelp::UrlParamNameTransform::ToLower);
ProxiesBoxController::ShowApplyConfirmation(
controller,
MTP::ProxyData::Type::Socks5,
params);
if (controller) {
Expand All @@ -366,6 +367,7 @@ bool ApplyMtprotoProxy(
match->captured(1),
qthelp::UrlParamNameTransform::ToLower);
ProxiesBoxController::ShowApplyConfirmation(
controller,
MTP::ProxyData::Type::Mtproto,
params);
if (controller) {
Expand Down
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/core/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"_cs;
constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs;
constexpr auto AppName = "Telegram Desktop"_cs;
constexpr auto AppFile = "Telegram"_cs;
constexpr auto AppVersion = 5001000;
constexpr auto AppVersionStr = "5.1";
constexpr auto AppVersion = 5001001;
constexpr auto AppVersionStr = "5.1.1";
constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;
10 changes: 4 additions & 6 deletions Telegram/SourceFiles/data/data_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1821,18 +1821,16 @@ rpl::producer<not_null<HistoryItem*>> Session::itemDataChanges() const {

void Session::requestItemTextRefresh(not_null<HistoryItem*> item) {
const auto call = [&](not_null<HistoryItem*> item) {
if (const auto i = _views.find(item); i != _views.end()) {
for (const auto &view : i->second) {
view->itemTextUpdated();
}
}
enumerateItemViews(item, [&](not_null<ViewElement*> view) {
view->itemTextUpdated();
});
requestItemResize(item);
};
if (const auto group = groups().find(item)) {
call(group->items.front());
} else {
call(item);
}
requestItemResize(item);
}

void Session::registerHighlightProcess(
Expand Down
2 changes: 0 additions & 2 deletions Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1495,8 +1495,6 @@ RowDescriptor InnerWidget::computeChatPreviewRow() const {
: 0;
if (const auto topic = peer->forumTopicFor(topicId)) {
return { topic, FullMsgId() };
} else if (peer->isForum() && !result.key.topic()) {
return {};
}
}
return { result.key, result.message.fullId };
Expand Down
7 changes: 5 additions & 2 deletions Telegram/SourceFiles/dialogs/dialogs_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ Widget::Widget(
}, lifetime());
_inner->cancelSearchRequests(
) | rpl::start_with_next([=] {
setInnerFocus(true);
applySearchState({});
}, lifetime());
_inner->chosenRow(
Expand Down Expand Up @@ -2987,13 +2988,13 @@ bool Widget::applySearchState(SearchState state) {
if (queryChanged) {
updateLockUnlockVisibility(anim::type::normal);
updateLoadMoreChatsVisibility();
updateCancelSearch();
}
if (inChatChanged) {
controller()->setSearchInChat(_searchState.inChat);
updateSearchTabs();
}
if (queryChanged || inChatChanged) {
updateCancelSearch();
updateStoriesVisibility();
}
updateJumpToDateVisibility();
Expand All @@ -3019,7 +3020,9 @@ bool Widget::applySearchState(SearchState state) {
controller()->closeFolder();
}

setSearchQuery(_searchState.query);
if (_searchState.query != currentSearchQuery()) {
setSearchQuery(_searchState.query);
}
_inner->applySearchState(_searchState);

if (!_postponeProcessSearchFocusChange) {
Expand Down
Loading

0 comments on commit 0fc2481

Please sign in to comment.