diff --git a/Telegram/Resources/icons/menu/boosts.png b/Telegram/Resources/icons/menu/boosts.png new file mode 100644 index 00000000000000..64a5ae3b9a3151 Binary files /dev/null and b/Telegram/Resources/icons/menu/boosts.png differ diff --git a/Telegram/Resources/icons/menu/boosts@2x.png b/Telegram/Resources/icons/menu/boosts@2x.png new file mode 100644 index 00000000000000..0478fa66047ac7 Binary files /dev/null and b/Telegram/Resources/icons/menu/boosts@2x.png differ diff --git a/Telegram/Resources/icons/menu/boosts@3x.png b/Telegram/Resources/icons/menu/boosts@3x.png new file mode 100644 index 00000000000000..33590248c93a60 Binary files /dev/null and b/Telegram/Resources/icons/menu/boosts@3x.png differ diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index 7ca2cba8cf322d..d0c302ff13f585 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -10,7 +10,7 @@ + Version="4.10.5.0" /> rabbitGram Desktop xmdnx diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 1fffb555806d9f..33adcb65c46356 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 4,10,4,0 - PRODUCTVERSION 4,10,4,0 + FILEVERSION 4,10,5,0 + PRODUCTVERSION 4,10,5,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -62,10 +62,10 @@ BEGIN BEGIN VALUE "CompanyName", "xmdnx" VALUE "FileDescription", "rabbitGram Desktop" - VALUE "FileVersion", "4.10.4.0" + VALUE "FileVersion", "4.10.5.0" VALUE "LegalCopyright", "Copyright (C) 2023" VALUE "ProductName", "rabbitGram Desktop" - VALUE "ProductVersion", "4.10.4.0" + VALUE "ProductVersion", "4.10.5.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index fa6b02debaf59d..2b97898a441d27 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 4,10,4,0 - PRODUCTVERSION 4,10,4,0 + FILEVERSION 4,10,5,0 + PRODUCTVERSION 4,10,5,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -53,10 +53,10 @@ BEGIN BEGIN VALUE "CompanyName", "xmdnx" VALUE "FileDescription", "rabbitGram Desktop Updater" - VALUE "FileVersion", "4.10.4.0" + VALUE "FileVersion", "4.10.5.0" VALUE "LegalCopyright", "Copyright (C) 2021-2023" VALUE "ProductName", "rabbitGram Desktop" - VALUE "ProductVersion", "4.10.4.0" + VALUE "ProductVersion", "4.10.5.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/_other/packer.cpp b/Telegram/SourceFiles/_other/packer.cpp index e0cb77a847165d..1d481d6493b6f9 100644 --- a/Telegram/SourceFiles/_other/packer.cpp +++ b/Telegram/SourceFiles/_other/packer.cpp @@ -12,12 +12,34 @@ quint64 AlphaVersion = 0; bool OnlyAlphaKey = false; const char *PublicKey = "\ ------BEGIN PUBLIC KEY-----\n\ -MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrKNjQNI4dmBvjIORxa67K+rhP\n\ -nLlwMbuSips7h/HPwyreI3IfjJ3HkTmLIyLnKBXWgwBJyY2dXvWnKqjI9JLYA8MX\n\ -KH90ye7e4pkhPlt5CwvsIuw8ruRJIc1wCYGlSlkKZqBkUbHAExFBV8cSiiq3c2dh\n\ -fXuawBGjlj90TY451wIDAQAB\n\ ------END PUBLIC KEY-----\ +-----BEGIN PRIVATE KEY-----\n\ +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDNLhXYRAArR5js\n\ +MtkMdIgTTYNYSEqqc1Pr47xDe1zVipqiOdaOn01xw5Yt3GPmiXhx2VHzziA4jWdL\n\ +xyWpcjvkCVDNXpNxZWbfDEZSVZ0eam8y51wQNJ11qRnIIJcI0B4fUpC1HzRDMPrs\n\ +TS4MgQKKfZCTPWe6AID5Zm5eH3S187Zm1ci1hnAFMDIMGG8BoIFRyAjXjSsYkq4A\n\ +Jq8NeQZTd//kZWJ8lSlwLEwZ+tgQ6GCb5Wo7IU/ImNBlbv7Bg6F0lJZ3WJiVIE2u\n\ +s0Cxm5IA5IAUQPkoHxt+J3AZvYJuQkj1JYEJBSUQacFreFUZpVQx6oDzLooYfXhu\n\ +PwXZTWddAgMBAAECggEAJ651yZdvK++jJu03loXUCl2nnROQIzJ+RMUM1EU/wUnW\n\ +2bCTaw5qoSmpOhHhXUTxfx0/UQZoq19HnrtzcHe4FwRpNOrJW7k3gcRDNmm54xfF\n\ +DUR7BORUHp0XcCHDbBAp/zdN5sWT6znGEZzknsT1m5iotR0/WhT+XJ2fk0MEpKqW\n\ +ef2yW9ScM2WzKfuTB47Yh3qCWNJTWdMD2dR+V8zsxzip94AT1ae0WkQjG/AdF3cx\n\ +zBQ9QbMa7QUjT3f2AfoVTkzgUPoQcGnwF0d0ptyAoBCBEQh6udLwXNhTyFTnXIOy\n\ +3rEnro3iLaKnTw8Gw8Y1e1LwOKX9LxsDZ3O2g/G7UQKBgQD6TYEp/uvGpZ7F4N88\n\ +rhwrOasckHU3ZtvMjSpBKyKPL0X3uD1KrMU4tx5+YYoQkVd7S7fbZXeSaDzImUj8\n\ +axLUGVOwOlfdFXNR+kYe2FIKsft5P2sHk+aAIkardfSGg/MVARkZLtg1FnhZznlJ\n\ +oP09j8hRpjEotqwOhYy0J9J+UQKBgQDR2adsWEq6lOBt7WnxfoPimPkfAesQcpMA\n\ +Rh12yle0ueBRjqomII/G/sGUihj9WoxM78tKJ17N0d5x6ed6TDgCxDOpmlf2cODd\n\ +pXV69FBHpiQoXR+W0JVe794HXVEbb3Ipjwy3WyQkRc8HjIxybYDDdCkH5gC4sITo\n\ +8AqEjs+ZTQKBgQDFIoW4La5EpeyGrLUldXt6D9FUjfHD0J8MW6IL8Y0meHUCxXiA\n\ +d9Jc+NxrbSbwJYhg8yG7Cg9CoBY/Z3q0UyBhLBFdmpXY6iwJRLQ1VupGwibtN6V0\n\ +Mmg4QsamBCCyUPoCcPrzepGOPkRLdvLPqpvJAJUkuV++USDxzv0iZrrCAQKBgHBq\n\ +jMn5sm6pemDpIiwAfl5RXIND38z708v9w6LzWnCycny+VGAAaYVMzB7qq+BtNWOx\n\ +wdGDrcHMf8G+cAaP9iFlQdfFmwGmDpAuJvUrFCaN1ijZWibMrnghP2vqjZyI4zto\n\ +KoO/C2lzDCkbHdHe32/VNnXIvPIzfb/bd4bzijqxAoGABJiuO30FJQPA7BJjPcfJ\n\ +kksO7lv0zlQx+cJULl8KDPNK0+USwX1BN6KzJLlL7pVRpKW0rk86kXN63kRZuR14\n\ +ocjL3XachX1+uU+CXUuvOtkQRXD5RXBw0yQNfPP2HEdjA7V7fWAWCOd2YF6Gu+W2\n\ +4GK1kumBQBqCsbUgMBJ5PZs=\n\ +-----END PRIVATE KEY-----\n\ "; extern const char *PrivateKey; diff --git a/Telegram/SourceFiles/api/api_statistics.cpp b/Telegram/SourceFiles/api/api_statistics.cpp index 1bd5eb31492e7f..79de3c2cde23ae 100644 --- a/Telegram/SourceFiles/api/api_statistics.cpp +++ b/Telegram/SourceFiles/api/api_statistics.cpp @@ -434,19 +434,42 @@ void MessageStatistics::request(Fn done) { const auto requestPrivateForwards = [=]( const Data::StatisticalGraph &messageGraph) { - _api.request(MTPstats_GetBroadcastStats( - MTP_flags(MTPstats_GetBroadcastStats::Flags(0)), - _channel->inputChannel - )).done([=](const MTPstats_BroadcastStats &result) { - const auto channelStats = ChannelStatisticsFromTL(result.data()); - auto info = Data::StatisticsMessageInteractionInfo(); - for (const auto &r : channelStats.recentMessageInteractions) { - if (r.messageId == _fullId.msg) { - info = r; - break; - } - } - requestFirstPublicForwards(messageGraph, info); + _api.request(MTPchannels_GetMessages( + _channel->inputChannel, + MTP_vector( + 1, + MTP_inputMessageID(MTP_int(_fullId.msg)))) + ).done([=](const MTPmessages_Messages &result) { + const auto process = [&](const MTPVector &messages) { + const auto &message = messages.v.front(); + return message.match([&](const MTPDmessage &data) { + return Data::StatisticsMessageInteractionInfo{ + .messageId = IdFromMessage(message), + .viewsCount = data.vviews() + ? data.vviews()->v + : 0, + .forwardsCount = data.vforwards() + ? data.vforwards()->v + : 0, + }; + }, [](const MTPDmessageEmpty &) { + return Data::StatisticsMessageInteractionInfo(); + }, [](const MTPDmessageService &) { + return Data::StatisticsMessageInteractionInfo(); + }); + }; + + auto info = result.match([&](const MTPDmessages_messages &data) { + return process(data.vmessages()); + }, [&](const MTPDmessages_messagesSlice &data) { + return process(data.vmessages()); + }, [&](const MTPDmessages_channelMessages &data) { + return process(data.vmessages()); + }, [](const MTPDmessages_messagesNotModified &) { + return Data::StatisticsMessageInteractionInfo(); + }); + + requestFirstPublicForwards(messageGraph, std::move(info)); }).fail([=](const MTP::Error &error) { requestFirstPublicForwards(messageGraph, {}); }).send(); diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index 50b7d429e8f992..6a3b148558f18d 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -97,7 +97,7 @@ const auto CommandByName = base::flat_map{ { u"message"_q , Command::JustSendMessage }, { u"message_silently"_q , Command::SendSilentMessage }, { u"message_scheduled"_q , Command::ScheduleMessage }, - { u"mevia_viewer_video_fullscreen"_q , Command::MediaViewerFullscreen }, + { u"media_viewer_video_fullscreen"_q , Command::MediaViewerFullscreen }, // }; diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index a0eff92c4b7cf9..76cbb89cb2b89a 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -22,7 +22,7 @@ constexpr auto AppId = "{4356CE01-4137-4C55-9F8B-FB4EEBB6EC0C}"_cs; constexpr auto AppNameOld = "rabbitGram Win (Unofficial)"_cs; constexpr auto AppName = "rabbitGram Desktop"_cs; constexpr auto AppFile = "rabbitGram"_cs; -constexpr auto AppVersion = 4010004; -constexpr auto AppVersionStr = "4.10.4"; +constexpr auto AppVersion = 4010005; +constexpr auto AppVersionStr = "4.10.5"; constexpr auto AppBetaVersion = false; constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index f10e4a2b74fc44..4bc0724add37e2 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -45,6 +45,8 @@ For license and copyright information please follow this link: #include "window/window_controller.h" #include "window/window_peer_menu.h" #include "window/notifications_manager.h" +#include "info/info_memento.h" +#include "info/statistics/info_statistics_widget.h" #include "boxes/about_sponsored_box.h" #include "boxes/delete_messages_box.h" #include "boxes/report_messages_box.h" @@ -2212,11 +2214,26 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { if (pinItem->canPin()) { const auto isPinned = pinItem->isPinned(); const auto pinItemId = pinItem->fullId(); - const auto controller = _controller; _menu->addAction(isPinned ? tr::lng_context_unpin_msg(tr::now) : tr::lng_context_pin_msg(tr::now), crl::guard(controller, [=] { Window::ToggleMessagePinned(controller, pinItemId, !isPinned); }), isPinned ? &st::menuIconUnpin : &st::menuIconPin); } + if (!item->isService() + && peerIsChannel(itemId.peer) + && !_peer->isMegagroup()) { + if (const auto channel = _peer->asChannel()) { + if (channel->flags() & ChannelDataFlag::CanGetStatistics) { + auto callback = crl::guard(controller, [=] { + controller->showSection( + Info::Statistics::Make(channel, itemId)); + }); + _menu->addAction( + tr::lng_stats_title(tr::now), + std::move(callback), + &st::menuIconStats); + } + } + } }; const auto addPhotoActions = [&](not_null photo, HistoryItem *item) { const auto media = photo->activeMediaView(); diff --git a/Telegram/SourceFiles/info/statistics/info_statistics_inner_widget.cpp b/Telegram/SourceFiles/info/statistics/info_statistics_inner_widget.cpp index 31175242680efc..c90ee395cec9c3 100644 --- a/Telegram/SourceFiles/info/statistics/info_statistics_inner_widget.cpp +++ b/Telegram/SourceFiles/info/statistics/info_statistics_inner_widget.cpp @@ -14,7 +14,6 @@ For license and copyright information please follow this link: #include "history/history_item.h" #include "info/info_controller.h" #include "info/info_memento.h" -#include "info/boosts/info_boosts_widget.h" #include "info/statistics/info_statistics_list_controllers.h" #include "info/statistics/info_statistics_recent_message.h" #include "info/statistics/info_statistics_widget.h" @@ -125,10 +124,9 @@ void FillStatistic( ProcessZoom(descriptor, widget, graph.zoomToken, type); widget->setTitle(rpl::duplicate(title)); } else if (!graph.error.isEmpty()) { - Ui::Toast::Show(descriptor.toastParent, graph.error); } - }, [=](const QString &error) { - }, [=] { + }, [](const QString &error) { + }, [] { }, content->lifetime()); addSkip(wrap->entity()); @@ -514,20 +512,6 @@ void InnerWidget::load() { descriptor.api->channelStats(), descriptor.api->supergroupStats(), }; - if (_state.stats.channel) { - ::Settings::AddSkip(inner); - const auto button = ::Settings::AddButton( - inner, - tr::lng_boosts_title(), - st::boostsButton); - const auto controller = _controller; - button->setClickedCallback([=, peer = descriptor.peer] { - controller->showSection(Info::Boosts::Make(peer)); - }); - ::Settings::AddSkip(inner); - ::Settings::AddDivider(inner); - ::Settings::AddSkip(inner); - } fill(); finishLoading(); @@ -557,6 +541,14 @@ void InnerWidget::fill() { lifetime().make_state(&_peer->session().api()), _controller->uiShow()->toastParent(), }; + if (_state.stats.message) { + if (const auto i = _peer->owner().message(_contextId)) { + ::Settings::AddSkip(inner); + inner->add(object_ptr(this, i, -1, -1, QImage())); + ::Settings::AddSkip(inner); + ::Settings::AddDivider(inner); + } + } FillOverview(inner, _state.stats); FillStatistic(inner, descriptor, _state.stats); const auto &channel = _state.stats.channel; @@ -568,8 +560,7 @@ void InnerWidget::fill() { const auto showPeerInfo = [=](not_null peer) { _showRequests.fire({ .info = peer->id }); }; - const auto addSkip = [&]( - not_null c) { + const auto addSkip = [&](not_null c) { ::Settings::AddSkip(c); ::Settings::AddDivider(c); ::Settings::AddSkip(c); diff --git a/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp b/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp index 1666abbec84464..db764dff6ba5d7 100644 --- a/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp +++ b/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp @@ -530,6 +530,9 @@ void AddBoostsList( object_ptr(container, &state->controller))); state->controller.setDelegate(&state->delegate); + if (max <= state->limit) { + return; + } const auto wrap = container->add( object_ptr>( container, diff --git a/Telegram/SourceFiles/info/statistics/info_statistics_recent_message.cpp b/Telegram/SourceFiles/info/statistics/info_statistics_recent_message.cpp index e4825c712d7560..1a85458e93d2db 100644 --- a/Telegram/SourceFiles/info/statistics/info_statistics_recent_message.cpp +++ b/Telegram/SourceFiles/info/statistics/info_statistics_recent_message.cpp @@ -79,16 +79,20 @@ MessagePreview::MessagePreview( Ui::FormatDateTime(ItemDateTime(item))) , _views( st::defaultPeerListItem.nameStyle, - tr::lng_stats_recent_messages_views( - tr::now, - lt_count_decimal, - views)) + (views >= 0) + ? tr::lng_stats_recent_messages_views( + tr::now, + lt_count_decimal, + views) + : QString()) , _shares( st::statisticsHeaderTitleTextStyle, - tr::lng_stats_recent_messages_shares( - tr::now, - lt_count_decimal, - shares)) + (shares >= 0) + ? tr::lng_stats_recent_messages_shares( + tr::now, + lt_count_decimal, + shares) + : QString()) , _viewsWidth(_views.maxWidth()) , _sharesWidth(_shares.maxWidth()) , _preview(std::move(cachedPreview)) { diff --git a/Telegram/SourceFiles/platform/win/integration_win.cpp b/Telegram/SourceFiles/platform/win/integration_win.cpp index 989d687a67f8d2..4443a7e02ee2ff 100644 --- a/Telegram/SourceFiles/platform/win/integration_win.cpp +++ b/Telegram/SourceFiles/platform/win/integration_win.cpp @@ -12,6 +12,7 @@ For license and copyright information please follow this link: #include "core/application.h" #include "core/core_settings.h" #include "core/sandbox.h" +#include "tray.h" #include "base/platform/win/base_windows_winrt.h" #include @@ -78,11 +79,12 @@ bool WindowsIntegration::processEvent( } break; -#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0) case WM_SETTINGCHANGE: +#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0) Core::App().settings().setSystemDarkMode(Platform::IsDarkMode()); - break; #endif // Qt < 6.5.0 + Core::App().tray().updateIconCounters(); + break; } return false; } diff --git a/Telegram/SourceFiles/platform/win/main_window_win.cpp b/Telegram/SourceFiles/platform/win/main_window_win.cpp index 3a8eb4664afb5a..4876062e46aa50 100644 --- a/Telegram/SourceFiles/platform/win/main_window_win.cpp +++ b/Telegram/SourceFiles/platform/win/main_window_win.cpp @@ -510,10 +510,12 @@ void MainWindow::updateTaskbarAndIconCounters() { auto iconSmallPixmap16 = Tray::IconWithCounter( Tray::CounterLayerArgs(16, counter, muted), true, + false, supportMode); auto iconSmallPixmap32 = Tray::IconWithCounter( Tray::CounterLayerArgs(32, counter, muted), true, + false, supportMode); QIcon iconSmall, iconBig; iconSmall.addPixmap(iconSmallPixmap16); @@ -524,10 +526,12 @@ void MainWindow::updateTaskbarAndIconCounters() { iconBig.addPixmap(Tray::IconWithCounter( Tray::CounterLayerArgs(32, bigCounter, muted), false, + false, supportMode)); iconBig.addPixmap(Tray::IconWithCounter( Tray::CounterLayerArgs(64, bigCounter, muted), false, + false, supportMode)); destroyCachedIcons(); diff --git a/Telegram/SourceFiles/platform/win/tray_win.cpp b/Telegram/SourceFiles/platform/win/tray_win.cpp index 414a6f9504eaa7..504b2ed6fb2826 100644 --- a/Telegram/SourceFiles/platform/win/tray_win.cpp +++ b/Telegram/SourceFiles/platform/win/tray_win.cpp @@ -30,13 +30,47 @@ namespace { constexpr auto kTooltipDelay = crl::time(10000); +[[nodiscard]] std::optional IsDarkTaskbar() { + static const auto kSystemVersion = QOperatingSystemVersion::current(); + static const auto kDarkModeAddedVersion = QOperatingSystemVersion( + QOperatingSystemVersion::Windows, + 10, + 0, + 17763); + static const auto kSupported = (kSystemVersion >= kDarkModeAddedVersion); + if (!kSupported) { + return std::nullopt; + } + + const auto keyName = L"" + "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; + const auto valueName = L"SystemUsesLightTheme"; + auto key = HKEY(); + auto result = RegOpenKeyEx(HKEY_CURRENT_USER, keyName, 0, KEY_READ, &key); + if (result != ERROR_SUCCESS) { + return std::nullopt; + } + + DWORD value = 0, type = 0, size = sizeof(value); + result = RegQueryValueEx(key, valueName, 0, &type, (LPBYTE)&value, &size); + RegCloseKey(key); + if (result != ERROR_SUCCESS) { + return std::nullopt; + } + + return (value == 0); +} + [[nodiscard]] QImage ImageIconWithCounter( Window::CounterLayerArgs &&args, bool supportMode, - bool smallIcon) { + bool smallIcon, + bool monochrome) { static constexpr auto kCount = 3; static auto ScaledLogo = std::array(); static auto ScaledLogoNoMargin = std::array(); + static auto ScaledLogoDark = std::array(); + static auto ScaledLogoLight = std::array(); struct Dimensions { int index = 0; @@ -63,19 +97,49 @@ constexpr auto kTooltipDelay = crl::time(10000); }(); Assert(d.index < kCount); - auto &scaled = smallIcon ? ScaledLogoNoMargin : ScaledLogo; + const auto darkMode = IsDarkTaskbar(); + auto &scaled = (monochrome && darkMode) + ? (*darkMode + ? ScaledLogoDark + : ScaledLogoLight) + : smallIcon + ? ScaledLogoNoMargin + : ScaledLogo; + auto result = [&] { auto &image = scaled[d.index]; if (image.isNull()) { - image = (smallIcon - ? Window::LogoNoMargin() - : Window::Logo()).scaledToWidth( - d.size, - Qt::SmoothTransformation); + if (monochrome && darkMode) { + const auto withColor = [&](QColor color) { + switch (d.size) { + case 16: + return st::macTrayIcon.instance(color, 100 / cIntRetinaFactor()); + case 32: + return st::macTrayIcon.instance(color, 200 / cIntRetinaFactor()); + default: + return st::macTrayIcon.instance(color, 300 / cIntRetinaFactor()); + } + }; + const auto darkModeResult = withColor({ 255, 255, 255 }); + const auto lightModeResult = withColor({ 0, 0, 0, 228 }); + image = *darkMode ? darkModeResult : lightModeResult; + const auto monochromeMargin = QPoint( + (image.width() - d.size) / 2, + (image.height() - d.size) / 2); + image = image.copy( + QRect(monochromeMargin, QSize(d.size, d.size))); + image.setDevicePixelRatio(1); + } else { + image = (smallIcon + ? Window::LogoNoMargin() + : Window::Logo()).scaledToWidth( + d.size, + Qt::SmoothTransformation); + } } return image; }(); - if (supportMode) { + if ((!monochrome || !darkMode) && supportMode) { Window::ConvertIconToBlack(result); } if (!args.count) { @@ -163,10 +227,12 @@ void Tray::updateIcon() { auto iconSmallPixmap16 = Tray::IconWithCounter( CounterLayerArgs(16, counter, muted), true, + true, supportMode); auto iconSmallPixmap32 = Tray::IconWithCounter( CounterLayerArgs(32, counter, muted), true, + true, supportMode); auto iconSmall = QIcon(); iconSmall.addPixmap(iconSmallPixmap16); @@ -271,9 +337,10 @@ Window::CounterLayerArgs Tray::CounterLayerArgs( QPixmap Tray::IconWithCounter( Window::CounterLayerArgs &&args, bool smallIcon, + bool monochrome, bool supportMode) { return Ui::PixmapFromImage( - ImageIconWithCounter(std::move(args), supportMode, smallIcon)); + ImageIconWithCounter(std::move(args), supportMode, smallIcon, monochrome)); } } // namespace Platform diff --git a/Telegram/SourceFiles/platform/win/tray_win.h b/Telegram/SourceFiles/platform/win/tray_win.h index 5f759020e66f63..8eb264ce6a44c6 100644 --- a/Telegram/SourceFiles/platform/win/tray_win.h +++ b/Telegram/SourceFiles/platform/win/tray_win.h @@ -57,6 +57,7 @@ class Tray final { [[nodiscard]] static QPixmap IconWithCounter( Window::CounterLayerArgs &&args, bool smallIcon, + bool monochrome, bool supportMode); private: diff --git a/Telegram/SourceFiles/statistics/chart_widget.cpp b/Telegram/SourceFiles/statistics/chart_widget.cpp index f63fbfab3880e2..a6a167185c167a 100644 --- a/Telegram/SourceFiles/statistics/chart_widget.cpp +++ b/Telegram/SourceFiles/statistics/chart_widget.cpp @@ -282,9 +282,10 @@ ChartWidget::Footer::Footer(not_null parent) Qt::RoundCap) { sizeValue( ) | rpl::take(2) | rpl::start_with_next([=](const QSize &s) { - moveSide(false, s.width()); - moveSide(true, 0); - update(); + const auto current = xPercentageLimits(); + if (current.min == current.max) { + setXPercentageLimits({ 0., 1. }); + } }, lifetime()); mouseStateChanged( diff --git a/Telegram/SourceFiles/statistics/statistics.style b/Telegram/SourceFiles/statistics/statistics.style index e27059a41db949..f797dbc1a059d6 100644 --- a/Telegram/SourceFiles/statistics/statistics.style +++ b/Telegram/SourceFiles/statistics/statistics.style @@ -17,7 +17,7 @@ statisticsChartHeight: 200px; statisticsChartEntryPadding: margins(0px, 13px, 0px, 2px); -statisticsDetailsArrowShift: 2px; +statisticsDetailsArrowShift: 3px; statisticsDetailsArrowStroke: 1.5; statisticsDetailsPopupMargins: margins(12px, 8px, 12px, 11px); statisticsDetailsPopupPadding: margins(6px, 6px, 6px, 6px); diff --git a/Telegram/SourceFiles/statistics/widgets/point_details_widget.cpp b/Telegram/SourceFiles/statistics/widgets/point_details_widget.cpp index a9f057543b87cf..4baa07539fa379 100644 --- a/Telegram/SourceFiles/statistics/widgets/point_details_widget.cpp +++ b/Telegram/SourceFiles/statistics/widgets/point_details_widget.cpp @@ -429,7 +429,7 @@ void PointDetailsWidget::paintEvent(QPaintEvent *e) { const auto s = _arrow.size() / style::DevicePixelRatio(); const auto x = rect::right(_textRect) - s.width(); const auto y = _textRect.y() - + (_headerStyle.font->height - s.height()) / 2.; + + (_headerStyle.font->ascent - s.height()); p.drawImage(x, y, _arrow); } } diff --git a/Telegram/SourceFiles/ui/menu_icons.style b/Telegram/SourceFiles/ui/menu_icons.style index 52ede078fcc804..d43477c875a8f8 100644 --- a/Telegram/SourceFiles/ui/menu_icons.style +++ b/Telegram/SourceFiles/ui/menu_icons.style @@ -52,6 +52,7 @@ menuIconClear: icon {{ "menu/clear", menuIconColor }}; menuIconManage: icon {{ "menu/manage", menuIconColor }}; menuIconDiscussion: icon {{ "menu/discussion", menuIconColor }}; menuIconStats: icon {{ "menu/stats", menuIconColor }}; +menuIconBoosts: icon {{ "menu/boosts", menuIconColor }}; menuIconCreatePoll: icon {{ "menu/create_poll", menuIconColor }}; menuIconQrCode: icon {{ "menu/qr_code", menuIconColor }}; menuIconExpand: icon {{ "menu/expand", menuIconColor }}; diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 814f4cfaff26df..fb4a32b55cf97d 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -62,6 +62,7 @@ For license and copyright information please follow this link: #include "support/support_helper.h" #include "info/info_controller.h" #include "info/info_memento.h" +#include "info/boosts/info_boosts_widget.h" #include "info/profile/info_profile_values.h" #include "info/statistics/info_statistics_widget.h" #include "info/stories/info_stories_widget.h" @@ -1006,6 +1007,13 @@ void Filler::addViewStatistics() { controller->showSection(Info::Statistics::Make(peer, {})); } }, &st::menuIconStats); + if (!channel->isMegagroup()) { + _addAction(tr::lng_boosts_title(tr::now), [=] { + if (const auto strong = weak.get()) { + controller->showSection(Info::Boosts::Make(peer)); + } + }, &st::menuIconBoosts); + } } } } diff --git a/Telegram/build/setup.iss b/Telegram/build/setup.iss index f25d6212454eb0..69c6057bb3b8a6 100644 --- a/Telegram/build/setup.iss +++ b/Telegram/build/setup.iss @@ -69,6 +69,7 @@ Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescrip [Files] Source: "{#ReleasePath}\rabbitGram.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "{#ReleasePath}\Updater.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "{#ReleasePath}\{#ModulesFolder}\d3d\d3dcompiler_47.dll"; DestDir: "{app}\{#ModulesFolder}\d3d"; Flags: ignoreversion ; NOTE: Don't use "Flags: ignoreversion" on any shared system files diff --git a/Telegram/build/version b/Telegram/build/version index 94a9388049cdea..5f32b2f0c16721 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,7 +1,7 @@ -AppVersion 4010004 +AppVersion 4010005 AppVersionStrMajor 4.10 -AppVersionStrSmall 4.10.4 -AppVersionStr 4.10.4 +AppVersionStrSmall 4.10.5 +AppVersionStr 4.10.5 BetaChannel 1 AlphaVersion 0 -AppVersionOriginal 4.10.4.beta +AppVersionOriginal 4.10.5.beta diff --git a/changelog.txt b/changelog.txt index f79d9fbfde9577..6e5d10d7405548 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +4.10.5 beta (23.10.23) + +- Fix crash in replies to messages with spoilers. +- Enter boosts stats from three-dot menu. + 4.10.4 beta (21.10.23) - Statistics in channels and group chats. diff --git a/prepare_version.py b/prepare_version.py index 4bfcbc7835131c..47cb0c6eee8953 100644 --- a/prepare_version.py +++ b/prepare_version.py @@ -7,6 +7,7 @@ config = { "make_setup": True, # set True if you want to make setup version "make_portable": True, # set True if you want to make portable version + "ota_enabled": True, # set True if ota enabled "repo_path": "", # leave it blank if this script located in repo folder "version": "", # leave it blank to fill with version from SourceFiles/core/version.h and script runtime date "tgversion": "", # leave it blanl to set it automatically @@ -40,28 +41,12 @@ def set_iss(): iss_file = open(config["repo_path"] + "/Telegram/build/setup.iss", "w", encoding="utf-8") iss_file.writelines(iss_file_data) -def rename_files(): +def check_files(): log("# Renaming files...", 1) - if (not os.path.exists(os.path.join(config["repo_path"] + "/out/Release/", "Telegram.exe"))): - log("Telegram.exe does not exist, check if " + config["exe_filename"] + " exist...", 2) - if os.path.exists(os.path.join(config["repo_path"] + "/out/Release/", config["exe_filename"])): - log(config["exe_filename"] + " exists, but Telegram.exe not exist. Skipping rename part...", 2) - return - else: - log(config["exe_filename"] + " does not exist too, halt...", 2) - exit() - - if os.path.exists(os.path.join(config["repo_path"] + "/out/Release/", config["exe_filename"] + ".exe")): - os.remove(os.path.join(config["repo_path"] + "/out/Release/", config["exe_filename"] + ".exe")) - log(config["exe_filename"] + " removed successfully, renaming", 2) - else: - log(config["exe_filename"] + " does not exist, renaming", 2) - - old_path = os.path.join(config["repo_path"] + "/out/Release/", "Telegram.exe") - new_path = os.path.join(config["repo_path"] + "/out/Release/", config["exe_filename"]) - os.rename(old_path, new_path) - log("Renamed Telegram.exe -> " + config["exe_filename"], 2) + if not os.path.exists(os.path.join(config["repo_path"] + "/out/Release/", config["exe_filename"])): + log(config["exe_filename"] + " does not exist too, halt...", 2) + exit() def run_iss_build(): log("Running iscc build... If error occurs, check if iscc.exe path added to PATH", 1) @@ -78,6 +63,8 @@ def make_portable(): log("Copying portable files", 2) try: shutil.copyfile(os.path.join(config["repo_path"] + "/out/Release/", config["exe_filename"]), os.path.join(config["repo_path"] + "/out/Release/portable", config["exe_filename"])) + if config["ota_enabled"]: + shutil.copyfile(os.path.join(config["repo_path"] + "/out/Release/", "Updater.exe"), os.path.join(config["repo_path"] + "/out/Release/portable", "Updater.exe")) shutil.copytree(config["repo_path"] + "/out/Release/modules", config["repo_path"] + "/out/Release/portable/modules") log("Files copied to 'portable' folder", 3) except: