Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/telegramdesktop/tdesktop int…
Browse files Browse the repository at this point in the history
…o bigEmoj

# Conflicts:
#	Telegram/SourceFiles/core/version.h
#	Telegram/lib_ui
  • Loading branch information
kirsan31 committed Apr 19, 2024
2 parents 4cc6879 + 3510ca7 commit d158d31
Show file tree
Hide file tree
Showing 28 changed files with 271 additions and 147 deletions.
4 changes: 2 additions & 2 deletions Telegram/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1459,8 +1459,6 @@ PRIVATE
ui/image/image_location.h
ui/image/image_location_factory.cpp
ui/image/image_location_factory.h
ui/widgets/level_meter.cpp
ui/widgets/level_meter.h
ui/countryinput.cpp
ui/countryinput.h
ui/dynamic_thumbnails.cpp
Expand All @@ -1476,6 +1474,8 @@ PRIVATE
ui/search_field_controller.h
ui/text/format_song_document_name.cpp
ui/text/format_song_document_name.h
ui/widgets/label_with_custom_emoji.cpp
ui/widgets/label_with_custom_emoji.h
ui/unread_badge.cpp
ui/unread_badge.h
window/main_window.cpp
Expand Down
2 changes: 1 addition & 1 deletion Telegram/Resources/langs/lang.strings
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_edit_limit_reached#one" = "You've reached the message text limit. Please make the text shorter by {count} character.";
"lng_edit_limit_reached#other" = "You've reached the message text limit. Please make the text shorter by {count} characters.";
"lng_edit_message" = "Edit message";
"lng_edit_message_text" = "New message text...";
"lng_edit_message_text" = "Caption";
"lng_deleted" = "Deleted Account";
"lng_deleted_message" = "Deleted message";
"lng_deleted_story" = "Deleted story";
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.16.7.0" />
Version="4.16.8.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 4,16,7,0
PRODUCTVERSION 4,16,7,0
FILEVERSION 4,16,8,0
PRODUCTVERSION 4,16,8,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "4.16.7.0"
VALUE "FileVersion", "4.16.8.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "4.16.7.0"
VALUE "ProductVersion", "4.16.8.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,16,7,0
PRODUCTVERSION 4,16,7,0
FILEVERSION 4,16,8,0
PRODUCTVERSION 4,16,8,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", "4.16.7.0"
VALUE "FileVersion", "4.16.8.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "4.16.7.0"
VALUE "ProductVersion", "4.16.8.0"
END
END
BLOCK "VarFileInfo"
Expand Down
43 changes: 20 additions & 23 deletions Telegram/SourceFiles/boxes/gift_premium_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ For license and copyright information please follow this link:
#include "boxes/peers/prepare_short_info_box.h"
#include "boxes/peers/replace_boost_box.h" // BoostsForGift.
#include "boxes/premium_preview_box.h" // ShowPremiumPreviewBox.
#include "core/ui_integration.h" // Core::MarkedTextContext.
#include "data/data_boosts.h"
#include "data/data_changes.h"
#include "data/data_channel.h"
Expand Down Expand Up @@ -48,6 +47,7 @@ For license and copyright information please follow this link:
#include "ui/toast/toast.h"
#include "ui/widgets/checkbox.h"
#include "ui/widgets/gradient_round_button.h"
#include "ui/widgets/label_with_custom_emoji.h"
#include "ui/wrap/padding_wrap.h"
#include "ui/wrap/slide_wrap.h"
#include "ui/wrap/table_layout.h"
Expand Down Expand Up @@ -319,21 +319,20 @@ void GiftBox(
std::move(titleLabel)),
st::premiumGiftTitlePadding);

auto textLabel = object_ptr<Ui::FlatLabel>(box, st::premiumPreviewAbout);
tr::lng_premium_gift_about(
lt_user,
user->session().changes().peerFlagsValue(
user,
Data::PeerUpdate::Flag::Name
) | rpl::map([=] { return TextWithEntities{ user->firstName }; }),
Ui::Text::RichLangValue
) | rpl::map(
BoostsForGiftText({ user })
) | rpl::start_with_next([
raw = textLabel.data(),
session = &user->session()](const TextWithEntities &t) {
raw->setMarkedText(t, Core::MarkedTextContext{ .session = session });
}, textLabel->lifetime());
auto textLabel = Ui::CreateLabelWithCustomEmoji(
box,
tr::lng_premium_gift_about(
lt_user,
user->session().changes().peerFlagsValue(
user,
Data::PeerUpdate::Flag::Name
) | rpl::map([=] { return TextWithEntities{ user->firstName }; }),
Ui::Text::RichLangValue
) | rpl::map(
BoostsForGiftText({ user })
),
{ .session = &user->session() },
st::premiumPreviewAbout);
textLabel->setTextColorOverride(stTitle.textFg->c);
textLabel->resizeToWidth(available);
box->addRow(
Expand Down Expand Up @@ -536,14 +535,12 @@ void GiftsBox(
const auto label = box->addRow(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
box,
object_ptr<Ui::FlatLabel>(box, st::premiumPreviewAbout)),
Ui::CreateLabelWithCustomEmoji(
box,
std::move(text),
{ .session = session },
st::premiumPreviewAbout)),
padding)->entity();
std::move(
text
) | rpl::start_with_next([=](const TextWithEntities &t) {
using namespace Core;
label->setMarkedText(t, MarkedTextContext{ .session = session });
}, label->lifetime());
label->setTextColorOverride(stTitle.textFg->c);
label->resizeToWidth(available);
}
Expand Down
18 changes: 17 additions & 1 deletion Telegram/SourceFiles/core/shortcuts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,24 @@ void WriteDefaultCustomFile() {
const auto path = CustomFilePath();
auto input = QFile(":/misc/default_shortcuts-custom.json");
auto output = QFile(path);
if (input.open(QIODevice::ReadOnly) && output.open(QIODevice::WriteOnly)) {
if (input.open(QIODevice::ReadOnly)
&& output.open(QIODevice::WriteOnly)) {
#ifdef Q_OS_MAC
auto text = qs(input.readAll());
const auto note = R"(
// Note:
// On Apple platforms, reference to "ctrl" corresponds to the Command keys )"
+ QByteArray()
+ R"(on the Macintosh keyboard.
// On Apple platforms, reference to "meta" corresponds to the Control keys.
[
)";
text.replace(u"\n\n["_q, QString(note));
output.write(text.toUtf8());
#else
output.write(input.readAll());
#endif // !Q_OS_MAC
}
}

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 = "Telegram Win (Unofficial)"_cs;
constexpr auto AppName = "Telegram Desktop"_cs;
constexpr auto AppFile = "Telegram"_cs;
constexpr auto AppVersion = 4016007;
constexpr auto AppVersionStr = "4.16.7 mod";
constexpr auto AppVersion = 4016008;
constexpr auto AppVersionStr = "4.16.8 mod";
constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;
9 changes: 8 additions & 1 deletion Telegram/SourceFiles/data/components/scheduled_messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,16 @@ ScheduledMessages::ScheduledMessages(not_null<Main::Session*> session)
}

ScheduledMessages::~ScheduledMessages() {
for (const auto &request : _requests) {
Expects(_data.empty());
Expects(_requests.empty());
}

void ScheduledMessages::clear() {
_lifetime.destroy();
for (const auto &request : base::take(_requests)) {
_session->api().request(request.second.requestId).cancel();
}
base::take(_data);
}

void ScheduledMessages::clearOldRequests() {
Expand Down
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/data/components/scheduled_messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class ScheduledMessages final {
[[nodiscard]] Data::MessagesSlice list(
not_null<const Data::ForumTopic*> topic) const;

void clear();

private:
using OwnedItem = std::unique_ptr<HistoryItem, HistoryItem::Destroyer>;
struct List {
Expand Down
22 changes: 20 additions & 2 deletions Telegram/SourceFiles/data/data_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,13 @@ void DocumentData::setattributes(
|| type == AnimatedDocument
|| type == RoundVideoDocument
|| isAnimation()) {
if (_nameType != Type::Video) {
if (!enforceNameType(Type::Video)) {
type = FileDocument;
_additional = nullptr;
}
}
if (type == SongDocument || type == VoiceDocument || isAudioFile()) {
if (_nameType != Type::Audio) {
if (!enforceNameType(Type::Audio)) {
type = FileDocument;
_additional = nullptr;
}
Expand Down Expand Up @@ -951,6 +951,24 @@ void DocumentData::setFileName(const QString &remoteFileName) {
_nameType = Core::DetectNameType(_filename);
}

bool DocumentData::enforceNameType(Core::NameType nameType) {
if (_nameType == nameType) {
return true;
}
const auto base = _filename.isEmpty() ? u"file"_q : _filename;
const auto mime = Core::MimeTypeForName(mimeString());
const auto patterns = mime.globPatterns();
for (const auto &pattern : mime.globPatterns()) {
const auto now = base + QString(pattern).replace('*', QString());
if (Core::DetectNameType(now) == nameType) {
_filename = now;
_nameType = nameType;
return true;
}
}
return false;
}

void DocumentData::setLoadedInMediaCacheLocation() {
_location = Core::FileLocation();
_flags |= Flag::LoadedInMediaCache;
Expand Down
1 change: 1 addition & 0 deletions Telegram/SourceFiles/data/data_document.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ class DocumentData final {
void setMaybeSupportsStreaming(bool supports);
void setLoadedInMediaCacheLocation();
void setFileName(const QString &remoteFileName);
bool enforceNameType(Core::NameType nameType);

void finishLoad();
void handleLoaderUpdates();
Expand Down
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/data/data_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ For license and copyright information please follow this link:
#include "data/business/data_business_chatbots.h"
#include "data/business/data_business_info.h"
#include "data/business/data_shortcut_messages.h"
#include "data/components/scheduled_messages.h"
#include "data/stickers/data_stickers.h"
#include "data/notify/data_notify_settings.h"
#include "data/data_bot_app.h"
Expand Down Expand Up @@ -394,6 +395,7 @@ void Session::clear() {

_histories->unloadAll();
_shortcutMessages = nullptr;
_session->scheduledMessages().clear();
_dependentMessages.clear();
base::take(_messages);
base::take(_nonChannelMessages);
Expand Down
40 changes: 20 additions & 20 deletions Telegram/SourceFiles/history/view/history_view_message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1843,27 +1843,27 @@ void Message::clickHandlerPressedChanged(
Element::clickHandlerPressedChanged(handler, pressed);
if (!handler) {
return;
} else if (_rightAction) {
if (_rightAction->second && (handler == _rightAction->second->link)) {
const auto rightSize = rightActionSize();
Assert(rightSize != std::nullopt);
if (pressed) {
if (!_rightAction->second->ripple) {
// Create a ripple.
_rightAction->second->ripple
= std::make_unique<Ui::RippleAnimation>(
st::defaultRippleAnimation,
Ui::RippleAnimation::RoundRectMask(
Size(rightSize->width()),
rightSize->width() / 2),
[=] { repaint(); });
}
_rightAction->second->ripple->add(_rightAction->lastPoint);
} else if (_rightAction->second->ripple) {
_rightAction->second->ripple->lastStop();
} else if (_rightAction && (handler == _rightAction->link)) {
toggleRightActionRipple(pressed);
} else if (_rightAction
&& _rightAction->second
&& (handler == _rightAction->second->link)) {
const auto rightSize = rightActionSize();
Assert(rightSize != std::nullopt);
if (pressed) {
if (!_rightAction->second->ripple) {
// Create a ripple.
_rightAction->second->ripple
= std::make_unique<Ui::RippleAnimation>(
st::defaultRippleAnimation,
Ui::RippleAnimation::RoundRectMask(
Size(rightSize->width()),
rightSize->width() / 2),
[=] { repaint(); });
}
} else if (handler == _rightAction->link) {
toggleRightActionRipple(pressed);
_rightAction->second->ripple->add(_rightAction->lastPoint);
} else if (_rightAction->second->ripple) {
_rightAction->second->ripple->lastStop();
}
} else if (_comments && (handler == _comments->link)) {
toggleCommentsButtonRipple(pressed);
Expand Down
Loading

0 comments on commit d158d31

Please sign in to comment.