From 308ade6a7e023533185f7b79ee372cd87c10e0aa Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 9 Mar 2025 06:55:25 +0400 Subject: [PATCH 01/17] Fix crash in some custom emoji cases. --- Telegram/lib_ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/lib_ui b/Telegram/lib_ui index b9ef54ad5..55fff1a85 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit b9ef54ad5eb6932930244f30a00ac9169cd09a46 +Subproject commit 55fff1a85b8d3f4962fe9d2133eb82409df2d8d8 From 45444253fd06b86b2c9f7729d151675b1478fe39 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 9 Mar 2025 09:44:47 +0400 Subject: [PATCH 02/17] Version 5.12.2. - Fix some crashes. --- 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 | 4 ++++ 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index 65aaca6cc..582c9745e 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -10,7 +10,7 @@ + Version="5.12.2.0" /> Telegram Desktop Telegram Messenger LLP diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 0371a5d90..b6a52676b 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,12,1,0 - PRODUCTVERSION 5,12,1,0 + FILEVERSION 5,12,2,0 + PRODUCTVERSION 5,12,2,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.12.1.0" + VALUE "FileVersion", "5.12.2.0" VALUE "LegalCopyright", "Copyright (C) 2014-2025" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "5.12.1.0" + VALUE "ProductVersion", "5.12.2.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index d84add4dc..978d491c3 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,12,1,0 - PRODUCTVERSION 5,12,1,0 + FILEVERSION 5,12,2,0 + PRODUCTVERSION 5,12,2,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.12.1.0" + VALUE "FileVersion", "5.12.2.0" VALUE "LegalCopyright", "Copyright (C) 2014-2025" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "5.12.1.0" + VALUE "ProductVersion", "5.12.2.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 08cc4d8ca..c90f1733c 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 = 5012001; -constexpr auto AppVersionStr = "5.12.1"; +constexpr auto AppVersion = 5012002; +constexpr auto AppVersionStr = "5.12.2"; constexpr auto AppBetaVersion = false; constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; diff --git a/Telegram/build/version b/Telegram/build/version index eac8b2553..161b802c9 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,7 +1,7 @@ -AppVersion 5012001 +AppVersion 5012002 AppVersionStrMajor 5.12 -AppVersionStrSmall 5.12.1 -AppVersionStr 5.12.1 +AppVersionStrSmall 5.12.2 +AppVersionStr 5.12.2 BetaChannel 0 AlphaVersion 0 -AppVersionOriginal 5.12.1 +AppVersionOriginal 5.12.2 diff --git a/changelog.txt b/changelog.txt index 9793a1e23..5a91f90ca 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +5.12.2 (09.03.25) + +- Fix some crashes. + 5.12.1 (08.03.25) - Fix a crash in some chat switchings. From 19d7dd7aa397184142c9fa916db52784d227a018 Mon Sep 17 00:00:00 2001 From: Kaiyang Wu Date: Sat, 8 Mar 2025 19:25:59 -0800 Subject: [PATCH 03/17] fix(integration_linux): include core_settings.h with Qt version <= 6.5.0 Signed-off-by: Kaiyang Wu --- Telegram/SourceFiles/platform/linux/integration_linux.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Telegram/SourceFiles/platform/linux/integration_linux.cpp b/Telegram/SourceFiles/platform/linux/integration_linux.cpp index e8696772e..e3e331cd7 100644 --- a/Telegram/SourceFiles/platform/linux/integration_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/integration_linux.cpp @@ -12,6 +12,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/platform/linux/base_linux_xdp_utilities.h" #include "core/sandbox.h" #include "core/application.h" +#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0) +#include "core/core_settings.h" +#endif #include "base/random.h" #include From 7d30e3913cfc4c31440bf70dc7c4b0e9b834a4cc Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 10 Mar 2025 00:33:44 +0400 Subject: [PATCH 04/17] Add lcms2 dependency for Qt6 on Windows --- Telegram/build/prepare/prepare.py | 19 ++++++++++++++++--- cmake | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Telegram/build/prepare/prepare.py b/Telegram/build/prepare/prepare.py index b78a14b66..b9ffb8acd 100644 --- a/Telegram/build/prepare/prepare.py +++ b/Telegram/build/prepare/prepare.py @@ -1148,10 +1148,19 @@ depends:yasm/yasm """) stage('liblcms2', """ -mac: git clone -b lcms2.16 https://github.com/mm2/Little-CMS.git liblcms2 cd liblcms2 - +win: +depends:python/Scripts/activate.bat + %THIRDPARTY_DIR%\\python\\Scripts\\activate.bat + meson setup --default-library=static --buildtype=debug -Db_vscrt=mtd out/Debug + meson compile -C out/Debug +release: + meson setup --default-library=static --buildtype=release -Db_vscrt=mt out/Release + meson compile -C out/Release +win: + deactivate +mac: buildOneArch() { arch=$1 folder=`pwd`/$2 @@ -1689,6 +1698,7 @@ win: SET OPENSSL_LIBS_DIR=%OPENSSL_DIR%\\out SET ZLIB_LIBS_DIR=%LIBS_DIR%\\zlib SET WEBP_DIR=%LIBS_DIR%\\libwebp + SET LCMS2_DIR=%LIBS_DIR%\\liblcms2 configure -prefix "%LIBS_DIR%\\Qt-%QT%" ^ %CONFIGURATIONS% ^ -force-debug-info ^ @@ -1726,7 +1736,10 @@ win: -D WebP_mux_INCLUDE_DIR="%WEBP_DIR%\\src" ^ -D WebP_LIBRARY="%WEBP_DIR%\\out\\release-static\\$X8664\\lib\\webp.lib" ^ -D WebP_demux_LIBRARY="%WEBP_DIR%\\out\\release-static\\$X8664\\lib\\webpdemux.lib" ^ - -D WebP_mux_LIBRARY="%WEBP_DIR%\\out\\release-static\\$X8664\\lib\\webpmux.lib" + -D WebP_mux_LIBRARY="%WEBP_DIR%\\out\\release-static\\$X8664\\lib\\webpmux.lib" ^ + -D LCMS2_FOUND=1 ^ + -D LCMS2_INCLUDE_DIR="%LCMS2_DIR%\\include" ^ + -D LCMS2_LIBRARIES="%LCMS2_DIR%\\out\Release\\src\\liblcms2.a" cmake --build . --config Debug --parallel cmake --install . --config Debug diff --git a/cmake b/cmake index 8c146a3ec..90e6d7310 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 8c146a3ec6f4475e5083eee84d126960495a7e1d +Subproject commit 90e6d73100a9fd2dc4c30a270c3bbc1d35924f32 From 9d591ae80619b72bcececcd25b91463749902bb7 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 10 Mar 2025 10:59:39 +0400 Subject: [PATCH 05/17] Fix infinite recursion in channel reactions edit. --- Telegram/SourceFiles/boxes/peers/edit_peer_reactions.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_reactions.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_reactions.cpp index 5313a2ae3..fdc31618f 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_reactions.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_reactions.cpp @@ -363,15 +363,17 @@ object_ptr AddReactionsSelector( const auto customEmojiPaused = [controller = args.controller] { return controller->isGifPausedAtLeastFor(PauseReason::Layer); }; - auto context = Core::TextContext({ + auto simpleContext = Core::TextContext({ .session = session, + .repaint = [=] { raw->update(); }, }); + auto context = simpleContext; context.customEmojiFactory = [=]( QStringView data, const Ui::Text::MarkedContext &context ) -> std::unique_ptr { const auto id = Data::ParseCustomEmojiData(data); - auto result = Ui::Text::MakeCustomEmoji(data, context); + auto result = Ui::Text::MakeCustomEmoji(data, simpleContext); if (state->unifiedFactoryOwner->lookupReactionId(id).custom()) { return std::make_unique( std::move(result), From 6bd2a7c962f064a3eb885c47f13e86a8c9160a70 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 10 Mar 2025 11:00:49 +0400 Subject: [PATCH 06/17] Fix possible crash in MediaGenericTextPart. --- .../history/view/media/history_view_media_generic.cpp | 2 +- Telegram/lib_ui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/view/media/history_view_media_generic.cpp b/Telegram/SourceFiles/history/view/media/history_view_media_generic.cpp index 3b70d6282..d27ef8816 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_media_generic.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_media_generic.cpp @@ -304,7 +304,7 @@ QSize MediaGenericTextPart::countCurrentSize(int newWidth) { const auto size = CountOptimalTextSize( _text, st::msgMinWidth, - newWidth - skip); + std::max(st::msgMinWidth, newWidth - skip)); return { size.width() + skip, _margins.top() + size.height() + _margins.bottom(), diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 55fff1a85..ba9696673 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 55fff1a85b8d3f4962fe9d2133eb82409df2d8d8 +Subproject commit ba969667301ae4d8da2c2f6c4528bea63443f607 From f56ddbb1e0b1f9e843d7d99fe475aaa7ba8a9bfa Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sat, 15 Feb 2025 01:22:07 +0300 Subject: [PATCH 07/17] Added recursive animation to lock hint while recording voice. --- .../history_view_voice_record_bar.cpp | 59 ++++++++++++++++++- .../controls/history_view_voice_record_bar.h | 1 + 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp index bcf5cf292..2f4cc7192 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.cpp @@ -1562,7 +1562,7 @@ void VoiceRecordBar::init() { if (value == 0. && !show) { _lock->hide(); } else if (value == 1. && show) { - computeAndSetLockProgress(QCursor::pos()); + _lock->requestPaintProgress(calcLockProgress(QCursor::pos())); } if (_fullRecord && !show) { updateTTLGeometry(TTLAnimationType::RightLeft, 1.); @@ -1867,6 +1867,52 @@ void VoiceRecordBar::startRecording() { _inField = true; + struct FloatingState { + Ui::Animations::Basic animation; + float64 animationProgress = 0; + float64 cursorProgress = 0; + bool lockCapturedByInput = false; + float64 frameCounter = 0; + rpl::lifetime lifetime; + }; + const auto stateOwned + = _recordingLifetime.make_state>( + std::make_unique()); + const auto state = stateOwned->get(); + + _lock->locks() | rpl::start_with_next([=] { + stateOwned->reset(); + }, state->lifetime); + + constexpr auto kAnimationThreshold = 0.35; + const auto calcStateRatio = [=](float64 counter) { + return (1 - std::cos(std::fmod(counter, 2 * M_PI))) * 0.5; + }; + state->animation.init([=](crl::time now) { + if (state->cursorProgress > kAnimationThreshold) { + state->lockCapturedByInput = true; + } + if (state->lockCapturedByInput) { + if (state->cursorProgress < 0.01) { + state->lockCapturedByInput = false; + state->frameCounter = 0; + } else { + _lock->requestPaintProgress(state->cursorProgress); + return; + } + } + const auto progress = anim::interpolateF( + state->cursorProgress, + kAnimationThreshold, + calcStateRatio(state->frameCounter)); + state->frameCounter += 0.01; + _lock->requestPaintProgress(progress); + }); + state->animation.start(); + if (hasDuration()) { + stateOwned->reset(); + } + _send->events( ) | rpl::filter([=](not_null e) { return (e->type() == QEvent::MouseMove @@ -1887,7 +1933,10 @@ void VoiceRecordBar::startRecording() { if (_showLockAnimation.animating() || !hasDuration()) { return; } - computeAndSetLockProgress(mouse->globalPos()); + const auto inputProgress = calcLockProgress(mouse->globalPos()); + if (inputProgress > state->animationProgress) { + state->cursorProgress = inputProgress; + } } else if (type == QEvent::MouseButtonRelease) { checkTipRequired(); stop(_inField.current()); @@ -2273,10 +2322,14 @@ float64 VoiceRecordBar::showListenAnimationRatio() const { } void VoiceRecordBar::computeAndSetLockProgress(QPoint globalPos) { + _lock->requestPaintProgress(calcLockProgress(globalPos)); +} + +float64 VoiceRecordBar::calcLockProgress(QPoint globalPos) { const auto localPos = mapFromGlobal(globalPos); const auto lower = _lock->height(); const auto higher = 0; - _lock->requestPaintProgress(Progress(localPos.y(), higher - lower)); + return Progress(localPos.y(), higher - lower); } bool VoiceRecordBar::peekTTLState() const { diff --git a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.h b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.h index c1a9ff4a7..7a01c8563 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.h +++ b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_bar.h @@ -156,6 +156,7 @@ private: [[nodiscard]] float64 activeAnimationRatio() const; void computeAndSetLockProgress(QPoint globalPos); + [[nodiscard]] float64 calcLockProgress(QPoint globalPos); [[nodiscard]] bool peekTTLState() const; [[nodiscard]] bool takeTTLState() const; From 5fb002ab4cdd06157e6231ef4f79177be4b8cc90 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sat, 15 Feb 2025 19:08:35 +0300 Subject: [PATCH 08/17] Added ability to specify time when export data. --- .../export/view/export_view_settings.cpp | 137 +++++++++++++++++- Telegram/SourceFiles/ui/boxes/choose_time.cpp | 12 +- Telegram/SourceFiles/ui/boxes/choose_time.h | 3 +- 3 files changed, 145 insertions(+), 7 deletions(-) diff --git a/Telegram/SourceFiles/export/view/export_view_settings.cpp b/Telegram/SourceFiles/export/view/export_view_settings.cpp index fdb61a799..bc25b6039 100644 --- a/Telegram/SourceFiles/export/view/export_view_settings.cpp +++ b/Telegram/SourceFiles/export/view/export_view_settings.cpp @@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/layers/generic_box.h" #include "ui/text/text_utilities.h" #include "ui/boxes/calendar_box.h" +#include "ui/boxes/choose_time.h" #include "platform/platform_specific.h" #include "core/application.h" #include "core/file_utilities.h" @@ -388,7 +389,7 @@ void SettingsWidget::addFormatAndLocationLabel( void SettingsWidget::addLimitsLabel( not_null container) { - auto fromLink = value() | rpl::map([](const Settings &data) { + auto fromDateLink = value() | rpl::map([](const Settings &data) { return data.singlePeerFrom; }) | rpl::distinct_until_changed( ) | rpl::map([](TimeId from) { @@ -399,7 +400,34 @@ void SettingsWidget::addLimitsLabel( ) | Ui::Text::ToLink(u"internal:edit_from"_q); }) | rpl::flatten_latest(); - auto tillLink = value() | rpl::map([](const Settings &data) { + const auto mapToTime = [](TimeId id, const QString &link) { + return rpl::single(id + ? QLocale().toString( + base::unixtime::parse(id).time(), + QLocale::ShortFormat) + : QString() + ) | Ui::Text::ToLink(link); + }; + + const auto concat = [](TextWithEntities date, TextWithEntities link) { + return link.text.isEmpty() + ? date + : date.append(u", "_q).append(std::move(link)); + }; + + auto fromTimeLink = value() | rpl::map([](const Settings &data) { + return data.singlePeerFrom; + }) | rpl::distinct_until_changed( + ) | rpl::map([=](TimeId from) { + return mapToTime(from, u"internal:edit_from_time"_q); + }) | rpl::flatten_latest(); + + auto fromLink = rpl::combine( + std::move(fromDateLink), + std::move(fromTimeLink) + ) | rpl::map(concat); + + auto tillDateLink = value() | rpl::map([](const Settings &data) { return data.singlePeerTill; }) | rpl::distinct_until_changed( ) | rpl::map([](TimeId till) { @@ -410,6 +438,18 @@ void SettingsWidget::addLimitsLabel( ) | Ui::Text::ToLink(u"internal:edit_till"_q); }) | rpl::flatten_latest(); + auto tillTimeLink = value() | rpl::map([](const Settings &data) { + return data.singlePeerTill; + }) | rpl::distinct_until_changed( + ) | rpl::map([=](TimeId till) { + return mapToTime(till, u"internal:edit_till_time"_q); + }) | rpl::flatten_latest(); + + auto tillLink = rpl::combine( + std::move(tillDateLink), + std::move(tillTimeLink) + ) | rpl::map(concat); + auto datesText = tr::lng_export_limits( lt_from, std::move(fromLink), @@ -424,8 +464,47 @@ void SettingsWidget::addLimitsLabel( object_ptr( container, std::move(datesText), - st::exportLocationLabel), + st::boxLabel), st::exportLimitsPadding); + + const auto removeTime = [](TimeId dateTime) { + return base::unixtime::serialize( + QDateTime( + base::unixtime::parse(dateTime).date(), + QTime())); + }; + + const auto editTimeLimit = [=](Fn now, Fn done) { + _showBoxCallback(Box([=](not_null box) { + auto result = Ui::ChooseTimeWidget( + box->verticalLayout(), + [&] { + const auto time = base::unixtime::parse(now()).time(); + return time.hour() * 3600 + + time.minute() * 60 + + time.second(); + }(), + true); + const auto widget = box->addRow(std::move(result.widget)); + const auto toSave = widget->lifetime().make_state(0); + std::move( + result.secondsValue + ) | rpl::start_with_next([=](TimeId t) { + *toSave = t; + }, box->lifetime()); + box->addButton(tr::lng_settings_save(), [=] { + done(*toSave); + box->closeBox(); + }); + box->addButton(tr::lng_cancel(), [=] { + box->closeBox(); + }); + box->setTitle(tr::lng_settings_ttl_after_custom()); + })); + }; + + constexpr auto kOffset = 600; + label->overrideLinkClickHandler([=](const QString &url) { if (url == u"internal:edit_from"_q) { const auto done = [=](TimeId limit) { @@ -439,10 +518,38 @@ void SettingsWidget::addLimitsLabel( readData().singlePeerTill, tr::lng_export_from_beginning(), done); + } else if (url == u"internal:edit_from_time"_q) { + const auto now = [=] { + auto result = TimeId(0); + changeData([&](Settings &settings) { + result = settings.singlePeerFrom; + }); + return result; + }; + const auto done = [=](TimeId time) { + changeData([&](Settings &settings) { + const auto result = time + + removeTime(settings.singlePeerFrom); + if (result >= settings.singlePeerTill + && settings.singlePeerTill) { + settings.singlePeerFrom = settings.singlePeerTill + - kOffset; + } else { + settings.singlePeerFrom = result; + } + }); + }; + editTimeLimit(now, done); } else if (url == u"internal:edit_till"_q) { const auto done = [=](TimeId limit) { changeData([&](Settings &settings) { - settings.singlePeerTill = limit; + if (limit <= settings.singlePeerFrom + && settings.singlePeerFrom) { + settings.singlePeerTill = settings.singlePeerFrom + + kOffset; + } else { + settings.singlePeerTill = limit; + } }); }; editDateLimit( @@ -451,6 +558,28 @@ void SettingsWidget::addLimitsLabel( 0, tr::lng_export_till_end(), done); + } else if (url == u"internal:edit_till_time"_q) { + const auto now = [=] { + auto result = TimeId(0); + changeData([&](Settings &settings) { + result = settings.singlePeerTill; + }); + return result; + }; + const auto done = [=](TimeId time) { + changeData([&](Settings &settings) { + const auto result = time + + removeTime(settings.singlePeerTill); + if (result <= settings.singlePeerFrom + && settings.singlePeerFrom) { + settings.singlePeerTill = settings.singlePeerFrom + + kOffset; + } else { + settings.singlePeerTill = result; + } + }); + }; + editTimeLimit(now, done); } else { Unexpected("Click handler URL in export limits edit."); } diff --git a/Telegram/SourceFiles/ui/boxes/choose_time.cpp b/Telegram/SourceFiles/ui/boxes/choose_time.cpp index 488c1c0d3..aa7f2836e 100644 --- a/Telegram/SourceFiles/ui/boxes/choose_time.cpp +++ b/Telegram/SourceFiles/ui/boxes/choose_time.cpp @@ -18,7 +18,8 @@ namespace Ui { ChooseTimeResult ChooseTimeWidget( not_null parent, - TimeId startSeconds) { + TimeId startSeconds, + bool hiddenDaysInput) { using TimeField = Ui::TimePartWithPlaceholder; const auto putNext = [](not_null field, QChar ch) { field->setCursorPosition(0); @@ -79,6 +80,10 @@ ChooseTimeResult ChooseTimeWidget( const auto hour = Ui::MakeWeak(state->hour); const auto minute = Ui::MakeWeak(state->minute); + if (hiddenDaysInput) { + day->setVisible(false); + } + day->setPhrase(tr::lng_days); day->setMaxValue(31); day->setWheelStep(1); @@ -105,13 +110,16 @@ ChooseTimeResult ChooseTimeWidget( content->sizeValue( ) | rpl::start_with_next([=](const QSize &s) { - const auto inputWidth = s.width() / 3; + const auto inputWidth = s.width() / (hiddenDaysInput ? 2 : 3); auto rect = QRect( 0, (s.height() - day->height()) / 2, inputWidth, day->height()); for (const auto &input : { day, hour, minute }) { + if (input->isHidden()) { + continue; + } input->setGeometry(rect - st::muteBoxTimeFieldPadding); rect.translate(inputWidth, 0); } diff --git a/Telegram/SourceFiles/ui/boxes/choose_time.h b/Telegram/SourceFiles/ui/boxes/choose_time.h index ca25710cf..d2f7f1ee7 100644 --- a/Telegram/SourceFiles/ui/boxes/choose_time.h +++ b/Telegram/SourceFiles/ui/boxes/choose_time.h @@ -20,6 +20,7 @@ struct ChooseTimeResult { ChooseTimeResult ChooseTimeWidget( not_null parent, - TimeId startSeconds); + TimeId startSeconds, + bool hiddenDaysInput = false); } // namespace Ui From 15bcfeec1d4ec9084167e92f62c28d05ecafe0b3 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 16 Feb 2025 22:13:05 +0300 Subject: [PATCH 09/17] Added pause to animation of custom emoji in status info. --- .../SourceFiles/history/view/history_view_contact_status.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Telegram/SourceFiles/history/view/history_view_contact_status.cpp b/Telegram/SourceFiles/history/view/history_view_contact_status.cpp index 71e711ad0..13e5ce678 100644 --- a/Telegram/SourceFiles/history/view/history_view_contact_status.cpp +++ b/Telegram/SourceFiles/history/view/history_view_contact_status.cpp @@ -308,6 +308,9 @@ void ContactStatus::Bar::showState( _emojiStatusInfo->entity()->overrideLinkClickHandler([=] { _emojiStatusClicks.fire({}); }); + _emojiStatusInfo->entity()->setAnimationsPausedCallback([] { + return Ui::FlatLabel::WhichAnimationsPaused::CustomEmoji; + }); } _emojiStatusInfo->setVisible(has); _add->setText((type == Type::Add) From feaeef6482df02a8581d92351cec1d6c37eeb838 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 9 Mar 2025 03:37:52 +0300 Subject: [PATCH 10/17] Fixed repaint of send button when it has slowmode countdown. --- Telegram/SourceFiles/ui/controls/send_button.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/ui/controls/send_button.cpp b/Telegram/SourceFiles/ui/controls/send_button.cpp index 67c74b81f..14e8e1192 100644 --- a/Telegram/SourceFiles/ui/controls/send_button.cpp +++ b/Telegram/SourceFiles/ui/controls/send_button.cpp @@ -72,8 +72,8 @@ void SendButton::setState(State state) { st::universalDuration); setPointerCursor(_state.type != Type::Slowmode); updateSize(); - update(); } + update(); } void SendButton::finishAnimating() { From 7da0124286dc738c436098c9e694314b8ed7f20a Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 9 Mar 2025 00:13:23 +0300 Subject: [PATCH 11/17] Moved out lambda to jump to near chats filters to static function. --- .../dialogs/dialogs_inner_widget.cpp | 27 +++---------------- .../window/window_session_controller.cpp | 26 ++++++++++++++++++ .../window/window_session_controller.h | 5 ++++ 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 42e67637b..39e047897 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -4893,33 +4893,14 @@ void InnerWidget::setupShortcuts() { }); } - const auto nearFolder = [=](bool isNext) { - const auto id = _controller->activeChatsFilterCurrent(); - const auto list = &session().data().chatsFilters().list(); - const auto index = int(ranges::find( - *list, - id, - &Data::ChatFilter::id - ) - begin(*list)); - if (index == list->size() && id != 0) { - return false; - } - const auto changed = index + (isNext ? 1 : -1); - if (changed >= int(list->size()) || changed < 0) { - return false; - } - _controller->setActiveChatsFilter((changed >= 0) - ? (*list)[changed].id() - : 0); - return true; - }; - request->check(Command::FolderNext) && request->handle([=] { - return nearFolder(true); + using namespace Window; + return CheckAndJumpToNearChatsFilter(_controller, true, true); }); request->check(Command::FolderPrevious) && request->handle([=] { - return nearFolder(false); + using namespace Window; + return CheckAndJumpToNearChatsFilter(_controller, false, true); }); request->check(Command::ReadChat) && request->handle([=] { diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index 18783480e..e4fb08619 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -3244,4 +3244,30 @@ SessionController::~SessionController() { resetFakeUnreadWhileOpened(); } +bool CheckAndJumpToNearChatsFilter( + not_null controller, + bool isNext, + bool jump) { + const auto id = controller->activeChatsFilterCurrent(); + const auto list = &controller->session().data().chatsFilters().list(); + const auto index = int(ranges::find( + *list, + id, + &Data::ChatFilter::id + ) - begin(*list)); + if (index == list->size() && id != 0) { + return false; + } + const auto changed = index + (isNext ? 1 : -1); + if (changed >= int(list->size()) || changed < 0) { + return false; + } + if (jump) { + controller->setActiveChatsFilter((changed >= 0) + ? (*list)[changed].id() + : 0); + } + return true; +} + } // namespace Window diff --git a/Telegram/SourceFiles/window/window_session_controller.h b/Telegram/SourceFiles/window/window_session_controller.h index e4a53672e..afc847e3f 100644 --- a/Telegram/SourceFiles/window/window_session_controller.h +++ b/Telegram/SourceFiles/window/window_session_controller.h @@ -757,4 +757,9 @@ void ActivateWindow(not_null controller); not_null controller, GifPauseReason level); +bool CheckAndJumpToNearChatsFilter( + not_null controller, + bool isNext, + bool jump); + } // namespace Window From 2b43f2682ad601ef934fb1fc68c9b779b341340e Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 9 Mar 2025 02:12:54 +0300 Subject: [PATCH 12/17] Fixed open of locked chats filter with shortcuts to open near filters. --- Telegram/SourceFiles/window/window_session_controller.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index e4fb08619..6b8abba7a 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -49,6 +49,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_chat_filters.h" #include "data/data_replies_list.h" #include "data/data_peer_values.h" +#include "data/data_premium_limits.h" #include "data/data_web_page.h" #include "passport/passport_form_controller.h" #include "chat_helpers/tabbed_selector.h" @@ -3249,7 +3250,8 @@ bool CheckAndJumpToNearChatsFilter( bool isNext, bool jump) { const auto id = controller->activeChatsFilterCurrent(); - const auto list = &controller->session().data().chatsFilters().list(); + const auto session = &controller->session(); + const auto list = &session->data().chatsFilters().list(); const auto index = int(ranges::find( *list, id, @@ -3262,6 +3264,9 @@ bool CheckAndJumpToNearChatsFilter( if (changed >= int(list->size()) || changed < 0) { return false; } + if (changed > Data::PremiumLimits(session).dialogFiltersCurrent()) { + return false; + } if (jump) { controller->setActiveChatsFilter((changed >= 0) ? (*list)[changed].id() From 4b2c5b33210afcacb2014dc9f884fb18af5f4e95 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 9 Mar 2025 02:38:15 +0300 Subject: [PATCH 13/17] Removed chat filters strip from folders and forums in separated windows. --- Telegram/SourceFiles/dialogs/dialogs_widget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index 752e431a9..b7f0605fb 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -1333,6 +1333,9 @@ void Widget::toggleFiltersMenu(bool enabled) { if (_layout == Layout::Child) { enabled = false; } + if (const auto id = controller()->windowId(); id.forum() || id.folder()) { + enabled = false; + } if (!enabled == !_chatFilters) { return; } else if (enabled) { From b843f91b3c94273846b3eec38194baf6e4024aa4 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 10 Mar 2025 11:52:42 +0400 Subject: [PATCH 14/17] Support 'FT' "country" flag emoji. --- Telegram/SourceFiles/countries/countries_instance.cpp | 3 +++ Telegram/SourceFiles/history/view/history_view_about_view.cpp | 1 + Telegram/SourceFiles/ui/chat/chat.style | 1 + 3 files changed, 5 insertions(+) diff --git a/Telegram/SourceFiles/countries/countries_instance.cpp b/Telegram/SourceFiles/countries/countries_instance.cpp index ba159016d..d9ef7c3c7 100644 --- a/Telegram/SourceFiles/countries/countries_instance.cpp +++ b/Telegram/SourceFiles/countries/countries_instance.cpp @@ -322,6 +322,9 @@ QString CountriesInstance::flagEmojiByISO2(const QString &iso) const { || iso.back() < 'A' || iso.back() > 'Z') { return QString(); + } else if (iso == u"FT"_q) { + return QString::fromUtf8( + "\xF0\x9F\x8F\xB4\xE2\x80\x8D\xE2\x98\xA0\xEF\xB8\x8F"); } auto result = QString(4, QChar(0xD83C)); result[1] = QChar(iso.front().unicode() - 'A' + 0xDDE6); diff --git a/Telegram/SourceFiles/history/view/history_view_about_view.cpp b/Telegram/SourceFiles/history/view/history_view_about_view.cpp index d2ad1b735..486bcd984 100644 --- a/Telegram/SourceFiles/history/view/history_view_about_view.cpp +++ b/Telegram/SourceFiles/history/view/history_view_about_view.cpp @@ -748,6 +748,7 @@ AdminLog::OwnedItem AboutView::makeNewPeerInfo(not_null user) { owned.get(), GenerateNewPeerInfo(owned.get(), _item.get(), user, _commonGroups), HistoryView::MediaGenericDescriptor{ + .maxWidth = st::newPeerWidth, .service = true, .hideServiceText = true, })); diff --git a/Telegram/SourceFiles/ui/chat/chat.style b/Telegram/SourceFiles/ui/chat/chat.style index eba8783e0..1b0c786e9 100644 --- a/Telegram/SourceFiles/ui/chat/chat.style +++ b/Telegram/SourceFiles/ui/chat/chat.style @@ -1244,3 +1244,4 @@ newPeerUserpics: GroupCallUserpics { align: align(left); } newPeerUserpicsPadding: margins(0px, 3px, 0px, 0px); +newPeerWidth: 320px; From 08c07a0785cd07cad364a2c42705db633848b6a7 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 10 Mar 2025 11:57:20 +0400 Subject: [PATCH 15/17] Don't remove last gift on unpin if all loaded. --- .../SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp b/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp index 6bbde5e05..683501acf 100644 --- a/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp +++ b/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp @@ -274,7 +274,10 @@ void InnerWidget::markUnpinned(std::vector::iterator i) { } ++after; } - if (after == _entries.size()) { + if (after == _entries.size() && !_allLoaded) { + // We don't know if the correct position is exactly in the end + // of the loaded part or later, so we hide it for now, let it + // be loaded later while scrolling. _entries.erase(i); } else if (after > index + 1) { std::rotate(i, i + 1, begin(_entries) + after); From f024ceecdd91fb0af500a82f2777523f42941000 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 10 Mar 2025 11:58:20 +0400 Subject: [PATCH 16/17] Version 5.12.3. - Fix a couple more crashes. - Fix gift disappearing on unpin. - Fix country emoji for Fragment numbers. --- 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 582c9745e..990e326bf 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -10,7 +10,7 @@ + Version="5.12.3.0" /> Telegram Desktop Telegram Messenger LLP diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index b6a52676b..4821d7472 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,12,2,0 - PRODUCTVERSION 5,12,2,0 + FILEVERSION 5,12,3,0 + PRODUCTVERSION 5,12,3,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.12.2.0" + VALUE "FileVersion", "5.12.3.0" VALUE "LegalCopyright", "Copyright (C) 2014-2025" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "5.12.2.0" + VALUE "ProductVersion", "5.12.3.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index 978d491c3..cfe223bde 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,12,2,0 - PRODUCTVERSION 5,12,2,0 + FILEVERSION 5,12,3,0 + PRODUCTVERSION 5,12,3,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.12.2.0" + VALUE "FileVersion", "5.12.3.0" VALUE "LegalCopyright", "Copyright (C) 2014-2025" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "5.12.2.0" + VALUE "ProductVersion", "5.12.3.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index c90f1733c..dbe866b0b 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 = 5012002; -constexpr auto AppVersionStr = "5.12.2"; +constexpr auto AppVersion = 5012003; +constexpr auto AppVersionStr = "5.12.3"; constexpr auto AppBetaVersion = false; constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; diff --git a/Telegram/build/version b/Telegram/build/version index 161b802c9..c1be45cdc 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,7 +1,7 @@ -AppVersion 5012002 +AppVersion 5012003 AppVersionStrMajor 5.12 -AppVersionStrSmall 5.12.2 -AppVersionStr 5.12.2 +AppVersionStrSmall 5.12.3 +AppVersionStr 5.12.3 BetaChannel 0 AlphaVersion 0 -AppVersionOriginal 5.12.2 +AppVersionOriginal 5.12.3 diff --git a/changelog.txt b/changelog.txt index 5a91f90ca..d3d5d42d0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ +5.12.3 (10.03.25) + +- Fix a couple more crashes. +- Fix gift disappearing on unpin. +- Fix country emoji for Fragment numbers. + 5.12.2 (09.03.25) - Fix some crashes. From 11d0f9db0392e17c9d07476386d95e413f869839 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 10 Mar 2025 13:32:36 +0400 Subject: [PATCH 17/17] Try fixing crashes on Linux. --- .../platform/linux/notifications_manager_linux.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index b41d0e4a9..47b92fb72 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -423,7 +423,8 @@ void Manager::Private::init(XdgNotifications::NotificationsProxy proxy) { Core::Sandbox::Instance().customEnterFromEventLoop([&] { for (const auto &[key, notifications] : _notifications) { for (const auto &[msgId, notification] : notifications) { - if (id == v::get(notification->id)) { + const auto &nid = notification->id; + if (v::is(nid) && v::get(nid) == id) { if (actionName == "default") { _manager->notificationActivated({ key, msgId }); } else if (actionName == "mail-mark-read") { @@ -447,7 +448,8 @@ void Manager::Private::init(XdgNotifications::NotificationsProxy proxy) { Core::Sandbox::Instance().customEnterFromEventLoop([&] { for (const auto &[key, notifications] : _notifications) { for (const auto &[msgId, notification] : notifications) { - if (id == v::get(notification->id)) { + const auto &nid = notification->id; + if (v::is(nid) && v::get(nid) == id) { _manager->notificationReplied( { key, msgId }, { QString::fromStdString(text), {} }); @@ -468,7 +470,8 @@ void Manager::Private::init(XdgNotifications::NotificationsProxy proxy) { std::string token) { for (const auto &[key, notifications] : _notifications) { for (const auto &[msgId, notification] : notifications) { - if (id == v::get(notification->id)) { + const auto &nid = notification->id; + if (v::is(nid) && v::get(nid) == id) { GLib::setenv("XDG_ACTIVATION_TOKEN", token, true); return; } @@ -501,7 +504,8 @@ void Manager::Private::init(XdgNotifications::NotificationsProxy proxy) { * In all other cases we keep the notification reference so that we may clear the notification later from history, * if the message for that notification is read (e.g. chat is opened or read from another device). */ - if (id == v::get(notification->id) && reason == 2) { + const auto &nid = notification->id; + if (v::is(nid) && v::get(nid) == id && reason == 2) { clearNotification({ key, msgId }); return; }