Skip to content

Commit

Permalink
Merge branch 'dev' into teamgram3
Browse files Browse the repository at this point in the history
  • Loading branch information
wubenqi committed Oct 15, 2024
2 parents 14b0e3e + b41ac0f commit 8cd1d50
Show file tree
Hide file tree
Showing 75 changed files with 964 additions and 317 deletions.
4 changes: 4 additions & 0 deletions Telegram/Resources/langs/lang.strings
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_username_app_not_found" = "Bot application not found.";
"lng_username_link" = "This link opens a chat with you:";
"lng_username_copied" = "Link copied to clipboard.";
"lng_username_text_copied" = "Username copied to clipboard.";

"lng_usernames_edit" = "click to edit";
"lng_usernames_active" = "active";
Expand Down Expand Up @@ -487,6 +488,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_collectible_phone_info" = "This phone number was bought on **Fragment** on {date} for {price}";
"lng_collectible_phone_copy" = "Copy Phone Number";
"lng_collectible_learn_more" = "Learn More";
"lng_collectible_phone_copied" = "Phone number copied to clipboard.";

"lng_settings_section_info" = "Info";

Expand Down Expand Up @@ -5629,6 +5631,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_qr_box_quality1" = "Normal";
"lng_qr_box_quality2" = "High";
"lng_qr_box_quality3" = "Very High";
"lng_qr_box_transparent_background" = "Transparent Background";
"lng_qr_box_font_size" = "Font size";

// Wnd specific

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.6.1.0" />
Version="5.6.2.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>
Expand Down
2 changes: 2 additions & 0 deletions Telegram/Resources/winrc/Telegram.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
</windowsSettings>
</application>
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,6,1,0
PRODUCTVERSION 5,6,1,0
FILEVERSION 5,6,2,0
PRODUCTVERSION 5,6,2,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Teamgram FZ-LLC"
VALUE "FileDescription", "Teamgram Desktop"
VALUE "FileVersion", "5.6.1.0"
VALUE "FileVersion", "5.6.2.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Teamgram Desktop"
VALUE "ProductVersion", "5.6.1.0"
VALUE "ProductVersion", "5.6.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,6,1,0
PRODUCTVERSION 5,6,1,0
FILEVERSION 5,6,2,0
PRODUCTVERSION 5,6,2,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -53,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "5.6.1.0"
VALUE "FileVersion", "5.6.2.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "5.6.1.0"
VALUE "ProductVersion", "5.6.2.0"
END
END
BLOCK "VarFileInfo"
Expand Down
5 changes: 3 additions & 2 deletions Telegram/SourceFiles/boxes/peer_list_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,13 +764,14 @@ int PeerListRow::paintNameIconGetWidth(
int availableWidth,
int outerWidth,
bool selected) {
if (special()
if (_skipPeerBadge
|| special()
|| !_savedMessagesStatus.isEmpty()
|| _isRepliesMessagesChat
|| _isVerifyCodesChat) {
return 0;
}
return _bagde.drawGetWidth(
return _badge.drawGetWidth(
p,
QRect(
nameLeft,
Expand Down
7 changes: 6 additions & 1 deletion Telegram/SourceFiles/boxes/peer_list_box.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ class PeerListRow {
return _nameFirstLetters;
}

void setSkipPeerBadge(bool skip) {
_skipPeerBadge = skip;
}

virtual void lazyInitialize(const style::PeerListItem &st);
virtual void paintStatusText(
Painter &p,
Expand Down Expand Up @@ -291,7 +295,7 @@ class PeerListRow {
std::unique_ptr<Ui::RoundImageCheckbox> _checkbox;
Ui::Text::String _name;
Ui::Text::String _status;
Ui::PeerBadge _bagde;
Ui::PeerBadge _badge;
StatusType _statusType = StatusType::Online;
crl::time _statusValidTill = 0;
base::flat_set<QChar> _nameFirstLetters;
Expand All @@ -303,6 +307,7 @@ class PeerListRow {
bool _isSearchResult : 1 = false;
bool _isRepliesMessagesChat : 1 = false;
bool _isVerifyCodesChat : 1 = false;
bool _skipPeerBadge : 1 = false;

};

Expand Down
25 changes: 3 additions & 22 deletions Telegram/SourceFiles/boxes/star_gift_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,7 @@ void SendGift(
.randomId = details.randomId,
.message = details.text,
.user = peer->asUser(),
.limitedCount = gift.limitedCount,
.anonymous = details.anonymous,
}, done, processNonPanelPaymentFormFactory);
});
Expand Down Expand Up @@ -1073,29 +1074,9 @@ void SendGiftBox(
x += single.width() + st::giftBoxGiftSkip.x();
}

const auto premiumSent = [=](Payments::CheckoutResult result) {
state->sending = false;
if (result == Payments::CheckoutResult::Paid) {
window->showPeerHistory(peer);
window->showToast(
Ui::Text::Bold(tr::lng_gift_sent_title(tr::now)));
}
};
button->setClickedCallback([=] {
const auto star = std::get_if<GiftTypeStars>(&descriptor);
if (v::is<GiftTypePremium>(descriptor)) {
if (state->sending) {
return;
} else {
state->sending = true;
}
SendGift(
window,
peer,
api,
GiftDetails{ descriptor },
premiumSent);
} else if (star && star->limitedCount && !star->limitedLeft) {
if (star && star->limitedCount && !star->limitedLeft) {
window->showToast({
.title = tr::lng_gift_sold_out_title(tr::now),
.text = tr::lng_gift_sold_out_text(
Expand Down Expand Up @@ -1255,7 +1236,7 @@ void GiftBox(
stUser.photoSize * 2);
content->sizeValue(
) | rpl::start_with_next([=](const QSize &size) {
widget->moveToLeft(stUser.photoSize / 2, 0);
widget->moveToLeft((size.width() - widget->width()) / 2, 0);
const auto starsRect = Rect(widget->size());
stars->setPosition(starsRect.topLeft());
stars->setSize(starsRect.size());
Expand Down
12 changes: 11 additions & 1 deletion Telegram/SourceFiles/boxes/sticker_set_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1428,9 +1428,13 @@ void StickerSetBox::Inner::contextMenuEvent(QContextMenuEvent *e) {
const auto send = crl::guard(this, [=](Api::SendOptions options) {
chosen(index, document, options);
});

// In case we're adding items after FillSendMenu we have
// to pass nullptr for showForEffect and attach selector later.
// Otherwise added items widths won't be respected in menu geometry.
SendMenu::FillSendMenu(
_menu.get(),
_show,
nullptr, // showForEffect
details,
SendMenu::DefaultCallback(_show, send));

Expand Down Expand Up @@ -1464,6 +1468,12 @@ void StickerSetBox::Inner::contextMenuEvent(QContextMenuEvent *e) {
.isAttention = true,
});
}

SendMenu::AttachSendMenuEffect(
_menu.get(),
_show,
details,
SendMenu::DefaultCallback(_show, send));
}
if (_menu->empty()) {
_menu = nullptr;
Expand Down
13 changes: 12 additions & 1 deletion Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,13 @@ base::unique_qptr<Ui::PopupMenu> GifsListWidget::fillContextMenu(
// inline results don't have effects
copyDetails.effectAllowed = false;
}

// In case we're adding items after FillSendMenu we have
// to pass nullptr for showForEffect and attach selector later.
// Otherwise added items widths won't be respected in menu geometry.
SendMenu::FillSendMenu(
menu,
_show,
nullptr, // showForMenu
copyDetails,
SendMenu::DefaultCallback(_show, send),
icons);
Expand Down Expand Up @@ -441,6 +445,13 @@ base::unique_qptr<Ui::PopupMenu> GifsListWidget::fillContextMenu(
AddGifAction(std::move(callback), _show, document, icons);
}
}

SendMenu::AttachSendMenuEffect(
menu,
_show,
copyDetails,
SendMenu::DefaultCallback(_show, send));

return menu;
}

Expand Down
13 changes: 12 additions & 1 deletion Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1780,9 +1780,13 @@ base::unique_qptr<Ui::PopupMenu> StickersListWidget::fillContextMenu(
});
});
const auto icons = &st().icons;

// In case we're adding items after FillSendMenu we have
// to pass nullptr for showForEffect and attach selector later.
// Otherwise added items widths won't be respected in menu geometry.
SendMenu::FillSendMenu(
menu,
_show,
nullptr, // showForEffect
details,
SendMenu::DefaultCallback(_show, send),
icons);
Expand Down Expand Up @@ -1816,6 +1820,13 @@ base::unique_qptr<Ui::PopupMenu> StickersListWidget::fillContextMenu(
false);
}, &icons->menuRecentRemove);
}

SendMenu::AttachSendMenuEffect(
menu,
_show,
details,
SendMenu::DefaultCallback(_show, send));

return menu;
}

Expand Down
9 changes: 8 additions & 1 deletion Telegram/SourceFiles/core/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,14 @@ bool Application::openCustomUrl(
|| passcodeLocked()) {
return false;
}
const auto command = base::StringViewMid(urlTrimmed, protocol.size(), 8192);
static const auto kTagExp = QRegularExpression(
u"^\\~[a-zA-Z0-9_\\-]+\\~:"_q);
auto skip = protocol.size();
const auto match = kTagExp.match(base::StringViewMid(urlTrimmed, skip));
if (match.hasMatch()) {
skip += match.capturedLength();
}
const auto command = base::StringViewMid(urlTrimmed, skip, 8192);
const auto my = context.value<ClickHandlerContext>();
const auto controller = my.sessionWindow.get()
? my.sessionWindow.get()
Expand Down
40 changes: 38 additions & 2 deletions Telegram/SourceFiles/core/local_url_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,9 +785,9 @@ bool CopyPeerId(
Window::SessionController *controller,
const Match &match,
const QVariant &context) {
TextUtilities::SetClipboardText(TextForMimeData{ match->captured(1) });
TextUtilities::SetClipboardText({ match->captured(1) });
if (controller) {
controller->showToast(tr::lng_text_copied(tr::now));
controller->showToast(u"ID copied to clipboard."_q);
}
return true;
}
Expand Down Expand Up @@ -926,6 +926,34 @@ bool ShowCollectibleUsername(
return true;
}

bool CopyUsernameLink(
Window::SessionController *controller,
const Match &match,
const QVariant &context) {
if (!controller) {
return false;
}
const auto username = match->captured(1);
TextUtilities::SetClipboardText({
controller->session().createInternalLinkFull(username)
});
controller->showToast(tr::lng_username_copied(tr::now));
return true;
}

bool CopyUsername(
Window::SessionController *controller,
const Match &match,
const QVariant &context) {
if (!controller) {
return false;
}
const auto username = match->captured(1);
TextUtilities::SetClipboardText({ '@' + username });
controller->showToast(tr::lng_username_text_copied(tr::now));
return true;
}

bool ShowStarsExamples(
Window::SessionController *controller,
const Match &match,
Expand Down Expand Up @@ -1391,6 +1419,14 @@ const std::vector<LocalUrlHandler> &InternalUrlHandlers() {
u"^collectible_username/([a-zA-Z0-9\\-\\_\\.]+)@([0-9]+)$"_q,
ShowCollectibleUsername,
},
{
u"^username_link/([a-zA-Z0-9\\-\\_\\.]+)@([0-9]+)$"_q,
CopyUsernameLink,
},
{
u"^username_regular/([a-zA-Z0-9\\-\\_\\.]+)@([0-9]+)$"_q,
CopyUsername,
},
{
u"^stars_examples$"_q,
ShowStarsExamples,
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 @@ -22,7 +22,7 @@ constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"_cs;
constexpr auto AppNameOld = "Teamgram Win (Unofficial)"_cs;
constexpr auto AppName = "Teamgram Desktop"_cs;
constexpr auto AppFile = "Teamgram"_cs;
constexpr auto AppVersion = 5006001;
constexpr auto AppVersionStr = "5.6.1";
constexpr auto AppVersion = 5006002;
constexpr auto AppVersionStr = "5.6.2";
constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;
16 changes: 8 additions & 8 deletions Telegram/SourceFiles/data/data_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,14 +936,14 @@ void DocumentData::setFileName(const QString &remoteFileName) {
// in filenames, because they introduce a security issue, when
// an executable "Fil[x]gepj.exe" may look like "Filexe.jpeg".
QChar controls[] = {
0x200E, // LTR Mark
0x200F, // RTL Mark
0x202A, // LTR Embedding
0x202B, // RTL Embedding
0x202D, // LTR Override
0x202E, // RTL Override
0x2066, // LTR Isolate
0x2067, // RTL Isolate
QChar(0x200E), // LTR Mark
QChar(0x200F), // RTL Mark
QChar(0x202A), // LTR Embedding
QChar(0x202B), // RTL Embedding
QChar(0x202D), // LTR Override
QChar(0x202E), // RTL Override
QChar(0x2066), // LTR Isolate
QChar(0x2067), // RTL Isolate
};
for (const auto &ch : controls) {
_filename = std::move(_filename).replace(ch, "_");
Expand Down
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/data/data_wall_paper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ using Ui::MaybeColorFromSerialized;
const auto hex = [](int value) {
value = std::clamp(value, 0, 15);
return (value > 9)
? ('a' + (value - 10))
: ('0' + value);
? QChar('a' + (value - 10))
: QChar('0' + value);
};
return QString() + hex(value / 16) + hex(value % 16);
};
Expand Down
Loading

0 comments on commit 8cd1d50

Please sign in to comment.