Skip to content

Commit

Permalink
Updated to 4.14.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Jan 4, 2024
2 parents c356b5b + 37d1940 commit 73a52b4
Show file tree
Hide file tree
Showing 52 changed files with 1,388 additions and 1,091 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ include(cmake/options.cmake)

if (NOT DESKTOP_APP_USE_PACKAGED)
if (WIN32)
set(qt_version 5.15.11)
set(qt_version 5.15.12)
elseif (APPLE)
set(qt_version 6.2.6)
set(qt_version 6.2.7)
endif()
endif()
include(cmake/external/qt/package.cmake)
Expand Down
Binary file added Telegram/Resources/icons/win_quit.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 added Telegram/Resources/icons/win_quit@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 added Telegram/Resources/icons/win_quit@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.14.2.0" />
Version="4.14.3.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,14,2,0
PRODUCTVERSION 4,14,2,0
FILEVERSION 4,14,3,0
PRODUCTVERSION 4,14,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", ""
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "4.14.2.0"
VALUE "FileVersion", "4.14.3.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "4.14.2.0"
VALUE "ProductVersion", "4.14.3.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,14,2,0
PRODUCTVERSION 4,14,2,0
FILEVERSION 4,14,3,0
PRODUCTVERSION 4,14,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -53,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", ""
VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "4.14.2.0"
VALUE "FileVersion", "4.14.3.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "4.14.2.0"
VALUE "ProductVersion", "4.14.3.0"
END
END
BLOCK "VarFileInfo"
Expand Down
1 change: 1 addition & 0 deletions Telegram/SourceFiles/api/api_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct SendOptions {
bool silent = false;
bool handleSupportSwitch = false;
bool hideViaBot = false;
crl::time ttlSeconds = 0;
};
[[nodiscard]] SendOptions DefaultSendWhenOnlineOptions();

Expand Down
22 changes: 14 additions & 8 deletions Telegram/SourceFiles/api/api_media.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,19 @@ MTPInputMedia PrepareUploadedPhoto(
not_null<HistoryItem*> item,
RemoteFileInfo info) {
using Flag = MTPDinputMediaUploadedPhoto::Flag;
const auto spoiler = item->media()
&& item->media()->hasSpoiler();
const auto spoiler = item->media() && item->media()->hasSpoiler();
const auto ttlSeconds = item->media()
? item->media()->ttlSeconds()
: 0;
const auto flags = (spoiler ? Flag::f_spoiler : Flag())
| (info.attachedStickers.empty() ? Flag() : Flag::f_stickers);
| (info.attachedStickers.empty() ? Flag() : Flag::f_stickers)
| (ttlSeconds ? Flag::f_ttl_seconds : Flag());
return MTP_inputMediaUploadedPhoto(
MTP_flags(flags),
info.file,
MTP_vector<MTPInputDocument>(
ranges::to<QVector<MTPInputDocument>>(info.attachedStickers)),
MTP_int(0));
MTP_int(ttlSeconds));
}

MTPInputMedia PrepareUploadedDocument(
Expand All @@ -98,12 +101,15 @@ MTPInputMedia PrepareUploadedDocument(
return MTP_inputMediaEmpty();
}
using Flag = MTPDinputMediaUploadedDocument::Flag;
const auto spoiler = item->media()
&& item->media()->hasSpoiler();
const auto spoiler = item->media() && item->media()->hasSpoiler();
const auto ttlSeconds = item->media()
? item->media()->ttlSeconds()
: 0;
const auto flags = (spoiler ? Flag::f_spoiler : Flag())
| (info.thumb ? Flag::f_thumb : Flag())
| (item->groupId() ? Flag::f_nosound_video : Flag())
| (info.attachedStickers.empty() ? Flag::f_stickers : Flag());
| (info.attachedStickers.empty() ? Flag::f_stickers : Flag())
| (ttlSeconds ? Flag::f_ttl_seconds : Flag());
const auto document = item->media()->document();
return MTP_inputMediaUploadedDocument(
MTP_flags(flags),
Expand All @@ -113,7 +119,7 @@ MTPInputMedia PrepareUploadedDocument(
ComposeSendingDocumentAttributes(document),
MTP_vector<MTPInputDocument>(
ranges::to<QVector<MTPInputDocument>>(info.attachedStickers)),
MTP_int(0));
MTP_int(ttlSeconds));
}

bool HasAttachedStickers(MTPInputMedia media) {
Expand Down
29 changes: 24 additions & 5 deletions Telegram/SourceFiles/api/api_sending.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ void InnerFillMessagePostFlags(
not_null<PeerData*> peer,
MessageFlags &flags) {
const auto anonymousPost = peer->amAnonymous();
if (ShouldSendSilent(peer, options)) {
flags |= MessageFlag::Silent;
}
if (!anonymousPost || options.sendAs) {
flags |= MessageFlag::HasFromId;
return;
Expand Down Expand Up @@ -442,9 +445,6 @@ void SendConfirmedFile(
const auto anonymousPost = peer->amAnonymous();
const auto silentPost = ShouldSendSilent(peer, file->to.options);
FillMessagePostFlags(action, peer, flags);
if (silentPost) {
flags |= MessageFlag::Silent;
}
if (file->to.options.scheduled) {
flags |= MessageFlag::IsOrWasScheduled;

Expand Down Expand Up @@ -484,11 +484,30 @@ void SendConfirmedFile(
MTPDocument(), // alt_document
MTPint());
} else if (file->type == SendMediaType::Audio) {
const auto ttlSeconds = file->to.options.ttlSeconds;
const auto isVoice = [&] {
return file->document.match([](const MTPDdocumentEmpty &d) {
return false;
}, [](const MTPDdocument &d) {
return ranges::any_of(d.vattributes().v, [&](
const MTPDocumentAttribute &attribute) {
using Att = MTPDdocumentAttributeAudio;
return attribute.match([](const Att &data) -> bool {
return data.vflags().v & Att::Flag::f_voice;
}, [](const auto &) {
return false;
});
});
});
}();
using Flag = MTPDmessageMediaDocument::Flag;
return MTP_messageMediaDocument(
MTP_flags(MTPDmessageMediaDocument::Flag::f_document),
MTP_flags(Flag::f_document
| (isVoice ? Flag::f_voice : Flag())
| (ttlSeconds ? Flag::f_ttl_seconds : Flag())),
file->document,
MTPDocument(), // alt_document
MTPint());
MTP_int(ttlSeconds));
} else {
Unexpected("Type in sendFilesConfirmed.");
}
Expand Down
41 changes: 28 additions & 13 deletions Telegram/SourceFiles/boxes/premium_limits_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,16 @@ class InactiveController final : public PeerListController {
void prepare() override;
void rowClicked(not_null<PeerListRow*> row) override;

[[nodiscard]] rpl::producer<int> countValue() const;

private:
void appendRow(not_null<PeerData*> peer, TimeId date);
[[nodiscard]] std::unique_ptr<PeerListRow> createRow(
not_null<PeerData*> peer,
TimeId date) const;

const not_null<Main::Session*> _session;
rpl::variable<int> _count;
mtpRequestId _requestId = 0;

};
Expand All @@ -91,12 +94,15 @@ class PublicsController final : public PeerListController {
void rowClicked(not_null<PeerListRow*> row) override;
void rowRightActionClicked(not_null<PeerListRow*> row) override;

[[nodiscard]] rpl::producer<int> countValue() const;

private:
void appendRow(not_null<PeerData*> peer);
[[nodiscard]] std::unique_ptr<PeerListRow> createRow(
not_null<PeerData*> peer) const;

const not_null<Window::SessionNavigation*> _navigation;
rpl::variable<int> _count;
Fn<void()> _closeBox;
mtpRequestId _requestId = 0;

Expand Down Expand Up @@ -210,24 +216,28 @@ void InactiveController::prepare() {
_requestId = _session->api().request(MTPchannels_GetInactiveChannels(
)).done([=](const MTPmessages_InactiveChats &result) {
_requestId = 0;
result.match([&](const MTPDmessages_inactiveChats &data) {
_session->data().processUsers(data.vusers());
const auto &list = data.vchats().v;
const auto &dates = data.vdates().v;
for (auto i = 0, count = int(list.size()); i != count; ++i) {
const auto peer = _session->data().processChat(list[i]);
const auto date = (i < dates.size()) ? dates[i].v : TimeId();
appendRow(peer, date);
}
delegate()->peerListRefreshRows();
});
const auto &data = result.data();
_session->data().processUsers(data.vusers());
const auto &list = data.vchats().v;
const auto &dates = data.vdates().v;
for (auto i = 0, count = int(list.size()); i != count; ++i) {
const auto peer = _session->data().processChat(list[i]);
const auto date = (i < dates.size()) ? dates[i].v : TimeId();
appendRow(peer, date);
}
delegate()->peerListRefreshRows();
_count = delegate()->peerListFullRowsCount();
}).send();
}

void InactiveController::rowClicked(not_null<PeerListRow*> row) {
delegate()->peerListSetRowChecked(row, !row->checked());
}

rpl::producer<int> InactiveController::countValue() const {
return _count.value();
}

void InactiveController::appendRow(
not_null<PeerData*> participant,
TimeId date) {
Expand Down Expand Up @@ -296,6 +306,10 @@ Main::Session &PublicsController::session() const {
return _navigation->session();
}

rpl::producer<int> PublicsController::countValue() const {
return _count.value();
}

void PublicsController::prepare() {
_requestId = _navigation->session().api().request(
MTPchannels_GetAdminedPublicChannels(MTP_flags(0))
Expand All @@ -315,6 +329,7 @@ void PublicsController::prepare() {
}
delegate()->peerListRefreshRows();
}
_count = delegate()->peerListFullRowsCount();
}).send();
}

Expand Down Expand Up @@ -571,7 +586,7 @@ void ChannelsLimitBox(
{});

using namespace rpl::mappers;
content->heightValue(
controller->countValue(
) | rpl::filter(_1 > 0) | rpl::start_with_next([=] {
delete placeholder;
}, placeholder->lifetime());
Expand Down Expand Up @@ -662,7 +677,7 @@ void PublicLinksLimitBox(
{});

using namespace rpl::mappers;
content->heightValue(
controller->countValue(
) | rpl::filter(_1 > 0) | rpl::start_with_next([=] {
delete placeholder;
}, placeholder->lifetime());
Expand Down
1 change: 1 addition & 0 deletions Telegram/SourceFiles/chat_helpers/chat_helpers.style
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,7 @@ historyRecordCancelActive: windowActiveTextFg;
historyRecordFont: font(13px);
historyRecordDurationSkip: 12px;
historyRecordDurationFg: historyComposeAreaFg;
historyRecordTTLLineWidth: 2px;

historyRecordMainBlobMinRadius: 23px;
historyRecordMainBlobMaxRadius: 37px;
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 = 4014002;
constexpr auto AppVersionStr = "4.14.2";
constexpr auto AppVersion = 4014003;
constexpr auto AppVersionStr = "4.14.3";
constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;
49 changes: 40 additions & 9 deletions Telegram/SourceFiles/data/data_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ namespace {

constexpr auto kDefaultCoverThumbnailSize = 100;
constexpr auto kMaxAllowedPreloadPrefix = 6 * 1024 * 1024;
constexpr auto kDefaultWebmEmojiSize = 100;
constexpr auto kDefaultWebmStickerLargerSize = kStickerSideSize;

const auto kLottieStickerDimensions = QSize(
kStickerSideSize,
Expand Down Expand Up @@ -430,6 +432,42 @@ void DocumentData::setattributes(
_flags |= Flag::HasAttachedStickers;
});
}

// Any "video/webm" file is treated as a video-sticker.
if (hasMimeType(u"video/webm"_q)) {
if (type == FileDocument) {
type = StickerDocument;
_additional = std::make_unique<StickerData>();
}
if (type == StickerDocument) {
sticker()->type = StickerType::Webm;
}
}

// If "video/webm" sticker without dimensions we set them to default.
if (const auto info = sticker(); info
&& info->set
&& info->type == StickerType::Webm
&& dimensions.isEmpty()) {
if (info->setType == Data::StickersType::Emoji) {
// Always fixed.
dimensions = { kDefaultWebmEmojiSize, kDefaultWebmEmojiSize };
} else if (info->setType == Data::StickersType::Stickers) {
// May have aspect != 1, so we count it from the thumbnail.
const auto thumbnail = QSize(
_thumbnail.location.width(),
_thumbnail.location.height()
).scaled(
kDefaultWebmStickerLargerSize,
kDefaultWebmStickerLargerSize,
Qt::KeepAspectRatio);
if (!thumbnail.isEmpty()) {
dimensions = thumbnail;
}
}
}

// Check sticker size/dimensions properties (for sticker of any type).
if (type == StickerDocument
&& ((size > Storage::kMaxStickerBytesSize)
|| (!sticker()->isLottie()
Expand All @@ -438,14 +476,8 @@ void DocumentData::setattributes(
dimensions.height())))) {
type = FileDocument;
_additional = nullptr;
} else if (type == FileDocument
&& hasMimeType(u"video/webm"_q)
&& (size < Storage::kMaxStickerBytesSize)
&& GoodStickerDimensions(dimensions.width(), dimensions.height())) {
type = StickerDocument;
_additional = std::make_unique<StickerData>();
sticker()->type = StickerType::Webm;
}

if (isAudioFile()
|| isAnimation()
|| isVoiceMessage()
Expand Down Expand Up @@ -483,8 +515,7 @@ bool DocumentData::checkWallPaperProperties() {
}
if (type != FileDocument
|| !hasThumbnail()
|| !dimensions.width()
|| !dimensions.height()
|| dimensions.isEmpty()
|| dimensions.width() > Storage::kMaxWallPaperDimension
|| dimensions.height() > Storage::kMaxWallPaperDimension
|| size > Storage::kMaxWallPaperInMemory) {
Expand Down
Loading

0 comments on commit 73a52b4

Please sign in to comment.