Skip to content

Commit

Permalink
Updated to 5.7.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Nov 14, 2024
2 parents 794b733 + 7e2e510 commit 886d6c9
Show file tree
Hide file tree
Showing 68 changed files with 2,428 additions and 365 deletions.
6 changes: 6 additions & 0 deletions Telegram/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ PRIVATE
api/api_bot.h
api/api_chat_filters.cpp
api/api_chat_filters.h
api/api_chat_filters_remove_manager.cpp
api/api_chat_filters_remove_manager.h
api/api_chat_invite.cpp
api/api_chat_invite.h
api/api_chat_links.cpp
Expand Down Expand Up @@ -642,6 +644,8 @@ PRIVATE
data/data_thread.h
data/data_types.cpp
data/data_types.h
data/data_unread_value.cpp
data/data_unread_value.h
data/data_user.cpp
data/data_user.h
data/data_user_photos.cpp
Expand Down Expand Up @@ -1549,6 +1553,8 @@ PRIVATE
ui/widgets/expandable_peer_list.h
ui/widgets/label_with_custom_emoji.cpp
ui/widgets/label_with_custom_emoji.h
ui/widgets/chat_filters_tabs_strip.cpp
ui/widgets/chat_filters_tabs_strip.h
ui/countryinput.cpp
ui/countryinput.h
ui/dynamic_thumbnails.cpp
Expand Down
3 changes: 3 additions & 0 deletions Telegram/Resources/langs/lang.strings
Original file line number Diff line number Diff line change
Expand Up @@ -5139,6 +5139,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_filters_toast_add" = "{chat} added to {folder} folder";
"lng_filters_toast_remove" = "{chat} removed from {folder} folder";
"lng_filters_shareable_status" = "shareable folder";
"lng_filters_view_subtitle" = "Tabs view";
"lng_filters_vertical" = "Tabs on the left";
"lng_filters_horizontal" = "Tabs at the top";

"lng_filters_delete_sure" = "Are you sure you want to delete this folder? This will also deactivate all the invite links created to share this folder.";
"lng_filters_link" = "Share Folder";
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="5.7.2.0" />
Version="5.7.3.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</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 5,7,2,0
PRODUCTVERSION 5,7,2,0
FILEVERSION 5,7,3,0
PRODUCTVERSION 5,7,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", ""
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "5.7.2.0"
VALUE "FileVersion", "5.7.3.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "5.7.2.0"
VALUE "ProductVersion", "5.7.3.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 5,7,2,0
PRODUCTVERSION 5,7,2,0
FILEVERSION 5,7,3,0
PRODUCTVERSION 5,7,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -53,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", ""
VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "5.7.2.0"
VALUE "FileVersion", "5.7.3.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "5.7.2.0"
VALUE "ProductVersion", "5.7.3.0"
END
END
BLOCK "VarFileInfo"
Expand Down
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/api/api_chat_filters.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 "boxes/premium_limits_box.h"
#include "boxes/filters/edit_filter_links.h" // FilterChatStatusText
#include "core/application.h"
#include "core/core_settings.h"
#include "data/data_channel.h"
#include "data/data_chat.h"
#include "data/data_chat_filters.h"
Expand Down Expand Up @@ -152,6 +153,7 @@ void InitFilterLinkHeader(
.badge = (type == Ui::FilterLinkHeaderType::AddingChats
? std::move(count)
: rpl::single(0)),
.horizontalFilters = Core::App().settings().chatFiltersHorizontal(),
});
const auto widget = header.widget;
widget->resizeToWidth(st::boxWideWidth);
Expand Down
128 changes: 128 additions & 0 deletions Telegram/SourceFiles/api/api_chat_filters_remove_manager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "api/api_chat_filters_remove_manager.h"

#include "api/api_chat_filters.h"
#include "apiwrap.h"
#include "data/data_chat_filters.h"
#include "data/data_peer.h"
#include "data/data_session.h"
#include "lang/lang_keys.h"
#include "main/main_session.h"
#include "ui/boxes/confirm_box.h"
#include "ui/ui_utility.h"
#include "window/window_controller.h"
#include "window/window_session_controller.h"
#include "styles/style_layers.h"

namespace Api {
namespace {

void RemoveChatFilter(
not_null<Main::Session*> session,
FilterId filterId,
std::vector<not_null<PeerData*>> leave) {
const auto api = &session->api();
session->data().chatsFilters().apply(MTP_updateDialogFilter(
MTP_flags(MTPDupdateDialogFilter::Flag(0)),
MTP_int(filterId),
MTPDialogFilter()));
if (leave.empty()) {
api->request(MTPmessages_UpdateDialogFilter(
MTP_flags(MTPmessages_UpdateDialogFilter::Flag(0)),
MTP_int(filterId),
MTPDialogFilter()
)).send();
} else {
api->request(MTPchatlists_LeaveChatlist(
MTP_inputChatlistDialogFilter(MTP_int(filterId)),
MTP_vector<MTPInputPeer>(ranges::views::all(
leave
) | ranges::views::transform([](not_null<PeerData*> peer) {
return MTPInputPeer(peer->input);
}) | ranges::to<QVector<MTPInputPeer>>())
)).done([=](const MTPUpdates &result) {
api->applyUpdates(result);
}).send();
}
}

} // namespace

RemoveComplexChatFilter::RemoveComplexChatFilter() = default;

void RemoveComplexChatFilter::request(
QPointer<Ui::RpWidget> widget,
base::weak_ptr<Window::SessionController> weak,
FilterId id) {
const auto session = &weak->session();
const auto &list = session->data().chatsFilters().list();
const auto i = ranges::find(list, id, &Data::ChatFilter::id);
const auto filter = (i != end(list)) ? *i : Data::ChatFilter();
const auto has = filter.hasMyLinks();
const auto confirm = [=](Fn<void()> action, bool onlyWhenHas = false) {
if (!has && onlyWhenHas) {
action();
return;
}
weak->window().show(Ui::MakeConfirmBox({
.text = (has
? tr::lng_filters_delete_sure()
: tr::lng_filters_remove_sure()),
.confirmed = [=](Fn<void()> &&close) { close(); action(); },
.confirmText = (has
? tr::lng_box_delete()
: tr::lng_filters_remove_yes()),
.confirmStyle = &st::attentionBoxButton,
}));
};
const auto simple = [=] {
confirm([=] { RemoveChatFilter(session, id, {}); });
};
const auto suggestRemoving = Api::ExtractSuggestRemoving(filter);
if (suggestRemoving.empty()) {
simple();
return;
} else if (_removingRequestId) {
if (_removingId == id) {
return;
}
session->api().request(_removingRequestId).cancel();
}
_removingId = id;
_removingRequestId = session->api().request(
MTPchatlists_GetLeaveChatlistSuggestions(
MTP_inputChatlistDialogFilter(
MTP_int(id)))
).done(crl::guard(widget, [=, this](const MTPVector<MTPPeer> &result) {
_removingRequestId = 0;
const auto suggestRemovePeers = ranges::views::all(
result.v
) | ranges::views::transform([=](const MTPPeer &peer) {
return session->data().peer(peerFromMTP(peer));
}) | ranges::to_vector;
const auto chosen = crl::guard(widget, [=](
std::vector<not_null<PeerData*>> peers) {
RemoveChatFilter(session, id, std::move(peers));
});
confirm(crl::guard(widget, [=] {
Api::ProcessFilterRemove(
weak,
filter.title(),
filter.iconEmoji(),
suggestRemoving,
suggestRemovePeers,
chosen);
}), true);
})).fail(crl::guard(widget, [=, this] {
_removingRequestId = 0;
simple();
})).send();
}

} // namespace Api
35 changes: 35 additions & 0 deletions Telegram/SourceFiles/api/api_chat_filters_remove_manager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once

namespace Window {
class SessionController;
} // namespace Window

namespace Ui {
class RpWidget;
} // namespace Ui

namespace Api {

class RemoveComplexChatFilter final {
public:
RemoveComplexChatFilter();

void request(
QPointer<Ui::RpWidget> widget,
base::weak_ptr<Window::SessionController> weak,
FilterId id);

private:
FilterId _removingId = 0;
mtpRequestId _removingRequestId = 0;

};

} // namespace Api
50 changes: 42 additions & 8 deletions Telegram/SourceFiles/boxes/peer_list_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ void PeerListBox::keyPressEvent(QKeyEvent *e) {
content()->selectSkipPage(height(), 1);
} else if (e->key() == Qt::Key_PageUp) {
content()->selectSkipPage(height(), -1);
} else if (e->key() == Qt::Key_Escape && _select && !_select->entity()->getQuery().isEmpty()) {
} else if (e->key() == Qt::Key_Escape
&& _select
&& !_select->entity()->getQuery().isEmpty()) {
_select->entity()->clearQuery();
} else {
BoxContent::keyPressEvent(e);
Expand All @@ -215,7 +217,16 @@ void PeerListBox::keyPressEvent(QKeyEvent *e) {

void PeerListBox::searchQueryChanged(const QString &query) {
scrollToY(0);
content()->searchQueryChanged(query);
const auto isEmpty = content()->searchQueryChanged(query);
if (_specialTabsMode.enabled) {
_specialTabsMode.searchIsActive = !isEmpty;
if (_specialTabsMode.searchIsActive) {
_specialTabsMode.topSkip = _addedTopScrollSkip;
setAddedTopScrollSkip(0);
} else {
setAddedTopScrollSkip(_specialTabsMode.topSkip);
}
}
}

void PeerListBox::resizeEvent(QResizeEvent *e) {
Expand Down Expand Up @@ -543,6 +554,19 @@ auto PeerListBox::collectSelectedRows()
return result;
}

rpl::producer<int> PeerListBox::multiSelectHeightValue() const {
return _select ? _select->heightValue() : rpl::single(0);
}

void PeerListBox::setSpecialTabMode(bool value) {
content()->setIgnoreHiddenRowsOnSearch(value);
if (value) {
_specialTabsMode.enabled = true;
} else {
_specialTabsMode = {};
}
}

PeerListRow::PeerListRow(not_null<PeerData*> peer)
: PeerListRow(peer, peer->id.value) {
}
Expand Down Expand Up @@ -1385,10 +1409,12 @@ int PeerListContent::labelHeight() const {

void PeerListContent::refreshRows() {
if (!_hiddenRows.empty()) {
_filterResults.clear();
for (const auto &row : _rows) {
if (!row->hidden()) {
_filterResults.push_back(row.get());
if (!_ignoreHiddenRowsOnSearch || _normalizedSearchQuery.isEmpty()) {
_filterResults.clear();
for (const auto &row : _rows) {
if (!row->hidden()) {
_filterResults.push_back(row.get());
}
}
}
}
Expand Down Expand Up @@ -2050,13 +2076,16 @@ void PeerListContent::checkScrollForPreload() {
}
}

void PeerListContent::searchQueryChanged(QString query) {
PeerListContent::IsEmpty PeerListContent::searchQueryChanged(QString query) {
const auto searchWordsList = TextUtilities::PrepareSearchWords(query);
const auto normalizedQuery = searchWordsList.join(' ');
if (_ignoreHiddenRowsOnSearch && !normalizedQuery.isEmpty()) {
_filterResults.clear();
}
if (_normalizedSearchQuery != normalizedQuery) {
setSearchQuery(query, normalizedQuery);
if (_controller->searchInLocal() && !searchWordsList.isEmpty()) {
Assert(_hiddenRows.empty());
Assert(_hiddenRows.empty() || _ignoreHiddenRowsOnSearch);

auto minimalList = (const std::vector<not_null<PeerListRow*>>*)nullptr;
for (const auto &searchWord : searchWordsList) {
Expand Down Expand Up @@ -2104,6 +2133,7 @@ void PeerListContent::searchQueryChanged(QString query) {
}
refreshRows();
}
return _normalizedSearchQuery.isEmpty();
}

std::unique_ptr<PeerListState> PeerListContent::saveState() const {
Expand Down Expand Up @@ -2192,6 +2222,10 @@ void PeerListContent::dragLeft() {
clearSelection();
}

void PeerListContent::setIgnoreHiddenRowsOnSearch(bool value) {
_ignoreHiddenRowsOnSearch = value;
}

void PeerListContent::visibleTopBottomUpdated(
int visibleTop,
int visibleBottom) {
Expand Down
Loading

0 comments on commit 886d6c9

Please sign in to comment.