Skip to content

Commit

Permalink
Updated to 5.10.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Jan 27, 2025
2 parents e8bc3f7 + d3142eb commit 29879bf
Show file tree
Hide file tree
Showing 20 changed files with 174 additions and 131 deletions.
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.10.5.0" />
Version="5.10.6.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,10,5,0
PRODUCTVERSION 5,10,5,0
FILEVERSION 5,10,6,0
PRODUCTVERSION 5,10,6,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", ""
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "5.10.5.0"
VALUE "FileVersion", "5.10.6.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2025"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "5.10.5.0"
VALUE "ProductVersion", "5.10.6.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,10,5,0
PRODUCTVERSION 5,10,5,0
FILEVERSION 5,10,6,0
PRODUCTVERSION 5,10,6,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.10.5.0"
VALUE "FileVersion", "5.10.6.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2025"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "5.10.5.0"
VALUE "ProductVersion", "5.10.6.0"
END
END
BLOCK "VarFileInfo"
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/api/api_premium.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ std::optional<Data::SavedStarGift> FromTL(
using Id = Data::SavedStarGiftId;
return Data::SavedStarGift{
.info = std::move(*parsed),
.id = (to->isUser()
.manageId = (to->isUser()
? Id::User(data.vmsg_id().value_or_empty())
: Id::Chat(to, data.vsaved_id().value_or_empty())),
.message = (data.vmessage()
Expand Down
10 changes: 10 additions & 0 deletions Telegram/SourceFiles/boxes/moderate_messages_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ ModerateOptions CalculateModerateOptions(const HistoryItemsList &items) {
if (peer != item->history()->peer) {
return {};
}
{
const auto author = item->author();
if (author == peer) {
return {};
} else if (const auto channel = author->asChannel()) {
if (channel->linkedChat() == peer) {
return {};
}
}
}
if (!item->suggestBanReport()) {
result.allCanBan = false;
}
Expand Down
33 changes: 18 additions & 15 deletions Telegram/SourceFiles/boxes/star_gift_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,21 @@ void PreviewWrap::paintEvent(QPaintEvent *e) {
for (auto &gift : gifts) {
list.push_back({ .info = gift });
}
ranges::sort(list, [](
const GiftTypeStars &a,
const GiftTypeStars &b) {
if (!a.info.limitedCount && !b.info.limitedCount) {
return a.info.stars <= b.info.stars;
} else if (!a.info.limitedCount) {
return true;
} else if (!b.info.limitedCount) {
return false;
} else if (a.info.limitedLeft != b.info.limitedLeft) {
return a.info.limitedLeft > b.info.limitedLeft;
}
return a.info.stars <= b.info.stars;
});

auto &map = Map[session];
if (map.last != list) {
map.last = list;
Expand Down Expand Up @@ -2562,26 +2577,15 @@ void UpgradeBox(
const auto infoRow = [&](
rpl::producer<QString> title,
rpl::producer<QString> text,
not_null<const style::icon*> icon,
bool newBadge = false) {
not_null<const style::icon*> icon) {
auto raw = container->add(
object_ptr<Ui::VerticalLayout>(container));
const auto widget = raw->add(
raw->add(
object_ptr<Ui::FlatLabel>(
raw,
std::move(title) | Ui::Text::ToBold(),
st::defaultFlatLabel),
st::settingsPremiumRowTitlePadding);
if (newBadge) {
const auto badge = NewBadge::CreateNewBadge(
raw,
tr::lng_soon_badge(Ui::Text::Upper));
widget->geometryValue(
) | rpl::start_with_next([=](QRect geometry) {
badge->move(st::settingsPremiumNewBadgePosition
+ QPoint(widget->x() + widget->width(), widget->y()));
}, badge->lifetime());
}
raw->add(
object_ptr<Ui::FlatLabel>(
raw,
Expand All @@ -2605,8 +2609,7 @@ void UpgradeBox(
infoRow(
tr::lng_gift_upgrade_tradable_title(),
tr::lng_gift_upgrade_tradable_about(),
&st::menuIconTradable,
true);
&st::menuIconTradable);

struct State {
bool sent = false;
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 @@ -24,7 +24,7 @@ constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"_cs;
constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs;
constexpr auto AppName = "Telegram Desktop"_cs;
constexpr auto AppFile = "Telegram"_cs;
constexpr auto AppVersion = 5010005;
constexpr auto AppVersionStr = "5.10.5";
constexpr auto AppVersion = 5010006;
constexpr auto AppVersionStr = "5.10.6";
constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/data/data_star_gift.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class SavedStarGiftId {

struct SavedStarGift {
StarGift info;
SavedStarGiftId id;
SavedStarGiftId manageId;
TextWithEntities message;
int64 starsConverted = 0;
int64 starsUpgradedBySender = 0;
Expand Down
26 changes: 20 additions & 6 deletions Telegram/SourceFiles/history/view/history_view_list_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ For license and copyright information please follow this link:
#include "window/window_session_controller.h"
#include "window/window_peer_menu.h"
#include "main/main_session.h"
#include "ui/layers/generic_box.h"
#include "ui/widgets/popup_menu.h"
#include "ui/widgets/scroll_area.h"
#include "ui/toast/toast.h"
Expand All @@ -57,6 +58,7 @@ For license and copyright information please follow this link:
#include "ui/ui_utility.h"
#include "lang/lang_keys.h"
#include "boxes/delete_messages_box.h"
#include "boxes/moderate_messages_box.h"
#include "boxes/premium_preview_box.h"
#include "boxes/peers/edit_participant_box.h"
#include "core/crash_reports.h"
Expand Down Expand Up @@ -4289,18 +4291,30 @@ void ConfirmDeleteSelectedItems(not_null<ListWidget*> widget) {
if (items.empty()) {
return;
}
const auto controller = widget->controller();
const auto owner = &controller->session().data();
auto historyItems = std::vector<not_null<HistoryItem*>>();
historyItems.reserve(items.size());
for (const auto &item : items) {
if (!item.canDelete) {
return;
} else if (const auto i = owner->message(item.msgId)) {
historyItems.push_back(i);
}
}
auto box = Box<DeleteMessagesBox>(
&widget->session(),
widget->getSelectedIds());
box->setDeleteConfirmedCallback(crl::guard(widget, [=] {
const auto confirmed = crl::guard(widget, [=] {
widget->cancelSelection();
}));
widget->controller()->show(std::move(box));
});
if (CanCreateModerateMessagesBox(historyItems)) {
controller->show(
Box(CreateModerateMessagesBox, historyItems, confirmed));
} else {
auto box = Box<DeleteMessagesBox>(
&widget->session(),
widget->getSelectedIds());
box->setDeleteConfirmedCallback(confirmed);
controller->show(std::move(box));
}
}

void ConfirmForwardSelectedItems(not_null<ListWidget*> widget) {
Expand Down
93 changes: 48 additions & 45 deletions Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ class InnerWidget final : public Ui::BoxContentDivider {
};
struct View {
std::unique_ptr<GiftButton> button;
Data::SavedStarGiftId id;
Data::SavedStarGiftId manageId;
uint64 giftId = 0;
int index = 0;
};

Expand All @@ -97,7 +98,7 @@ class InnerWidget final : public Ui::BoxContentDivider {
void loadMore();
void refreshButtons();
void validateButtons();
void showGift(Data::SavedStarGiftId id);
void showGift(int index);
void refreshAbout();

int resizeGetHeight(int width) override;
Expand Down Expand Up @@ -164,7 +165,7 @@ void InnerWidget::subscribeToUpdates() {
_peer->owner().giftUpdates(
) | rpl::start_with_next([=](const Data::GiftUpdate &update) {
const auto savedId = [](const Entry &entry) {
return entry.gift.id;
return entry.gift.manageId;
};
const auto i = ranges::find(_entries, update.id, savedId);
if (i == end(_entries)) {
Expand Down Expand Up @@ -194,7 +195,7 @@ void InnerWidget::subscribeToUpdates() {
for (auto &view : _views) {
if (view.index == index) {
view.index = -1;
view.id = {};
view.manageId = {};
}
}
} else {
Expand Down Expand Up @@ -321,56 +322,59 @@ void InnerWidget::validateButtons() {
auto y = vskip + fromRow * oneh;
auto views = std::vector<View>();
views.reserve((tillRow - fromRow) * _perRow);
const auto idUsed = [&](const Data::SavedStarGiftId &id) {
for (auto j = fromRow; j != tillRow; ++j) {
for (auto i = 0; i != _perRow; ++i) {
const auto idUsed = [&](uint64 giftId, int column, int row) {
for (auto j = row; j != tillRow; ++j) {
for (auto i = column; i != _perRow; ++i) {
const auto index = j * _perRow + i;
if (index >= _entries.size()) {
return false;
} else if (_entries[index].gift.id == id) {
} else if (_entries[index].gift.info.id == giftId) {
return true;
}
}
column = 0;
}
return false;
};
const auto add = [&](int index) {
const auto id = _entries[index].gift.id;
const auto already = ranges::find(_views, id, &View::id);
const auto add = [&](int column, int row) {
const auto index = row * _perRow + column;
if (index >= _entries.size()) {
return false;
}
const auto giftId = _entries[index].gift.info.id;
const auto manageId = _entries[index].gift.manageId;
const auto already = ranges::find(_views, giftId, &View::giftId);
if (already != end(_views)) {
views.push_back(base::take(*already));
views.back().index = index;
return;
}
const auto &descriptor = _entries[index].descriptor;
const auto callback = [=] {
showGift(id);
};
const auto unused = ranges::find_if(_views, [&](const View &v) {
return v.button && !idUsed(v.id);
});
if (unused != end(_views)) {
views.push_back(base::take(*unused));
views.back().index = index;
} else {
auto button = std::make_unique<GiftButton>(this, &_delegate);
button->show();
views.push_back({
.button = std::move(button),
.id = id,
.index = index,
const auto &descriptor = _entries[index].descriptor;
const auto unused = ranges::find_if(_views, [&](const View &v) {
return v.button && !idUsed(v.giftId, column, row);
});
if (unused != end(_views)) {
views.push_back(base::take(*unused));
} else {
auto button = std::make_unique<GiftButton>(this, &_delegate);
button->show();
views.push_back({ .button = std::move(button) });
}
auto &view = views.back();
const auto callback = [=] {
showGift(index);
};
view.index = index;
view.manageId = manageId;
view.giftId = giftId;
view.button->setDescriptor(descriptor, mode);
view.button->setClickedCallback(callback);
}
views.back().button->setDescriptor(descriptor, mode);
views.back().button->setClickedCallback(callback);
};
return true;
};
for (auto j = fromRow; j != tillRow; ++j) {
for (auto i = 0; i != _perRow; ++i) {
const auto index = j * _perRow + i;
if (index >= _entries.size()) {
if (!add(i, j)) {
break;
}
add(index);
views.back().button->setGeometry(
QRect(QPoint(x, y), _single),
_delegate.buttonExtend());
Expand All @@ -382,15 +386,14 @@ void InnerWidget::validateButtons() {
std::swap(_views, views);
}

void InnerWidget::showGift(Data::SavedStarGiftId id) {
const auto savedId = [](const Entry &entry) {
return entry.gift.id;
};
const auto i = ranges::find(_entries, id, savedId);
if (i != end(_entries)) {
using namespace ::Settings;
_window->show(Box(SavedStarGiftBox, _window, _peer, i->gift));
}
void InnerWidget::showGift(int index) {
Expects(index >= 0 && index < _entries.size());

_window->show(Box(
::Settings::SavedStarGiftBox,
_window,
_peer,
_entries[index].gift));
}

void InnerWidget::refreshAbout() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ For license and copyright information please follow this link:
#include "ui/wrap/vertical_layout.h"
#include "ui/wrap/slide_wrap.h"
#include "ui/text/text_utilities.h"
#include "ui/vertical_list.h"
#include "boxes/peer_list_box.h"
#include "main/main_session.h"
#include "history/history.h"
Expand Down Expand Up @@ -610,11 +611,17 @@ void InnerWidget::setupContent() {
_content,
rpl::single(_poll->question),
st::pollResultsQuestion),
style::margins{
st::boxRowPadding.left(),
0,
st::boxRowPadding.right(),
st::boxMediumSkip });
st::boxRowPadding);
Ui::AddSkip(_content, st::boxLittleSkip / 2);
_content->add(
object_ptr<Ui::FlatLabel>(
_content,
tr::lng_polls_votes_count(
lt_count_decimal,
rpl::single(float64(_poll->totalVoters))),
st::boxDividerLabel),
st::boxRowPadding);
Ui::AddSkip(_content, st::boxLittleSkip);
for (const auto &answer : _poll->answers) {
const auto session = &_controller->session();
const auto controller = CreateAnswerRows(
Expand Down
Loading

0 comments on commit 29879bf

Please sign in to comment.