Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/telegramdesktop/tdesktop int…
Browse files Browse the repository at this point in the history
…o telegramdesktop-dev
  • Loading branch information
xmdnx committed Oct 26, 2023
2 parents 3b366bf + cd0f58f commit 46e98ec
Show file tree
Hide file tree
Showing 27 changed files with 237 additions and 100 deletions.
Binary file added Telegram/Resources/icons/menu/boosts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/boosts@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Telegram/Resources/icons/menu/boosts@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Telegram/Resources/uwp/AppX/AppxManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="4.10.4.0" />
Version="4.10.5.0" />
<Properties>
<DisplayName>rabbitGram Desktop</DisplayName>
<PublisherDisplayName>xmdnx</PublisherDisplayName>
Expand Down
8 changes: 4 additions & 4 deletions Telegram/Resources/winrc/Telegram.rc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 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
Expand All @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions Telegram/Resources/winrc/Updater.rc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 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
Expand All @@ -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"
Expand Down
34 changes: 28 additions & 6 deletions Telegram/SourceFiles/_other/packer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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\
MIIEvQIBADAN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DgCxDOpmlf2cODd\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;
Expand Down
49 changes: 36 additions & 13 deletions Telegram/SourceFiles/api/api_statistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,19 +434,42 @@ void MessageStatistics::request(Fn<void(Data::MessageStatistics)> 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<MTPInputMessage>(
1,
MTP_inputMessageID(MTP_int(_fullId.msg))))
).done([=](const MTPmessages_Messages &result) {
const auto process = [&](const MTPVector<MTPMessage> &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();
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/core/shortcuts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const auto CommandByName = base::flat_map<QString, Command>{
{ 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 },
//
};

Expand Down
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/core/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
19 changes: 18 additions & 1 deletion Telegram/SourceFiles/history/history_inner_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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<PhotoData*> photo, HistoryItem *item) {
const auto media = photo->activeMediaView();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -557,6 +541,14 @@ void InnerWidget::fill() {
lifetime().make_state<Api::Statistics>(&_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<MessagePreview>(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;
Expand All @@ -568,8 +560,7 @@ void InnerWidget::fill() {
const auto showPeerInfo = [=](not_null<PeerData*> peer) {
_showRequests.fire({ .info = peer->id });
};
const auto addSkip = [&](
not_null<Ui::VerticalLayout*> c) {
const auto addSkip = [&](not_null<Ui::VerticalLayout*> c) {
::Settings::AddSkip(c);
::Settings::AddDivider(c);
::Settings::AddSkip(c);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@ void AddBoostsList(
object_ptr<PeerListContent>(container, &state->controller)));
state->controller.setDelegate(&state->delegate);

if (max <= state->limit) {
return;
}
const auto wrap = container->add(
object_ptr<Ui::SlideWrap<Ui::SettingsButton>>(
container,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
6 changes: 4 additions & 2 deletions Telegram/SourceFiles/platform/win/integration_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <QtCore/QCoreApplication>
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions Telegram/SourceFiles/platform/win/main_window_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down
Loading

0 comments on commit 46e98ec

Please sign in to comment.