From c93f047056841ab08282cc0d736230d9227f8d1e Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 12 Sep 2024 03:06:08 +0400 Subject: [PATCH 1/7] Add run0 support --- Telegram/SourceFiles/platform/linux/launcher_linux.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/launcher_linux.cpp b/Telegram/SourceFiles/platform/linux/launcher_linux.cpp index 9afde3b19..008910300 100644 --- a/Telegram/SourceFiles/platform/linux/launcher_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/launcher_linux.cpp @@ -49,7 +49,9 @@ bool Launcher::launchUpdater(UpdaterLaunch action) { const auto launching = justRelaunch ? (cExeDir() + cExeName()) : cWriteProtected() - ? u"pkexec"_q + ? GLib::find_program_in_path("run0") + ? u"run0"_q + : u"pkexec"_q : (cExeDir() + u"Updater"_q); argumentsList.push_back(launching.toStdString()); @@ -61,7 +63,7 @@ bool Launcher::launchUpdater(UpdaterLaunch action) { : launching; argumentsList.push_back(argv0.toStdString()); } else if (cWriteProtected()) { - // Elevated process that pkexec should launch. + // Elevated process that run0/pkexec should launch. const auto elevated = cWorkingDir() + u"tupdates/temp/Updater"_q; argumentsList.push_back(elevated.toStdString()); } From 6f71d21bb7064b0c9c574cf178e93de7eff18d05 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 12 Sep 2024 22:03:16 +0300 Subject: [PATCH 2/7] Slightly improved box for link creation when user has link in clipboard. --- Telegram/SourceFiles/chat_helpers/message_field.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/chat_helpers/message_field.cpp b/Telegram/SourceFiles/chat_helpers/message_field.cpp index 8c4a86ea1..e38c134af 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.cpp +++ b/Telegram/SourceFiles/chat_helpers/message_field.cpp @@ -147,13 +147,24 @@ void EditLinkBox( object_ptr(content), st::markdownLinkFieldPadding); placeholder->setAttribute(Qt::WA_TransparentForMouseEvents); + const auto link = [&] { + if (!startLink.trimmed().isEmpty()) { + return startLink.trimmed(); + } + const auto clipboard = QGuiApplication::clipboard()->text().trimmed(); + if (clipboard.startsWith("http://") + || clipboard.startsWith("https://")) { + return clipboard; + } + return QString(); + }(); const auto url = Ui::AttachParentChild( content, object_ptr( content, fieldSt, tr::lng_formatting_link_url(), - startLink.trimmed())); + link)); url->heightValue( ) | rpl::start_with_next([placeholder](int height) { placeholder->resize(placeholder->width(), height); From 1dc310586d9296969514771c1d72865eeb18758e Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 13 Sep 2024 12:40:17 +0400 Subject: [PATCH 3/7] Unregister channel from shortpoll. --- Telegram/SourceFiles/api/api_updates.cpp | 33 +++++++++++++++++------- Telegram/SourceFiles/api/api_updates.h | 1 + Telegram/SourceFiles/apiwrap.cpp | 2 +- Telegram/SourceFiles/data/data_channel.h | 2 +- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/Telegram/SourceFiles/api/api_updates.cpp b/Telegram/SourceFiles/api/api_updates.cpp index ae99d2954..3bbab8cf4 100644 --- a/Telegram/SourceFiles/api/api_updates.cpp +++ b/Telegram/SourceFiles/api/api_updates.cpp @@ -417,13 +417,12 @@ void Updates::channelDifferenceDone( "{ good - after not final channelDifference was received }%1" ).arg(_session->mtp().isTestMode() ? " TESTMODE" : "")); getChannelDifference(channel); - } else if (ranges::contains( - _activeChats, - channel, - [](const auto &pair) { return pair.second.peer; })) { - channel->ptsWaitingForShortPoll(timeout + } else if (inActiveChats(channel)) { + channel->ptsSetWaitingForShortPoll(timeout ? (timeout * crl::time(1000)) : kWaitForChannelGetDifference); + } else { + channel->ptsSetWaitingForShortPoll(-1); } } @@ -743,16 +742,32 @@ void Updates::addActiveChat(rpl::producer chat) { std::move( chat ) | rpl::start_with_next_done([=](PeerData *peer) { - _activeChats[key].peer = peer; - if (const auto channel = peer ? peer->asChannel() : nullptr) { - channel->ptsWaitingForShortPoll( - kWaitForChannelGetDifference); + auto &active = _activeChats[key]; + const auto was = active.peer; + if (was != peer) { + active.peer = peer; + if (const auto channel = was ? was->asChannel() : nullptr) { + if (!inActiveChats(channel)) { + channel->ptsSetWaitingForShortPoll(-1); + } + } + if (const auto channel = peer ? peer->asChannel() : nullptr) { + channel->ptsSetWaitingForShortPoll( + kWaitForChannelGetDifference); + } } }, [=] { _activeChats.erase(key); }, _activeChats[key].lifetime); } +bool Updates::inActiveChats(not_null peer) const { + return ranges::contains( + _activeChats, + peer.get(), + [](const auto &pair) { return pair.second.peer; }); +} + void Updates::requestChannelRangeDifference(not_null history) { Expects(history->peer->isChannel()); diff --git a/Telegram/SourceFiles/api/api_updates.h b/Telegram/SourceFiles/api/api_updates.h index c028ae75a..654e36b51 100644 --- a/Telegram/SourceFiles/api/api_updates.h +++ b/Telegram/SourceFiles/api/api_updates.h @@ -63,6 +63,7 @@ public: void requestChannelRangeDifference(not_null history); void addActiveChat(rpl::producer chat); + [[nodiscard]] bool inActiveChats(not_null peer) const; private: enum class ChannelDifferenceRequest { diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 773558ca7..5ef4af3d6 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -2028,7 +2028,7 @@ void ApiWrap::deleteHistory( } if (const auto channel = peer->asChannel()) { if (!justClear && !revoke) { - channel->ptsWaitingForShortPoll(-1); + channel->ptsSetWaitingForShortPoll(-1); leaveChannel(channel); } else { if (const auto migrated = peer->migrateFrom()) { diff --git a/Telegram/SourceFiles/data/data_channel.h b/Telegram/SourceFiles/data/data_channel.h index 90f9e2b8d..90f3b9274 100644 --- a/Telegram/SourceFiles/data/data_channel.h +++ b/Telegram/SourceFiles/data/data_channel.h @@ -423,7 +423,7 @@ public: return _ptsWaiter.setRequesting(isRequesting); } // < 0 - not waiting - void ptsWaitingForShortPoll(int32 ms) { + void ptsSetWaitingForShortPoll(int32 ms) { return _ptsWaiter.setWaitingForShortPoll(this, ms); } [[nodiscard]] bool ptsWaitingForSkipped() const { From c9e0f50f0f2ab28d267ee44ccd2bbb6a145eb0fd Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 13 Sep 2024 17:57:56 +0400 Subject: [PATCH 4/7] Revert "Improved color of topic icon in TopicIconView." This reverts commit a38dcb6ee54975ee09ac63991013db2cf15df43f. --- Telegram/SourceFiles/info/profile/info_profile_cover.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp index f7326ea19..fc44bc946 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp @@ -133,7 +133,7 @@ void TopicIconView::paintInRect(QPainter &p, QRect rect) { if (_player && _player->ready()) { paint(_player->frame( st::infoTopicCover.photo.size, - st::windowFg->c, + QColor(0, 0, 0, 0), false, crl::now(), _paused()).image); From d0a8bd1f03afe802609d38e7e828c27eb3d8e947 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 13 Sep 2024 20:03:32 +0400 Subject: [PATCH 5/7] Use colored topic icons only when required. --- Telegram/SourceFiles/info/profile/info_profile_cover.cpp | 6 +++++- Telegram/SourceFiles/info/profile/info_profile_cover.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp index fc44bc946..3c6fc0e7f 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp @@ -131,9 +131,12 @@ void TopicIconView::paintInRect(QPainter &p, QRect rect) { image); }; if (_player && _player->ready()) { + const auto colored = _playerUsesTextColor + ? st::windowFg->c + : QColor(0, 0, 0, 0); paint(_player->frame( st::infoTopicCover.photo.size, - QColor(0, 0, 0, 0), + colored, false, crl::now(), _paused()).image); @@ -196,6 +199,7 @@ void TopicIconView::setupPlayer(not_null topic) { st::infoTopicCover.photo.size); } result->setRepaintCallback(_update); + _playerUsesTextColor = media->owner()->emojiUsesTextColor(); return result; }); }) | rpl::flatten_latest( diff --git a/Telegram/SourceFiles/info/profile/info_profile_cover.h b/Telegram/SourceFiles/info/profile/info_profile_cover.h index dec3e44ac..c4f5a73ae 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_cover.h +++ b/Telegram/SourceFiles/info/profile/info_profile_cover.h @@ -71,6 +71,7 @@ private: Fn _paused; Fn _update; std::shared_ptr _player; + bool _playerUsesTextColor = false; QImage _image; rpl::lifetime _lifetime; From 36962b8c624241e56aca28d684c47c39269e85a7 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 13 Sep 2024 21:03:21 +0400 Subject: [PATCH 6/7] Fix possible crash in swipe-to-reply. --- .../SourceFiles/history/view/history_view_replies_section.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp index 3e88f1d34..845b70fce 100644 --- a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp @@ -900,7 +900,8 @@ void RepliesWidget::setupSwipeReply() { return result; } const auto view = _inner->lookupItemByY(cursorTop); - if (!view->data()->isRegular() + if (!view + || !view->data()->isRegular() || view->data()->isService()) { return result; } From 98ba2c7ce4da95176d874f17943c248bb07b8538 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 13 Sep 2024 20:08:23 +0400 Subject: [PATCH 7/7] Version 5.5.5. - Suggest URL from clipboard when creating a custom link. - Fix animated topic icons in topic info page. - Fix excessive getChannelDifference requests. --- Telegram/Resources/uwp/AppX/AppxManifest.xml | 2 +- Telegram/Resources/winrc/Telegram.rc | 8 ++++---- Telegram/Resources/winrc/Updater.rc | 8 ++++---- Telegram/SourceFiles/core/version.h | 4 ++-- Telegram/build/version | 8 ++++---- changelog.txt | 6 ++++++ 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index dbaeaa5bf..3701e55ec 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -10,7 +10,7 @@ + Version="5.5.5.0" /> Telegram Desktop Telegram Messenger LLP diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 04f7e2f6a..5fd9701a1 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,5,4,0 - PRODUCTVERSION 5,5,4,0 + FILEVERSION 5,5,5,0 + PRODUCTVERSION 5,5,5,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -62,10 +62,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram FZ-LLC" VALUE "FileDescription", "Telegram Desktop" - VALUE "FileVersion", "5.5.4.0" + VALUE "FileVersion", "5.5.5.0" VALUE "LegalCopyright", "Copyright (C) 2014-2024" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "5.5.4.0" + VALUE "ProductVersion", "5.5.5.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index fa36c34ff..9a4d0451f 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,5,4,0 - PRODUCTVERSION 5,5,4,0 + FILEVERSION 5,5,5,0 + PRODUCTVERSION 5,5,5,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -53,10 +53,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram FZ-LLC" VALUE "FileDescription", "Telegram Desktop Updater" - VALUE "FileVersion", "5.5.4.0" + VALUE "FileVersion", "5.5.5.0" VALUE "LegalCopyright", "Copyright (C) 2014-2024" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "5.5.4.0" + VALUE "ProductVersion", "5.5.5.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 7f41fab91..e27216fad 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -22,7 +22,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 = 5005004; -constexpr auto AppVersionStr = "5.5.4"; +constexpr auto AppVersion = 5005005; +constexpr auto AppVersionStr = "5.5.5"; constexpr auto AppBetaVersion = false; constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; diff --git a/Telegram/build/version b/Telegram/build/version index 69b99552b..d4f4c170a 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,7 +1,7 @@ -AppVersion 5005004 +AppVersion 5005005 AppVersionStrMajor 5.5 -AppVersionStrSmall 5.5.4 -AppVersionStr 5.5.4 +AppVersionStrSmall 5.5.5 +AppVersionStr 5.5.5 BetaChannel 0 AlphaVersion 0 -AppVersionOriginal 5.5.4 +AppVersionOriginal 5.5.5 diff --git a/changelog.txt b/changelog.txt index 2bd1bca36..c4bc127b5 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ +5.5.5 (13.09.24) + +- Suggest URL from clipboard when creating a custom link. +- Fix animated topic icons in topic info page. +- Fix excessive getChannelDifference requests. + 5.5.4 (12.09.24) - Fix channel updates stopping after difference request failing.