diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index 6de53f12d..d08d5824d 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -42,7 +42,7 @@ jobs: windows: name: Windows - runs-on: windows-2022 + runs-on: windows-latest strategy: matrix: @@ -94,6 +94,14 @@ jobs: nuget sources Disable -Name "Microsoft Visual Studio Offline Packages" nuget sources Add -Source https://api.nuget.org/v3/index.json & exit 0 + - name: ThirdParty cache. + id: cache-third-party + uses: actions/cache@v4 + with: + path: ${{ env.TBUILD }}\ThirdParty + key: ${{ runner.OS }}-${{ matrix.arch }}-third-party-${{ env.CACHE_KEY }} + restore-keys: ${{ runner.OS }}-${{ matrix.arch }}-third-party- + - name: Libraries cache. id: cache-libs uses: actions/cache@v4 diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index 313287557..dbaeaa5bf 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -10,7 +10,7 @@ + Version="5.5.4.0" /> Telegram Desktop Telegram Messenger LLP diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index e951e095d..921915532 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,3,0 - PRODUCTVERSION 5,5,3,0 + FILEVERSION 5,5,4,0 + PRODUCTVERSION 5,5,4,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -62,10 +62,10 @@ BEGIN BEGIN VALUE "CompanyName", "Radolyn Labs" VALUE "FileDescription", "AyuGram Desktop" - VALUE "FileVersion", "5.5.3.0" + VALUE "FileVersion", "5.5.4.0" VALUE "LegalCopyright", "Copyright (C) 2014-2024" VALUE "ProductName", "AyuGram Desktop" - VALUE "ProductVersion", "5.5.3.0" + VALUE "ProductVersion", "5.5.4.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index 3d9366819..18158d73e 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,3,0 - PRODUCTVERSION 5,5,3,0 + FILEVERSION 5,5,4,0 + PRODUCTVERSION 5,5,4,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -53,10 +53,10 @@ BEGIN BEGIN VALUE "CompanyName", "Radolyn Labs" VALUE "FileDescription", "AyuGram Desktop Updater" - VALUE "FileVersion", "5.5.3.0" + VALUE "FileVersion", "5.5.4.0" VALUE "LegalCopyright", "Copyright (C) 2014-2024" VALUE "ProductName", "AyuGram Desktop" - VALUE "ProductVersion", "5.5.3.0" + VALUE "ProductVersion", "5.5.4.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/api/api_updates.cpp b/Telegram/SourceFiles/api/api_updates.cpp index a720dacce..897b03d66 100644 --- a/Telegram/SourceFiles/api/api_updates.cpp +++ b/Telegram/SourceFiles/api/api_updates.cpp @@ -659,6 +659,7 @@ void Updates::getDifferenceAfterFail() { wait = wait ? std::min(wait, i->second - now) : (i->second - now); ++i; } else { + i->first->ptsSetRequesting(false); getChannelDifference(i->first, ChannelDifferenceRequest::AfterFail); i = _whenGetDiffAfterFail.erase(i); } @@ -707,7 +708,9 @@ void Updates::getChannelDifference( _whenGetDiffByPts.remove(channel); } - if (!channel->ptsInited() || channel->ptsRequesting()) return; + if (!channel->ptsInited() || channel->ptsRequesting()) { + return; + } if (from != ChannelDifferenceRequest::AfterFail) { _whenGetDiffAfterFail.remove(channel); @@ -1562,6 +1565,7 @@ void Updates::feedUpdate(const MTPUpdate &update) { } if (channel && !_handlingChannelDifference) { if (channel->ptsRequesting()) { // skip global updates while getting channel difference + MTP_LOG(0, ("Skipping new channel message because getting the difference.")); return; } channel->ptsUpdateAndApply(d.vpts().v, d.vpts_count().v, update); @@ -1654,6 +1658,7 @@ void Updates::feedUpdate(const MTPUpdate &update) { if (channel && !_handlingChannelDifference) { if (channel->ptsRequesting()) { // skip global updates while getting channel difference + MTP_LOG(0, ("Skipping channel message edit because getting the difference.")); return; } else { channel->ptsUpdateAndApply(d.vpts().v, d.vpts_count().v, update); @@ -1669,6 +1674,7 @@ void Updates::feedUpdate(const MTPUpdate &update) { if (channel && !_handlingChannelDifference) { if (channel->ptsRequesting()) { // skip global updates while getting channel difference + MTP_LOG(0, ("Skipping pinned channel messages because getting the difference.")); return; } else { channel->ptsUpdateAndApply(d.vpts().v, d.vpts_count().v, update); @@ -1783,6 +1789,7 @@ void Updates::feedUpdate(const MTPUpdate &update) { if (channel && !_handlingChannelDifference) { if (channel->ptsRequesting()) { // skip global updates while getting channel difference + MTP_LOG(0, ("Skipping delete channel messages because getting the difference.")); return; } channel->ptsUpdateAndApply(d.vpts().v, d.vpts_count().v, update); @@ -1846,6 +1853,7 @@ void Updates::feedUpdate(const MTPUpdate &update) { auto channel = session().data().channelLoaded(d.vchannel_id()); if (channel && !_handlingChannelDifference) { if (channel->ptsRequesting()) { // skip global updates while getting channel difference + MTP_LOG(0, ("Skipping channel web page update because getting the difference.")); return; } else { channel->ptsUpdateAndApply(d.vpts().v, d.vpts_count().v, update); diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 5fa6798bc..6a3072e98 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -22,7 +22,7 @@ constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D666}"_cs; constexpr auto AppNameOld = "AyuGram for Windows"_cs; constexpr auto AppName = "AyuGram Desktop"_cs; constexpr auto AppFile = "AyuGram"_cs; -constexpr auto AppVersion = 5005003; -constexpr auto AppVersionStr = "5.5.3"; +constexpr auto AppVersion = 5005004; +constexpr auto AppVersionStr = "5.5.4"; constexpr auto AppBetaVersion = false; constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; diff --git a/Telegram/SourceFiles/data/data_media_types.cpp b/Telegram/SourceFiles/data/data_media_types.cpp index 2298ddcfb..79266a509 100644 --- a/Telegram/SourceFiles/data/data_media_types.cpp +++ b/Telegram/SourceFiles/data/data_media_types.cpp @@ -1726,6 +1726,10 @@ MediaWebPageFlags MediaWebPage::webpageFlags() const { return _flags; } +Storage::SharedMediaTypesMask MediaWebPage::sharedMediaTypes() const { + return Storage::SharedMediaType::Link; +} + bool MediaWebPage::hasReplyPreview() const { if (const auto document = MediaWebPage::document()) { return document->hasThumbnail() diff --git a/Telegram/SourceFiles/data/data_media_types.h b/Telegram/SourceFiles/data/data_media_types.h index b7be891bd..7bcaeb6fb 100644 --- a/Telegram/SourceFiles/data/data_media_types.h +++ b/Telegram/SourceFiles/data/data_media_types.h @@ -446,6 +446,8 @@ public: WebPageData *webpage() const override; MediaWebPageFlags webpageFlags() const override; + Storage::SharedMediaTypesMask sharedMediaTypes() const override; + bool hasReplyPreview() const override; Image *replyPreview() const override; bool replyPreviewLoaded() const override; diff --git a/Telegram/SourceFiles/history/history_view_swipe.cpp b/Telegram/SourceFiles/history/history_view_swipe.cpp index 041664e87..cca7a4daa 100644 --- a/Telegram/SourceFiles/history/history_view_swipe.cpp +++ b/Telegram/SourceFiles/history/history_view_swipe.cpp @@ -191,7 +191,7 @@ void SetupSwipeHandler( const auto t = static_cast(e.get()); const auto touchscreen = t->device() && (t->device()->type() == base::TouchDevice::TouchScreen); - if (!Platform::IsMac() && !touchscreen) { + if (/*!Platform::IsMac() && */!touchscreen) { break; } else if (type == QEvent::TouchBegin) { // Reset state in case we lost some TouchEnd. @@ -235,6 +235,7 @@ void SetupSwipeHandler( case QEvent::Wheel: { const auto w = static_cast(e.get()); const auto phase = w->phase(); +#if 0 #ifdef Q_OS_MAC if (phase == Qt::ScrollBegin) { state->twoFingerScrollStarted = true; @@ -246,7 +247,8 @@ void SetupSwipeHandler( state->twoFingerScrollStarted = false; } #endif // Q_OS_MAC - if (Platform::IsMac() || phase == Qt::NoScrollPhase) { +#endif + if (/*Platform::IsMac() || */phase == Qt::NoScrollPhase) { break; } else if (phase == Qt::ScrollBegin) { // Reset state in case we lost some TouchEnd. diff --git a/Telegram/SourceFiles/info/info.style b/Telegram/SourceFiles/info/info.style index 158f222d2..d56f0fecd 100644 --- a/Telegram/SourceFiles/info/info.style +++ b/Telegram/SourceFiles/info/info.style @@ -169,6 +169,13 @@ infoTopBarCall: IconButton(infoTopBarMenu) { iconPosition: point(5px, -1px); rippleAreaPosition: point(0px, 6px); } +infoTopBarQr: IconButton(infoTopBarMenu) { + width: 52px; + icon: icon {{ "menu/qr_code", boxTitleCloseFg }}; + iconOver: icon {{ "menu/qr_code", boxTitleCloseFgOver }}; + iconPosition: point(9px, -1px); + rippleAreaPosition: point(0px, 6px); +} infoTopBarForward: IconButton(infoTopBarBack) { width: 46px; icon: icon {{ "info/info_media_forward", boxTitleCloseFg }}; @@ -262,6 +269,12 @@ infoLayerTopBarCall: IconButton(infoLayerTopBarMenu) { iconOver: icon {{ "top_bar_call", boxTitleCloseFgOver }}; iconPosition: point(3px, -1px); } +infoLayerTopBarQr: IconButton(infoLayerTopBarClose) { + width: 40px; + icon: icon {{ "menu/qr_code", boxTitleCloseFg }}; + iconOver: icon {{ "menu/qr_code", boxTitleCloseFgOver }}; + iconPosition: point(8px, -1px); +} infoLayerTopBarForward: IconButton(infoLayerTopBarBack) { width: 45px; icon: icon {{ "info/info_media_forward", boxTitleCloseFg }}; diff --git a/Telegram/SourceFiles/info/info_wrap_widget.cpp b/Telegram/SourceFiles/info/info_wrap_widget.cpp index 51d06218c..59c15978f 100644 --- a/Telegram/SourceFiles/info/info_wrap_widget.cpp +++ b/Telegram/SourceFiles/info/info_wrap_widget.cpp @@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "info/info_top_bar.h" #include "settings/cloud_password/settings_cloud_password_email_confirm.h" #include "settings/settings_chat.h" +#include "settings/settings_information.h" #include "settings/settings_main.h" #include "settings/settings_premium.h" #include "ui/effects/ripple_animation.h" // MaskByDrawer. @@ -35,6 +36,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_slide_animation.h" #include "boxes/peer_list_box.h" #include "ui/boxes/confirm_box.h" +#include "ui/boxes/peer_qr_box.h" #include "main/main_session.h" #include "mtproto/mtproto_config.h" #include "data/data_download_manager.h" @@ -388,6 +390,23 @@ void WrapWidget::setupTopBarMenuToggle() { addProfileCallsButton(); } else if (section.type() == Section::Type::Settings) { addTopBarMenuButton(); + if (section.settingsType() == ::Settings::Information::Id() + || section.settingsType() == ::Settings::Main::Id()) { + const auto controller = _controller->parentController(); + const auto self = controller->session().user(); + if (!self->username().isEmpty()) { + const auto show = controller->uiShow(); + const auto &st = (wrap() == Wrap::Layer) + ? st::infoLayerTopBarQr + : st::infoTopBarQr; + const auto button = _topBar->addButton( + base::make_unique_q(_topBar, st)); + button->addClickHandler([show, self] { + show->show( + Box(Ui::FillPeerQrBox, self, std::nullopt, nullptr)); + }); + } + } } else if (section.type() == Section::Type::Downloads) { auto &manager = Core::App().downloadManager(); rpl::merge( diff --git a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.h b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.h index e9622fd02..4958ba19d 100644 --- a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.h +++ b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.h @@ -80,24 +80,6 @@ struct AttachWebViewBot { bool requestWriteAccess : 1 = false; }; -struct AddToMenuOpenAttach { - QString startCommand; - PeerTypes chooseTypes; -}; -struct AddToMenuOpenMenu { - QString startCommand; -}; -struct AddToMenuOpenApp { - not_null app; - QString startCommand; -}; -struct AddToMenuOpen : std::variant< - AddToMenuOpenAttach, - AddToMenuOpenMenu, - AddToMenuOpenApp> { - using variant::variant; -}; - struct WebViewSourceButton { bool simple = false; diff --git a/Telegram/SourceFiles/overview/overview_layout.cpp b/Telegram/SourceFiles/overview/overview_layout.cpp index d8c70f1df..4357a17eb 100644 --- a/Telegram/SourceFiles/overview/overview_layout.cpp +++ b/Telegram/SourceFiles/overview/overview_layout.cpp @@ -1638,6 +1638,17 @@ Link::Link( } _links.push_back(LinkEntry(url, entityText)); } + if (_links.empty()) { + if (const auto media = parent->media()) { + if (const auto webpage = media->webpage()) { + if (!webpage->displayUrl.isEmpty() + && !webpage->url.isEmpty()) { + _links.push_back( + LinkEntry(webpage->displayUrl, webpage->url)); + } + } + } + } while (lnk > 0 && till > from) { --lnk; auto &entity = entities.at(lnk); diff --git a/Telegram/SourceFiles/ui/boxes/peer_qr_box.cpp b/Telegram/SourceFiles/ui/boxes/peer_qr_box.cpp index d35929871..7001e5151 100644 --- a/Telegram/SourceFiles/ui/boxes/peer_qr_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/peer_qr_box.cpp @@ -124,8 +124,9 @@ void Paint( const auto gradientRotation = int(angle / 45.) * 45; const auto gradientRotationAdd = angle - gradientRotation; + const auto textAdditionalWidth = backgroundMargins.left(); auto back = Images::GenerateGradient( - qrRect.size(), + qrRect.size() + QSize(textAdditionalWidth, 0), backgroundColors, gradientRotation, 1. - (gradientRotationAdd / 45.)); @@ -151,7 +152,7 @@ void Paint( p.drawImage(qrRect, qrImage); if (textMaxHeight) { p.drawImage( - qrRect.x(), + qrRect.x() - textAdditionalWidth / 2, rect::bottom(qrRect) + ((rect::bottom(roundedRect) - rect::bottom(qrRect)) - textMaxHeight) / 2, @@ -238,9 +239,9 @@ not_null PrepareQrWidget( aboutLabel->setText(about); aboutLabel->resizeToWidth(resultWidth); } - const auto qrWidth = state->qrImage.width() - / style::DevicePixelRatio(); - const auto lines = int(state->textWidth / qrWidth) + 1; + const auto textMaxWidth = state->backgroundMargins.left() + + (state->qrImage.width() / style::DevicePixelRatio()); + const auto lines = int(state->textWidth / textMaxWidth) + 1; state->textMaxHeight = state->textWidth ? (font->height * lines) : 0; const auto whiteMargins = RoundedMargins( state->backgroundMargins, @@ -486,14 +487,13 @@ void FillPeerQrBox( }) | ranges::views::filter([](const Colors &colors) { return !colors.empty(); }) | ranges::to_vector; - colorsCollection.insert( - colorsCollection.begin(), - Colors{ - st::premiumButtonBg1->c, - st::premiumButtonBg1->c, - st::premiumButtonBg2->c, - st::premiumButtonBg3->c, - }); + Expects(!colorsCollection.empty()); + colorsCollection[0] = Colors{ + st::premiumButtonBg1->c, + st::premiumButtonBg1->c, + st::premiumButtonBg2->c, + st::premiumButtonBg3->c, + }; // colorsCollection.push_back(Colors{ // st::creditsBg1->c, // st::creditsBg2->c, @@ -792,8 +792,9 @@ void FillPeerQrBox( Qr::Redundancy::Default), introQrPixel, qrMaxSize); - const auto qrWidth = qrImage.width() / style::DevicePixelRatio(); - const auto lines = int(textWidth / qrWidth) + 1; + const auto textMaxWidth = backgroundMargins.left() + + (qrImage.width() / style::DevicePixelRatio()); + const auto lines = int(textWidth / textMaxWidth) + 1; const auto textMaxHeight = textWidth ? font->height * lines : 0; const auto whiteMargins = RoundedMargins( diff --git a/Telegram/SourceFiles/window/window_main_menu.cpp b/Telegram/SourceFiles/window/window_main_menu.cpp index ff4fbd908..7bf812bc3 100644 --- a/Telegram/SourceFiles/window/window_main_menu.cpp +++ b/Telegram/SourceFiles/window/window_main_menu.cpp @@ -169,10 +169,12 @@ void ShowCallsBox(not_null window) { showSettings, &st::menuIconSettings); if (state->callsDelegate.peerListFullRowsCount() > 0) { - state->menu->addAction( - tr::lng_call_box_clear_all(tr::now), - clearAll, - &st::menuIconDelete); + Ui::Menu::CreateAddActionCallback(state->menu)({ + .text = tr::lng_call_box_clear_all(tr::now), + .handler = clearAll, + .icon = &st::menuIconDeleteAttention, + .isAttention = true, + }); } state->menu->popup(QCursor::pos()); return true; diff --git a/Telegram/build/version b/Telegram/build/version index bc6ebdab7..69b99552b 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,7 +1,7 @@ -AppVersion 5005003 +AppVersion 5005004 AppVersionStrMajor 5.5 -AppVersionStrSmall 5.5.3 -AppVersionStr 5.5.3 +AppVersionStrSmall 5.5.4 +AppVersionStr 5.5.4 BetaChannel 0 AlphaVersion 0 -AppVersionOriginal 5.5.3 +AppVersionOriginal 5.5.4 diff --git a/changelog.txt b/changelog.txt index c5814f7a5..2bd1bca36 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ +5.5.4 (12.09.24) + +- Fix channel updates stopping after difference request failing. +- Add QR code generation for your username in Settings. +- Fix swipe-to-reply gestures stopping. (macOS) + 5.5.3 (10.09.24) - Fix custom emoji sending.