Skip to content

Commit

Permalink
Merge branch 'tdev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
xmdnx committed Nov 14, 2023
2 parents 1daac80 + 737d52e commit 1499d20
Show file tree
Hide file tree
Showing 79 changed files with 537 additions and 361 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/mac_packaged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

macos:
name: MacOS
runs-on: macos-latest
runs-on: macos-13

strategy:
matrix:
Expand All @@ -67,6 +67,8 @@ jobs:

- name: First set up.
run: |
brew update
brew upgrade || true
brew install autoconf automake boost cmake ffmpeg openal-soft openssl opus ninja pkg-config python qt yasm xz
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Expand Down
Binary file modified Telegram/Resources/icons/chat/input_forward.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 modified Telegram/Resources/icons/chat/input_forward@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 modified Telegram/Resources/icons/chat/input_forward@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Telegram/Resources/icons/chat/input_reply.png
Binary file not shown.
Binary file removed Telegram/Resources/icons/chat/input_reply@2x.png
Binary file not shown.
Binary file removed Telegram/Resources/icons/chat/input_reply@3x.png
Binary file not shown.
Binary file added Telegram/Resources/icons/chat/input_reply_quote.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Telegram/Resources/langs/lang.strings
Original file line number Diff line number Diff line change
Expand Up @@ -2714,6 +2714,8 @@ https://github.com/rabbitGramDesktop/rabbitGramDesktop/blob/dev/LEGAL
"lng_forwarding_from_two" = "{user} and {second_user}";
"lng_inline_switch_choose" = "Choose conversation...";
"lng_inline_switch_cant" = "Sorry, no way to write here :(";
"lng_preview_reply_to" = "Reply to {name}";
"lng_preview_reply_to_quote" = "Reply to quote by {name}";

"lng_reply_in_another_title" = "Reply in...";
"lng_reply_in_another_chat" = "Reply in Another Chat";
Expand Down
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.11.6.0" />
Version="4.11.7.0" />
<Properties>
<DisplayName>rabbitGram Desktop</DisplayName>
<PublisherDisplayName>xmdnx</PublisherDisplayName>
Expand Down
9 changes: 5 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,11,6,0
PRODUCTVERSION 4,11,6,0
FILEVERSION 4,11,7,0
PRODUCTVERSION 4,11,7,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -60,12 +60,13 @@ BEGIN
BEGIN
BLOCK "040904b0"
BEGIN
<<<<<<< HEAD
VALUE "CompanyName", "xmdnx"
VALUE "FileDescription", "rabbitGram Desktop"
VALUE "FileVersion", "4.11.6.0"
VALUE "FileVersion", "4.11.7.0"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "ProductName", "rabbitGram Desktop"
VALUE "ProductVersion", "4.11.6.0"
VALUE "ProductVersion", "4.11.7.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,11,6,0
PRODUCTVERSION 4,11,6,0
FILEVERSION 4,11,7,0
PRODUCTVERSION 4,11,7,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.11.6.0"
VALUE "FileVersion", "4.11.7.0"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "ProductName", "rabbitGram Desktop"
VALUE "ProductVersion", "4.11.6.0"
VALUE "ProductVersion", "4.11.7.0"
END
END
BLOCK "VarFileInfo"
Expand Down
148 changes: 83 additions & 65 deletions Telegram/SourceFiles/api/api_statistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ For license and copyright information please follow this link:
namespace Api {
namespace {

constexpr auto kCheckRequestsTimer = 10 * crl::time(1000);

[[nodiscard]] Data::StatisticalGraph StatisticalGraphFromTL(
const MTPStatsGraph &tl) {
return tl.match([&](const MTPDstatsGraph &d) {
Expand Down Expand Up @@ -187,36 +189,87 @@ namespace {

} // namespace

Statistics::Statistics(not_null<ApiWrap*> api)
: _api(&api->instance()) {
Statistics::Statistics(not_null<ChannelData*> channel)
: StatisticsRequestSender(channel) {
}

StatisticsRequestSender::StatisticsRequestSender(not_null<ChannelData *> channel)
: _channel(channel)
, _api(&_channel->session().api().instance())
, _timer([=] { checkRequests(); }) {
}

StatisticsRequestSender::~StatisticsRequestSender() {
for (const auto &[dcId, ids] : _requests) {
for (const auto id : ids) {
_channel->session().api().unregisterStatsRequest(dcId, id);
}
}
}

void StatisticsRequestSender::checkRequests() {
for (auto i = begin(_requests); i != end(_requests);) {
for (auto j = begin(i->second); j != end(i->second);) {
if (_api.pending(*j)) {
++j;
} else {
_channel->session().api().unregisterStatsRequest(
i->first,
*j);
j = i->second.erase(j);
}
}
if (i->second.empty()) {
i = _requests.erase(i);
} else {
++i;
}
}
if (_requests.empty()) {
_timer.cancel();
}
}

template <typename Request, typename, typename>
auto StatisticsRequestSender::makeRequest(Request &&request) {
const auto id = _api.allocateRequestId();
const auto dcId = _channel->owner().statsDcId(_channel);
if (dcId) {
_channel->session().api().registerStatsRequest(dcId, id);
_requests[dcId].emplace(id);
if (!_timer.isActive()) {
_timer.callEach(kCheckRequestsTimer);
}
}
return std::move(_api.request(
std::forward<Request>(request)
).toDC(
dcId ? MTP::ShiftDcId(dcId, MTP::kStatsDcShift) : 0
).overrideId(id));
}

rpl::producer<rpl::no_value, QString> Statistics::request(
not_null<PeerData*> peer) {
rpl::producer<rpl::no_value, QString> Statistics::request() {
return [=](auto consumer) {
auto lifetime = rpl::lifetime();
const auto channel = peer->asChannel();
if (!channel) {
return lifetime;
}

if (!channel->isMegagroup()) {
_api.request(MTPstats_GetBroadcastStats(
if (!channel()->isMegagroup()) {
makeRequest(MTPstats_GetBroadcastStats(
MTP_flags(MTPstats_GetBroadcastStats::Flags(0)),
channel->inputChannel
channel()->inputChannel
)).done([=](const MTPstats_BroadcastStats &result) {
_channelStats = ChannelStatisticsFromTL(result.data());
consumer.put_done();
}).fail([=](const MTP::Error &error) {
consumer.put_error_copy(error.type());
}).send();
} else {
_api.request(MTPstats_GetMegagroupStats(
makeRequest(MTPstats_GetMegagroupStats(
MTP_flags(MTPstats_GetMegagroupStats::Flags(0)),
channel->inputChannel
channel()->inputChannel
)).done([=](const MTPstats_MegagroupStats &result) {
_supergroupStats = SupergroupStatisticsFromTL(result.data());
peer->owner().processUsers(result.data().vusers());
const auto &data = result.data();
_supergroupStats = SupergroupStatisticsFromTL(data);
channel()->owner().processUsers(data.vusers());
consumer.put_done();
}).fail([=](const MTP::Error &error) {
consumer.put_error_copy(error.type());
Expand All @@ -228,18 +281,13 @@ rpl::producer<rpl::no_value, QString> Statistics::request(
}

Statistics::GraphResult Statistics::requestZoom(
not_null<PeerData*> peer,
const QString &token,
float64 x) {
return [=](auto consumer) {
auto lifetime = rpl::lifetime();
const auto channel = peer->asChannel();
if (!channel) {
return lifetime;
}
const auto wasEmpty = _zoomDeque.empty();
_zoomDeque.push_back([=] {
_api.request(MTPstats_LoadAsyncGraph(
makeRequest(MTPstats_LoadAsyncGraph(
MTP_flags(x
? MTPstats_LoadAsyncGraph::Flag::f_x
: MTPstats_LoadAsyncGraph::Flag(0)),
Expand All @@ -266,32 +314,6 @@ Statistics::GraphResult Statistics::requestZoom(
};
}

Statistics::GraphResult Statistics::requestMessage(
not_null<PeerData*> peer,
MsgId msgId) {
return [=](auto consumer) {
auto lifetime = rpl::lifetime();
const auto channel = peer->asChannel();
if (!channel) {
return lifetime;
}

_api.request(MTPstats_GetMessageStats(
MTP_flags(MTPstats_GetMessageStats::Flags(0)),
channel->inputChannel,
MTP_int(msgId.bare)
)).done([=](const MTPstats_MessageStats &result) {
consumer.put_next(
StatisticalGraphFromTL(result.data().vviews_graph()));
consumer.put_done();
}).fail([=](const MTP::Error &error) {
consumer.put_error_copy(error.type());
}).send();

return lifetime;
};
}

Data::ChannelStatistics Statistics::channelStats() const {
return _channelStats;
}
Expand All @@ -303,9 +325,8 @@ Data::SupergroupStatistics Statistics::supergroupStats() const {
PublicForwards::PublicForwards(
not_null<ChannelData*> channel,
FullMsgId fullId)
: _channel(channel)
, _fullId(fullId)
, _api(&channel->session().api().instance()) {
: StatisticsRequestSender(channel)
, _fullId(fullId) {
}

void PublicForwards::request(
Expand All @@ -314,19 +335,19 @@ void PublicForwards::request(
if (_requestId) {
return;
}
const auto offsetPeer = _channel->owner().peer(token.fullId.peer);
const auto offsetPeer = channel()->owner().peer(token.fullId.peer);
const auto tlOffsetPeer = offsetPeer
? offsetPeer->input
: MTP_inputPeerEmpty();
constexpr auto kLimit = tl::make_int(100);
_requestId = _api.request(MTPstats_GetMessagePublicForwards(
_channel->inputChannel,
_requestId = makeRequest(MTPstats_GetMessagePublicForwards(
channel()->inputChannel,
MTP_int(_fullId.msg),
MTP_int(token.rate),
tlOffsetPeer,
MTP_int(token.fullId.msg),
kLimit
)).done([=, channel = _channel](const MTPmessages_Messages &result) {
)).done([=, channel = channel()](const MTPmessages_Messages &result) {
using Messages = QVector<FullMsgId>;
_requestId = 0;

Expand Down Expand Up @@ -402,21 +423,19 @@ void PublicForwards::request(
MessageStatistics::MessageStatistics(
not_null<ChannelData*> channel,
FullMsgId fullId)
: _publicForwards(channel, fullId)
, _channel(channel)
, _fullId(fullId)
, _api(&channel->session().api().instance()) {
: StatisticsRequestSender(channel)
, _publicForwards(channel, fullId)
, _fullId(fullId) {
}

Data::PublicForwardsSlice MessageStatistics::firstSlice() const {
return _firstSlice;
}

void MessageStatistics::request(Fn<void(Data::MessageStatistics)> done) {
if (_channel->isMegagroup()) {
if (channel()->isMegagroup()) {
return;
}

const auto requestFirstPublicForwards = [=](
const Data::StatisticalGraph &messageGraph,
const Data::StatisticsMessageInteractionInfo &info) {
Expand All @@ -434,8 +453,8 @@ void MessageStatistics::request(Fn<void(Data::MessageStatistics)> done) {

const auto requestPrivateForwards = [=](
const Data::StatisticalGraph &messageGraph) {
_api.request(MTPchannels_GetMessages(
_channel->inputChannel,
api().request(MTPchannels_GetMessages(
channel()->inputChannel,
MTP_vector<MTPInputMessage>(
1,
MTP_inputMessageID(MTP_int(_fullId.msg))))
Expand Down Expand Up @@ -475,17 +494,16 @@ void MessageStatistics::request(Fn<void(Data::MessageStatistics)> done) {
}).send();
};

_api.request(MTPstats_GetMessageStats(
makeRequest(MTPstats_GetMessageStats(
MTP_flags(MTPstats_GetMessageStats::Flags(0)),
_channel->inputChannel,
channel()->inputChannel,
MTP_int(_fullId.msg.bare)
)).done([=](const MTPstats_MessageStats &result) {
requestPrivateForwards(
StatisticalGraphFromTL(result.data().vviews_graph()));
}).fail([=](const MTP::Error &error) {
requestPrivateForwards({});
}).send();

}

Boosts::Boosts(not_null<PeerData*> peer)
Expand Down
Loading

0 comments on commit 1499d20

Please sign in to comment.