Skip to content

Commit

Permalink
Updated to 5.9.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Dec 27, 2024
2 parents 386b8c6 + 4505a2b commit e30dc5f
Show file tree
Hide file tree
Showing 52 changed files with 544 additions and 236 deletions.
2 changes: 2 additions & 0 deletions Telegram/Resources/langs/lang.strings
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,7 @@ /~https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_gift_stars_sold_out" = "sold out";
"lng_gift_stars_tabs_all" = "All Gifts";
"lng_gift_stars_tabs_limited" = "Limited";
"lng_gift_stars_tabs_in_stock" = "In Stock";
"lng_gift_send_title" = "Send a Gift";
"lng_gift_send_message" = "Enter Message";
"lng_gift_send_anonymous" = "Hide My Name";
Expand Down Expand Up @@ -3691,6 +3692,7 @@ /~https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_context_mark_read_sure" = "Are you sure you want to mark all chats from this folder as read?";
"lng_context_mark_read_all" = "Mark all chats as read";
"lng_context_mark_read_all_sure" = "Are you sure you want to mark all chats as read?";
"lng_context_mark_read_all_sure_2" = "**This action cannot be undone.**";
"lng_context_mark_read_mentions_all" = "Mark all mentions as read";
"lng_context_mark_read_reactions_all" = "Read all reactions";
"lng_context_archive_expand" = "Expand";
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.9.1.0" />
Version="5.9.2.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,9,1,0
PRODUCTVERSION 5,9,1,0
FILEVERSION 5,9,2,0
PRODUCTVERSION 5,9,2,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", ""
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "5.9.1.0"
VALUE "FileVersion", "5.9.2.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "5.9.1.0"
VALUE "ProductVersion", "5.9.2.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,9,1,0
PRODUCTVERSION 5,9,1,0
FILEVERSION 5,9,2,0
PRODUCTVERSION 5,9,2,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.9.1.0"
VALUE "FileVersion", "5.9.2.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "5.9.1.0"
VALUE "ProductVersion", "5.9.2.0"
END
END
BLOCK "VarFileInfo"
Expand Down
13 changes: 9 additions & 4 deletions Telegram/SourceFiles/api/api_chat_filters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ void InitFilterLinkHeader(
Ui::FilterLinkHeaderType type,
const QString &title,
const QString &iconEmoji,
rpl::producer<int> count) {
rpl::producer<int> count,
bool horizontalFilters) {
const auto icon = Ui::LookupFilterIcon(
Ui::LookupFilterIconByEmoji(
iconEmoji
Expand All @@ -154,7 +155,7 @@ void InitFilterLinkHeader(
.badge = (type == Ui::FilterLinkHeaderType::AddingChats
? std::move(count)
: rpl::single(0)),
.horizontalFilters = Core::App().settings().chatFiltersHorizontal(),
.horizontalFilters = horizontalFilters,
});
const auto widget = header.widget;
widget->resizeToWidth(st::boxWideWidth);
Expand Down Expand Up @@ -593,6 +594,8 @@ void ProcessFilterInvite(
title,
std::move(peers),
std::move(already));
const auto horizontalFilters = !strong->enoughSpaceForFilters()
|| Core::App().settings().chatFiltersHorizontal();
const auto raw = controller.get();
auto initBox = [=](not_null<PeerListBox*> box) {
box->setStyle(st::filterInviteBox);
Expand All @@ -609,7 +612,7 @@ void ProcessFilterInvite(
});
InitFilterLinkHeader(box, [=](int min, int max, int addedTop) {
raw->adjust(min, max, addedTop);
}, type, title, iconEmoji, rpl::duplicate(badge));
}, type, title, iconEmoji, rpl::duplicate(badge), horizontalFilters);

raw->setRealContentHeight(box->heightValue());

Expand Down Expand Up @@ -821,6 +824,8 @@ void ProcessFilterRemove(
title,
std::move(suggest),
std::move(all));
const auto horizontalFilters = !strong->enoughSpaceForFilters()
|| Core::App().settings().chatFiltersHorizontal();
const auto raw = controller.get();
auto initBox = [=](not_null<PeerListBox*> box) {
box->setStyle(st::filterInviteBox);
Expand All @@ -832,7 +837,7 @@ void ProcessFilterRemove(
});
InitFilterLinkHeader(box, [=](int min, int max, int addedTop) {
raw->adjust(min, max, addedTop);
}, type, title, iconEmoji, rpl::single(0));
}, type, title, iconEmoji, rpl::single(0), horizontalFilters);

auto owned = Ui::FilterLinkProcessButton(
box,
Expand Down
5 changes: 5 additions & 0 deletions Telegram/SourceFiles/api/api_messages_search_merged.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,17 @@ const FoundMessages &MessagesSearchMerged::messages() const {
return _concatedFound;
}

const MessagesSearch::Request &MessagesSearchMerged::request() const {
return _request;
}

void MessagesSearchMerged::clear() {
_concatedFound = {};
_migratedFirstFound = {};
}

void MessagesSearchMerged::search(const Request &search) {
_request = search;
if (_migratedSearch) {
_waitingForTotal = true;
_migratedSearch->searchMessages(search);
Expand Down
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/api/api_messages_search_merged.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class MessagesSearchMerged final {
void searchMore();

[[nodiscard]] const FoundMessages &messages() const;
[[nodiscard]] const Request &request() const;

[[nodiscard]] rpl::producer<> newFounds() const;
[[nodiscard]] rpl::producer<> nextFounds() const;
Expand All @@ -39,6 +40,7 @@ class MessagesSearchMerged final {
void addFound(const FoundMessages &data);

MessagesSearch _apiSearch;
Request _request;

std::optional<MessagesSearch> _migratedSearch;
FoundMessages _migratedFirstFound;
Expand Down
10 changes: 10 additions & 0 deletions Telegram/SourceFiles/boxes/peer_list_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ void PeerListBox::createMultiSelect() {
content()->submitted();
});
_select->entity()->setQueryChangedCallback([=](const QString &query) {
if (_customQueryChangedCallback) {
_customQueryChangedCallback(query);
}
searchQueryChanged(query);
});
_select->entity()->setItemRemovedCallback([=](uint64 itemId) {
Expand All @@ -138,6 +141,10 @@ void PeerListBox::createMultiSelect() {
_select->moveToLeft(0, 0);
}

void PeerListBox::appendQueryChangedCallback(Fn<void(QString)> callback) {
_customQueryChangedCallback = std::move(callback);
}

void PeerListBox::setAddedTopScrollSkip(int skip) {
_addedTopScrollSkip = skip;
_scrollBottomFixed = false;
Expand Down Expand Up @@ -1274,6 +1281,9 @@ void PeerListContent::clearAllContent() {
= _normalizedSearchQuery
= _mentionHighlight
= QString();
if (_controller->hasComplexSearch()) {
_controller->search(QString());
}
}

void PeerListContent::convertRowToSearchResult(not_null<PeerListRow*> row) {
Expand Down
3 changes: 3 additions & 0 deletions Telegram/SourceFiles/boxes/peer_list_box.h
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,8 @@ class PeerListBox

void showFinished() override;

void appendQueryChangedCallback(Fn<void(QString)>);

protected:
void prepare() override;
void setInnerFocus() override;
Expand Down Expand Up @@ -1174,6 +1176,7 @@ class PeerListBox
object_ptr<Ui::SlideWrap<Ui::MultiSelect>> _select = { nullptr };

const std::shared_ptr<Main::SessionShow> _show;
Fn<void(QString)> _customQueryChangedCallback;
std::unique_ptr<PeerListController> _controller;
Fn<void(PeerListBox*)> _init;
bool _scrollBottomFixed = false;
Expand Down
34 changes: 27 additions & 7 deletions Telegram/SourceFiles/boxes/star_gift_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ namespace {

constexpr auto kPriceTabAll = 0;
constexpr auto kPriceTabLimited = -1;
constexpr auto kPriceTabInStock = -2;
constexpr auto kGiftMessageLimit = 255;
constexpr auto kSentToastDuration = 3 * crl::time(1000);

Expand Down Expand Up @@ -159,6 +160,10 @@ class PreviewWrap final : public Ui::RpWidget {
return is(now) || is(now.addDays(1)) || is(now.addDays(-1));
}

[[nodiscard]] bool IsSoldOut(const Api::StarGift &info) {
return info.limitedCount && !info.limitedLeft;
}

PreviewDelegate::PreviewDelegate(
not_null<QWidget*> parent,
not_null<Ui::ChatStyle*> st,
Expand Down Expand Up @@ -557,6 +562,8 @@ void PreviewWrap::paintEvent(QPaintEvent *e) {
return simple(tr::lng_gift_stars_tabs_all(tr::now));
} else if (price == kPriceTabLimited) {
return simple(tr::lng_gift_stars_tabs_limited(tr::now));
} else if (price == kPriceTabInStock) {
return simple(tr::lng_gift_stars_tabs_in_stock(tr::now));
}
auto &manager = session->data().customEmojiManager();
auto result = Text::String();
Expand Down Expand Up @@ -613,8 +620,12 @@ struct GiftPriceTabs {
) | rpl::map([](const std::vector<GiftTypeStars> &gifts) {
auto result = std::vector<int>();
result.push_back(kPriceTabAll);
auto special = 1;
auto same = true;
auto sameKey = 0;
auto hasNonSoldOut = false;
auto hasSoldOut = false;
auto hasLimited = false;
for (const auto &gift : gifts) {
if (same) {
const auto key = gift.info.stars
Expand All @@ -625,10 +636,13 @@ struct GiftPriceTabs {
same = false;
}
}

if (gift.info.limitedCount
&& (result.size() < 2 || result[1] != kPriceTabLimited)) {
result.insert(begin(result) + 1, kPriceTabLimited);
if (IsSoldOut(gift.info)) {
hasSoldOut = true;
} else {
hasNonSoldOut = true;
}
if (gift.info.limitedCount) {
hasLimited = true;
}
if (!ranges::contains(result, gift.info.stars)) {
result.push_back(gift.info.stars);
Expand All @@ -637,6 +651,12 @@ struct GiftPriceTabs {
if (same) {
return std::vector<int>();
}
if (hasSoldOut && hasNonSoldOut) {
result.insert(begin(result) + (special++), kPriceTabInStock);
}
if (hasLimited) {
result.insert(begin(result) + (special++), kPriceTabLimited);
}
ranges::sort(begin(result) + 1, end(result));
return result;
});
Expand Down Expand Up @@ -1191,9 +1211,7 @@ void SendGiftBox(

button->setClickedCallback([=] {
const auto star = std::get_if<GiftTypeStars>(&descriptor);
if (star
&& star->info.limitedCount
&& !star->info.limitedLeft) {
if (star && IsSoldOut(star->info)) {
window->show(Box(SoldOutBox, window, *star));
} else {
window->show(
Expand Down Expand Up @@ -1298,6 +1316,8 @@ void AddBlock(
gifts.erase(ranges::remove_if(gifts, [&](const GiftTypeStars &gift) {
return (price == kPriceTabLimited)
? (!gift.info.limitedCount)
: (price == kPriceTabInStock)
? IsSoldOut(gift.info)
: (price && gift.info.stars != price);
}), end(gifts));
return GiftsDescriptor{
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/calls/group/calls_group_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ void Panel::initLayout() {
#ifndef Q_OS_MAC
_controls->wrap.raise();

Ui::Platform::TitleControlsLayoutChanged(
_controls->controls.layout().changes(
) | rpl::start_with_next([=] {
// _menuToggle geometry depends on _controls arrangement.
crl::on_main(widget(), [=] { updateControlsGeometry(); });
Expand Down
22 changes: 20 additions & 2 deletions Telegram/SourceFiles/core/fork_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ QByteArray ForkSettings::serialize() const {
auto size = sizeof(qint32) * 4
+ Serialize::stringSize(_uriScheme)
+ Serialize::stringSize(_searchEngineUrl)
+ sizeof(qint32) * 12;
+ sizeof(qint32) * 12
+ Serialize::stringSize(_platformBot);

auto result = QByteArray();
result.reserve(size);
Expand Down Expand Up @@ -55,6 +56,7 @@ QByteArray ForkSettings::serialize() const {
<< qint32(_globalSearchDisabled ? 1 : 0)
<< qint32(_thirdButtonTopBar ? 1 : 0)
<< qint32(_skipShareFromBot ? 1 : 0)
<< _platformBot
;
}
return result;
Expand Down Expand Up @@ -88,6 +90,7 @@ void ForkSettings::addFromSerialized(const QByteArray &serialized) {
qint32 globalSearchDisabled = _globalSearchDisabled;
qint32 thirdButtonTopBar = _thirdButtonTopBar;
qint32 skipShareFromBot = _skipShareFromBot;
QString platformBot = _platformBot;

if (!stream.atEnd()) {
stream
Expand Down Expand Up @@ -123,6 +126,9 @@ void ForkSettings::addFromSerialized(const QByteArray &serialized) {
if (!stream.atEnd()) {
stream >> skipShareFromBot;
}
if (!stream.atEnd()) {
stream >> platformBot;
}
if (stream.status() != QDataStream::Ok) {
LOG(("App Error: "
"Bad data for Core::ForkSettings::constructFromSerialized()"));
Expand Down Expand Up @@ -150,13 +156,14 @@ void ForkSettings::addFromSerialized(const QByteArray &serialized) {
_globalSearchDisabled = (globalSearchDisabled == 1);
_thirdButtonTopBar = (thirdButtonTopBar == 1);
_skipShareFromBot = (skipShareFromBot == 1);
_platformBot = std::move(platformBot);
}

void ForkSettings::resetOnLastLogout() {
_squareUserpics = false;
_audioFade = true;
_askUriScheme = false;
_uriScheme = qsl("");
_uriScheme = QString();
_lastSeenInDialogs = false;
_searchEngineUrl = qsl("https://dgg.gg/%q");
_searchEngine = false;
Expand All @@ -172,6 +179,7 @@ void ForkSettings::resetOnLastLogout() {
_globalSearchDisabled = false;
_thirdButtonTopBar = false;
_skipShareFromBot = false;
_platformBot = QString();
}

[[nodiscard]] bool ForkSettings::primaryUnmutedMessages() const {
Expand Down Expand Up @@ -217,4 +225,14 @@ void ForkSettings::setSkipShareFromBot(bool newValue) {
_skipShareFromBot = newValue;
}

[[nodiscard]] QString ForkSettings::platformBot() const {
if (_platformBot.isEmpty()) {
return u"tdesktop"_q;
}
return _platformBot;
}
void ForkSettings::setPlatformBot(QString newValue) {
_platformBot = newValue;
}

} // namespace Core
Loading

0 comments on commit e30dc5f

Please sign in to comment.