Skip to content

Commit

Permalink
Merge branch 'telegramdesktop-dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
xmdnx committed Nov 9, 2023
2 parents 4cd5494 + 7eaa4c4 commit 2306ddd
Show file tree
Hide file tree
Showing 95 changed files with 2,344 additions and 819 deletions.
2 changes: 2 additions & 0 deletions Telegram/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ PRIVATE
boxes/peers/peer_short_info_box.h
boxes/peers/prepare_short_info_box.cpp
boxes/peers/prepare_short_info_box.h
boxes/peers/replace_boost_box.cpp
boxes/peers/replace_boost_box.h
boxes/about_box.cpp
boxes/about_box.h
boxes/about_sponsored_box.cpp
Expand Down
Binary file added Telegram/Resources/icons/chat/link_photo_enlarge.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.
Binary file modified Telegram/Resources/icons/menu/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/menu/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/menu/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.
Binary file modified Telegram/Resources/icons/menu/reply.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/menu/reply@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/menu/reply@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions Telegram/Resources/langs/lang.strings
Original file line number Diff line number Diff line change
Expand Up @@ -2030,6 +2030,7 @@ https://github.com/rabbitGramDesktop/rabbitGramDesktop/blob/dev/LEGAL
"lng_premium_gift_terms_link" = "here";

"lng_boost_channel_button" = "Boost Channel";
"lng_boost_again_button" = "Boost Again";
"lng_boost_level#one" = "Level {count}";
"lng_boost_level#other" = "Level {count}";
"lng_boost_channel_title_first" = "Enable stories for channel";
Expand All @@ -2051,6 +2052,11 @@ https://github.com/rabbitGramDesktop/rabbitGramDesktop/blob/dev/LEGAL
"lng_boost_channel_post_stories#other" = "post **{count} stories** per day";
"lng_boost_error_gifted_title" = "Can't boost with gifted Premium!";
"lng_boost_error_gifted_text" = "Because your **Telegram Premium** subscription was gifted to you, you can't use it to boost channels.";
"lng_boost_need_more" = "More boosts needed";
"lng_boost_need_more_text#one" = "To boost {channel}, gift **Telegram Premium** to a friend and get **{count}** boosts.";
"lng_boost_need_more_text#other" = "To boost {channel}, gift **Telegram Premium** to a friend and get **{count}** boosts.";
"lng_boost_need_more_again#one" = "To boost {channel} again, gift **Telegram Premium** to a friend and get **{count}** additional boost.";
"lng_boost_need_more_again#other" = "To boost {channel} again, gift **Telegram Premium** to a friend and get **{count}** additional boosts.";
"lng_boost_error_already_title" = "Already Boosted!";
"lng_boost_error_already_text" = "You are already boosting this channel.";
"lng_boost_error_premium_title" = "Premium needed!";
Expand All @@ -2060,6 +2066,19 @@ https://github.com/rabbitGramDesktop/rabbitGramDesktop/blob/dev/LEGAL
"lng_boost_error_flood_text" = "You can change the channel you boost only once a day. Next time you can boost is in {left}.";
"lng_boost_now_instead" = "You currently boost {channel}. Do you want to boost {other} instead?";
"lng_boost_now_replace" = "Replace";
"lng_boost_reassign_title" = "Reassign boost";
"lng_boost_reassign_text" = "To boost {channel}, reassign a previous boost or {gift}.";
"lng_boost_reassign_gift#one" = "gift **Telegram Premium** to a friend to get **{count}** additional boost";
"lng_boost_reassign_gift#other" = "gift **Telegram Premium** to a friend to get **{count}** additional boosts";
"lng_boost_remove_title" = "Remove your boost from";
"lng_boost_reassign_button" = "Reassign";
"lng_boost_available_in" = "available in {duration}";
"lng_boost_available_in_toast#one" = "Wait until the boost is available or get **{count}** more boost by gifting a **Telegram Premium** subscription.";
"lng_boost_available_in_toast#other" = "Wait until the boost is available or get **{count}** more boosts by gifting a **Telegram Premium** subscription.";
"lng_boost_reassign_done#one" = "{count} boost is reassigned from {channels}.";
"lng_boost_reassign_done#other" = "{count} boosts are reassigned from {channels}.";
"lng_boost_reassign_channels#one" = "{count} channel";
"lng_boost_reassign_channels#other" = "{count} channels";

"lng_boost_channel_title_color" = "Enable colors";
"lng_boost_channel_needs_level_color#one" = "Your channel needs to reach **Level {count}** to change channel color.";
Expand Down Expand Up @@ -2097,6 +2116,7 @@ https://github.com/rabbitGramDesktop/rabbitGramDesktop/blob/dev/LEGAL
"lng_giveaway_users_about" = "Choose if you want to limit the giveaway only to those who joined the channel after the giveaway started or to users from specific countries.";
"lng_giveaway_start" = "Start Giveaway";
"lng_giveaway_award" = "Gift Premium";
"lng_giveaway_start_sure" = "Are you sure you want to start this prepaid giveaway now? This action cannot be undone.";
"lng_giveaway_date_title" = "Date when giveaway ends";
"lng_giveaway_date" = "Date and Time";
"lng_giveaway_date_about#one" = "Choose when {count} subscriber of your channel will be randomly selected to receive Telegram Premium.";
Expand Down Expand Up @@ -4346,6 +4366,15 @@ https://github.com/rabbitGramDesktop/rabbitGramDesktop/blob/dev/LEGAL
"lng_boosts_list_tab_gifts#one" = "{count} Gifts";
"lng_boosts_list_tab_gifts#other" = "{count} Gifts";

"lng_boosts_prepaid_giveaway_title" = "Prepaid giveaways";
"lng_boosts_prepaid_giveaway_single" = "Prepaid giveaway";
"lng_boosts_prepaid_giveaway_quantity#one" = "{count} Telegram Premium";
"lng_boosts_prepaid_giveaway_quantity#other" = "{count} Telegram Premium";
"lng_boosts_prepaid_giveaway_moths#one" = "{count}-month subscriptions";
"lng_boosts_prepaid_giveaway_moths#other" = "{count}-month subscriptions";
"lng_boosts_prepaid_giveaway_status#one" = "{count} subscription {duration}";
"lng_boosts_prepaid_giveaway_status#other" = "{count} subscriptions {duration}";

// Wnd specific

"lng_wnd_choose_program_menu" = "Choose Default Program...";
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.5.0" />
Version="4.11.6.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,11,5,0
PRODUCTVERSION 4,11,5,0
FILEVERSION 4,11,6,0
PRODUCTVERSION 4,11,6,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.11.5.0"
VALUE "FileVersion", "4.11.6.0"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "ProductName", "rabbitGram Desktop"
VALUE "ProductVersion", "4.11.5.0"
VALUE "ProductVersion", "4.11.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 4,11,5,0
PRODUCTVERSION 4,11,5,0
FILEVERSION 4,11,6,0
PRODUCTVERSION 4,11,6,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.5.0"
VALUE "FileVersion", "4.11.6.0"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "ProductName", "rabbitGram Desktop"
VALUE "ProductVersion", "4.11.5.0"
VALUE "ProductVersion", "4.11.6.0"
END
END
BLOCK "VarFileInfo"
Expand Down
36 changes: 31 additions & 5 deletions Telegram/SourceFiles/api/api_premium.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,18 +390,44 @@ rpl::producer<rpl::no_value, QString> PremiumGiftCodeOptions::request() {
};
}

rpl::producer<rpl::no_value, QString> PremiumGiftCodeOptions::applyPrepaid(
const Payments::InvoicePremiumGiftCode &invoice,
uint64 prepaidId) {
return [=](auto consumer) {
auto lifetime = rpl::lifetime();
const auto channel = _peer->asChannel();
if (!channel) {
return lifetime;
}

_api.request(MTPpayments_LaunchPrepaidGiveaway(
_peer->input,
MTP_long(prepaidId),
Payments::InvoicePremiumGiftCodeGiveawayToTL(invoice)
)).done([=](const MTPUpdates &result) {
_peer->session().api().applyUpdates(result);
consumer.put_done();
}).fail([=](const MTP::Error &error) {
consumer.put_error_copy(error.type());
}).send();

return lifetime;
};
}

const std::vector<int> &PremiumGiftCodeOptions::availablePresets() const {
return _availablePresets;
}

[[nodiscard]] int PremiumGiftCodeOptions::monthsFromPreset(int monthsIndex) {
return _optionsForOnePerson.months[monthsIndex];
}

Payments::InvoicePremiumGiftCode PremiumGiftCodeOptions::invoice(
int users,
int monthsIndex) {
int months) {
const auto randomId = base::RandomValue<uint64>();
const auto token = Token{
users,
_optionsForOnePerson.months[monthsIndex],
};
const auto token = Token{ users, months };
const auto &store = _stores[token];
return Payments::InvoicePremiumGiftCode{
.randomId = randomId,
Expand Down
6 changes: 5 additions & 1 deletion Telegram/SourceFiles/api/api_premium.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,13 @@ class PremiumGiftCodeOptions final {
[[nodiscard]] rpl::producer<rpl::no_value, QString> request();
[[nodiscard]] Data::SubscriptionOptions options(int amount);
[[nodiscard]] const std::vector<int> &availablePresets() const;
[[nodiscard]] int monthsFromPreset(int monthsIndex);
[[nodiscard]] Payments::InvoicePremiumGiftCode invoice(
int users,
int monthsIndex);
int months);
[[nodiscard]] rpl::producer<rpl::no_value, QString> applyPrepaid(
const Payments::InvoicePremiumGiftCode &invoice,
uint64 prepaidId);

[[nodiscard]] int giveawayBoostsPerPremium() const;
[[nodiscard]] int giveawayCountriesMax() const;
Expand Down
21 changes: 19 additions & 2 deletions Telegram/SourceFiles/api/api_statistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,9 @@ rpl::producer<rpl::no_value, QString> Boosts::request() {
? (100. * premiumMemberCount / participantCount)
: 0;

const auto slots = data.vmy_boost_slots();
_boostStatus.overview = Data::BoostsOverview{
.isBoosted = data.is_my_boost(),
.mine = slots ? int(slots->v.size()) : 0,
.level = std::max(data.vlevel().v, 0),
.boostCount = std::max(
data.vboosts().v,
Expand All @@ -533,6 +534,20 @@ rpl::producer<rpl::no_value, QString> Boosts::request() {
};
_boostStatus.link = qs(data.vboost_url());

if (data.vprepaid_giveaways()) {
_boostStatus.prepaidGiveaway = ranges::views::all(
data.vprepaid_giveaways()->v
) | ranges::views::transform([](const MTPPrepaidGiveaway &r) {
return Data::BoostPrepaidGiveaway{
.months = r.data().vmonths().v,
.id = r.data().vid().v,
.quantity = r.data().vquantity().v,
.date = QDateTime::fromSecsSinceEpoch(
r.data().vdate().v),
};
}) | ranges::to_vector;
}

using namespace Data;
requestBoosts({ .gifts = false }, [=](BoostsListSlice &&slice) {
_boostStatus.firstSliceBoosts = std::move(slice);
Expand Down Expand Up @@ -573,6 +588,7 @@ void Boosts::requestBoosts(

auto list = std::vector<Data::Boost>();
list.reserve(data.vboosts().v.size());
constexpr auto kMonthsDivider = int(30 * 86400);
for (const auto &boost : data.vboosts().v) {
const auto &data = boost.data();
const auto path = data.vused_gift_slug()
Expand All @@ -595,7 +611,8 @@ void Boosts::requestBoosts(
? FullMsgId{ _peer->id, data.vgiveaway_msg_id()->v }
: FullMsgId(),
QDateTime::fromSecsSinceEpoch(data.vdate().v),
data.vexpires().v,
QDateTime::fromSecsSinceEpoch(data.vexpires().v),
(data.vexpires().v - data.vdate().v) / kMonthsDivider,
std::move(giftCodeLink),
data.vmultiplier().value_or_empty(),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ void EditFilterChatsListController::rowClicked(not_null<PeerListRow*> row) {
delegate()->peerListSetRowChecked(row, !row->checked());
updateTitle();
} else {
delegate()->peerListShowBox(_limitBox(count));
delegate()->peerListUiShow()->showBox(_limitBox(count));
}
}

Expand Down
18 changes: 9 additions & 9 deletions Telegram/SourceFiles/boxes/filters/edit_filter_links.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,19 +575,19 @@ void LinkController::addLinkBlock(not_null<Ui::VerticalLayout*> container) {
CopyInviteLink(delegate()->peerListUiShow(), link);
});
const auto shareLink = crl::guard(weak, [=] {
delegate()->peerListShowBox(
delegate()->peerListUiShow()->showBox(
ShareInviteLinkBox(&_window->session(), link));
});
const auto getLinkQr = crl::guard(weak, [=] {
delegate()->peerListShowBox(
delegate()->peerListUiShow()->showBox(
InviteLinkQrBox(link, tr::lng_filters_link_qr_about()));
});
const auto editLink = crl::guard(weak, [=] {
delegate()->peerListShowBox(
delegate()->peerListUiShow()->showBox(
Box(ChatFilterLinkBox, &_window->session(), _data));
});
const auto deleteLink = crl::guard(weak, [=] {
delegate()->peerListShowBox(DeleteLinkBox(_window, _data));
delegate()->peerListUiShow()->showBox(DeleteLinkBox(_window, _data));
});

const auto createMenu = [=] {
Expand Down Expand Up @@ -846,7 +846,7 @@ void LinksController::rebuild(const std::vector<InviteLinkData> &rows) {

void LinksController::rowClicked(not_null<PeerListRow*> row) {
const auto link = static_cast<LinkRow*>(row.get())->data();
delegate()->peerListShowBox(
delegate()->peerListUiShow()->showBox(
ShowLinkBox(_window, _currentFilter(), link));
}

Expand Down Expand Up @@ -881,19 +881,19 @@ base::unique_qptr<Ui::PopupMenu> LinksController::createRowContextMenu(
CopyInviteLink(delegate()->peerListUiShow(), link);
};
const auto shareLink = [=] {
delegate()->peerListShowBox(
delegate()->peerListUiShow()->showBox(
ShareInviteLinkBox(&_window->session(), link));
};
const auto getLinkQr = [=] {
delegate()->peerListShowBox(
delegate()->peerListUiShow()->showBox(
InviteLinkQrBox(link, tr::lng_filters_link_qr_about()));
};
const auto editLink = [=] {
delegate()->peerListShowBox(
delegate()->peerListUiShow()->showBox(
Box(ChatFilterLinkBox, &_window->session(), data));
};
const auto deleteLink = [=] {
delegate()->peerListShowBox(DeleteLinkBox(_window, data));
delegate()->peerListUiShow()->showBox(DeleteLinkBox(_window, data));
};
auto result = base::make_unique_q<Ui::PopupMenu>(
parent,
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/boxes/gift_premium_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void GiftBox(
+ st::defaultUserpicButton.size.height()));

using ColoredMiniStars = Ui::Premium::ColoredMiniStars;
const auto stars = box->lifetime().make_state<ColoredMiniStars>(top);
const auto stars = box->lifetime().make_state<ColoredMiniStars>(top, true);

const auto userpic = Ui::CreateChild<Ui::UserpicButton>(
top,
Expand Down
10 changes: 4 additions & 6 deletions Telegram/SourceFiles/boxes/passcode_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,12 +567,10 @@ void PasscodeBox::validateEmail(
} else if (error.type() == u"EMAIL_HASH_EXPIRED"_q) {
const auto weak = Ui::MakeWeak(this);
_clearUnconfirmedPassword.fire({});
if (weak) {
auto box = Ui::MakeInformBox({
Lang::Hard::EmailConfirmationExpired()
});
weak->getDelegate()->show(
std::move(box),
if (const auto strong = weak.data()) {
strong->getDelegate()->show(
Ui::MakeInformBox(
Lang::Hard::EmailConfirmationExpired()),
Ui::LayerOption::CloseOther);
}
} else {
Expand Down
30 changes: 10 additions & 20 deletions Telegram/SourceFiles/boxes/peer_list_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,6 @@ PeerListContentDelegateShow::PeerListContentDelegateShow(
: _show(show) {
}

void PeerListContentDelegateShow::peerListShowBox(
object_ptr<Ui::BoxContent> content,
Ui::LayerOptions options) {
_show->showBox(std::move(content), options);
}

void PeerListContentDelegateShow::peerListHideLayer() {
_show->hideLayer();
}

auto PeerListContentDelegateShow::peerListUiShow()
-> std::shared_ptr<Main::SessionShow>{
return _show;
Expand Down Expand Up @@ -325,16 +315,6 @@ void PeerListBox::peerListSetSearchMode(PeerListSearchMode mode) {
}
}

void PeerListBox::peerListShowBox(
object_ptr<Ui::BoxContent> content,
Ui::LayerOptions options) {
_show->showBox(std::move(content), options);
}

void PeerListBox::peerListHideLayer() {
_show->hideLayer();
}

std::shared_ptr<Main::SessionShow> PeerListBox::peerListUiShow() {
return _show;
}
Expand Down Expand Up @@ -1704,9 +1684,19 @@ crl::time PeerListContent::paintRow(
return refreshStatusIn;
}

const auto opacity = row->opacity();
const auto &bg = selected
? _st.item.button.textBgOver
: _st.item.button.textBg;
if (opacity < 1.) {
p.setOpacity(opacity);
}
const auto guard = gsl::finally([&] {
if (opacity < 1.) {
p.setOpacity(1.);
}
});

p.fillRect(0, 0, outerWidth, _rowHeight, bg);
row->paintRipple(p, 0, 0, outerWidth);
row->paintUserpic(
Expand Down
Loading

0 comments on commit 2306ddd

Please sign in to comment.