Compare commits

..

8 Commits

Author SHA1 Message Date
John Preston
f9bf6dbc1e Beta version 3.4.5: Fix build with GCC. 2022-01-16 23:25:08 +03:00
John Preston
64b5269648 Beta version 3.4.5.
- Fix crash in monospace blocks processing.
- Fix reaction animations stopping after an hour uptime.
2022-01-16 22:57:01 +03:00
John Preston
f394cecf55 Fix crash in monospace blocks processing.
Fixes #23905.
2022-01-16 14:13:41 +03:00
23rd
8b56676c23 Fixed formatting of some internal links. 2022-01-16 14:13:12 +03:00
23rd
e2713ea627 Added ability to create formatted internal links. 2022-01-16 14:13:10 +03:00
John Preston
f5e50409d3 Add initial reaction bubble appear animation. 2022-01-16 14:11:50 +03:00
John Preston
050916a56a Fix userpics in more than one recent reaction. 2022-01-15 22:02:10 +03:00
John Preston
cdf36cc387 Fix reaction animations stopping after an hour uptime. 2022-01-15 12:38:47 +03:00
17 changed files with 123 additions and 70 deletions

View File

@@ -10,7 +10,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="3.4.4.0" />
Version="3.4.5.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>

View File

@@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,4,4,0
PRODUCTVERSION 3,4,4,0
FILEVERSION 3,4,5,0
PRODUCTVERSION 3,4,5,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "3.4.4.0"
VALUE "FileVersion", "3.4.5.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "3.4.4.0"
VALUE "ProductVersion", "3.4.5.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,4,4,0
PRODUCTVERSION 3,4,4,0
FILEVERSION 3,4,5,0
PRODUCTVERSION 3,4,5,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -53,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "3.4.4.0"
VALUE "FileVersion", "3.4.5.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "3.4.4.0"
VALUE "ProductVersion", "3.4.5.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -1530,10 +1530,8 @@ RevokePublicLinkBox::Inner::Inner(
Ui::NameTextOptions());
row.status.setMarkedText(
st::defaultTextStyle,
Ui::Text::Link(
peer->userName(),
_session->createInternalLink(peer->userName())),
Ui::DialogTextOptions());
_session->createInternalLink(
Ui::Text::Link(peer->userName())));
_rows.push_back(std::move(row));
}
}

View File

@@ -66,6 +66,12 @@ std::map<int, const char*> BetaLogs() {
"- Spoiler formatting hides text in chat, "
"as well as in the chat list and notifications.\n"
},
{
3004005,
"- Fix crash in monospace blocks processing.\n"
"- Fix reaction animations stopping after an hour uptime.\n"
}
};
};

View File

@@ -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 = 3004004;
constexpr auto AppVersionStr = "3.4.4";
constexpr auto AppVersion = 3004005;
constexpr auto AppVersionStr = "3.4.5";
constexpr auto AppBetaVersion = true;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;

View File

@@ -279,38 +279,8 @@ void Reactions::request() {
MTP_int(_hash)
)).done([=](const MTPmessages_AvailableReactions &result) {
_requestId = 0;
const auto oldCache = base::take(_iconsCache);
const auto toCache = [&](DocumentData *document) {
if (document) {
_iconsCache.emplace(document, document->createMediaView());
}
};
result.match([&](const MTPDmessages_availableReactions &data) {
_hash = data.vhash().v;
const auto &list = data.vreactions().v;
_active.clear();
_available.clear();
_active.reserve(list.size());
_available.reserve(list.size());
_iconsCache.reserve(list.size() * 2);
for (const auto &reaction : list) {
if (const auto parsed = parse(reaction)) {
_available.push_back(*parsed);
if (parsed->active) {
_active.push_back(*parsed);
toCache(parsed->appearAnimation);
toCache(parsed->selectAnimation);
toCache(parsed->centerIcon);
toCache(parsed->aroundAnimation);
}
}
}
if (_waitingForList) {
_waitingForList = false;
resolveImages();
}
_updated.fire({});
updateFromData(data);
}, [&](const MTPDmessages_availableReactionsNotModified &) {
});
}).fail([=] {
@@ -319,6 +289,40 @@ void Reactions::request() {
}).send();
}
void Reactions::updateFromData(const MTPDmessages_availableReactions &data) {
_hash = data.vhash().v;
const auto &list = data.vreactions().v;
const auto oldCache = base::take(_iconsCache);
const auto toCache = [&](DocumentData *document) {
if (document) {
_iconsCache.emplace(document, document->createMediaView());
}
};
_active.clear();
_available.clear();
_active.reserve(list.size());
_available.reserve(list.size());
_iconsCache.reserve(list.size() * 4);
for (const auto &reaction : list) {
if (const auto parsed = parse(reaction)) {
_available.push_back(*parsed);
if (parsed->active) {
_active.push_back(*parsed);
toCache(parsed->appearAnimation);
toCache(parsed->selectAnimation);
toCache(parsed->centerIcon);
toCache(parsed->aroundAnimation);
}
}
}
if (_waitingForList) {
_waitingForList = false;
resolveImages();
}
_updated.fire({});
}
std::optional<Reaction> Reactions::parse(const MTPAvailableReaction &entry) {
return entry.match([&](const MTPDavailableReaction &data) {
const auto emoji = qs(data.vreaction());

View File

@@ -78,6 +78,7 @@ private:
};
void request();
void updateFromData(const MTPDmessages_availableReactions &data);
[[nodiscard]] std::optional<Reaction> parse(
const MTPAvailableReaction &entry);

View File

@@ -168,6 +168,10 @@ bool SendAnimation::flying() const {
return (_flyIcon != nullptr);
}
float64 SendAnimation::flyingProgress() const {
return _fly.value(1.);
}
QString SendAnimation::playingAroundEmoji() const {
const auto finished = !_valid
|| (!_flyIcon && !_center->animating() && !_effect->animating());

View File

@@ -37,6 +37,7 @@ public:
[[nodiscard]] QString playingAroundEmoji() const;
[[nodiscard]] bool flying() const;
[[nodiscard]] float64 flyingProgress() const;
private:
void flyCallback();

View File

@@ -259,33 +259,46 @@ void InlineList::paint(
}
p.setFont(st::semiboldFont);
for (const auto &button : _buttons) {
const auto &geometry = button.geometry;
const auto mine = (_data.chosenReaction == button.emoji);
const auto withoutMine = button.count - (mine ? 1 : 0);
const auto animating = (animated == button.emoji);
const auto skipImage = animating
&& (withoutMine < 1 || !_animation->flying());
const auto skipBubble = skipImage && _animation->flying();
const auto &geometry = button.geometry;
const auto bubbleProgress = skipImage
? _animation->flyingProgress()
: 1.;
const auto bubbleReady = (bubbleProgress == 1.);
const auto bubbleSkip = anim::interpolate(
geometry.height() - geometry.width(),
0,
bubbleProgress);
const auto inner = geometry.marginsRemoved(padding);
const auto chosen = mine
&& (!animating || !_animation->flying());
if (!skipBubble) {
&& (!animating || !_animation->flying() || skipImage);
if (bubbleProgress > 0.) {
auto hq = PainterHighQualityEnabler(p);
p.setPen(Qt::NoPen);
if (inbubble) {
if (!chosen) {
p.setOpacity(context.outbg
p.setOpacity(bubbleProgress * (context.outbg
? kOutNonChosenOpacity
: kInNonChosenOpacity);
: kInNonChosenOpacity));
} else if (!bubbleReady) {
p.setOpacity(bubbleProgress);
}
p.setBrush(stm->msgFileBg);
} else {
if (!bubbleReady) {
p.setOpacity(bubbleProgress);
}
p.setBrush(chosen ? st->msgServiceFg() : st->msgServiceBg());
}
const auto radius = geometry.height() / 2.;
p.drawRoundedRect(geometry, radius, radius);
const auto fill = geometry.marginsAdded({ 0, 0, bubbleSkip, 0 });
p.drawRoundedRect(fill, radius, radius);
if (inbubble && !chosen) {
p.setOpacity(1.);
p.setOpacity(bubbleProgress);
}
}
if (button.image.isNull()) {
@@ -304,13 +317,14 @@ void InlineList::paint(
return _animation->paintGetArea(p, QPoint(), image);
};
}
if (skipBubble) {
if (bubbleProgress == 0.) {
continue;
}
resolveUserpicsImage(button);
const auto left = inner.x() + bubbleSkip;
if (button.userpics) {
p.drawImage(
inner.x() + size + st::reactionInlineUserpicsPadding.left(),
left + size + st::reactionInlineUserpicsPadding.left(),
geometry.y() + st::reactionInlineUserpicsPadding.top(),
button.userpics->image);
} else {
@@ -330,10 +344,13 @@ void InlineList::paint(
const auto textTop = geometry.y()
+ ((geometry.height() - st::semiboldFont->height) / 2);
p.drawText(
inner.x() + size + st::reactionInlineSkip,
left + size + st::reactionInlineSkip,
textTop + st::semiboldFont->ascent,
button.countText);
}
if (!bubbleReady) {
p.setOpacity(1.);
}
}
}
@@ -429,6 +446,7 @@ InlineListData InlineListDataFromMessage(not_null<Message*> message) {
|| sum > kMaxRecentUserpics) {
return false;
}
++b;
}
return true;
}();

View File

@@ -33,6 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/unixtime.h"
#include "calls/calls_instance.h"
#include "support/support_helper.h"
#include "ui/text/text_utilities.h"
#ifndef TDESKTOP_DISABLE_SPELLCHECK
#include "chat_helpers/spellchecker_common.h"
@@ -292,22 +293,33 @@ rpl::producer<bool> Session::termsLockValue() const {
}
QString Session::createInternalLink(const QString &query) const {
auto result = createInternalLinkFull(query);
auto prefixes = {
return createInternalLink(TextWithEntities{ .text = query }).text;
}
QString Session::createInternalLinkFull(const QString &query) const {
return createInternalLinkFull(TextWithEntities{ .text = query }).text;
}
TextWithEntities Session::createInternalLink(
const TextWithEntities &query) const {
const auto result = createInternalLinkFull(query);
const auto prefixes = {
qstr("https://"),
qstr("http://"),
};
for (auto &prefix : prefixes) {
if (result.startsWith(prefix, Qt::CaseInsensitive)) {
return result.mid(prefix.size());
if (result.text.startsWith(prefix, Qt::CaseInsensitive)) {
return Ui::Text::Mid(result, prefix.size());
}
}
LOG(("Warning: bad internal url '%1'").arg(result));
LOG(("Warning: bad internal url '%1'").arg(result.text));
return result;
}
QString Session::createInternalLinkFull(const QString &query) const {
return ValidatedInternalLinksDomain(this) + query;
TextWithEntities Session::createInternalLinkFull(
TextWithEntities query) const {
return TextWithEntities::Simple(ValidatedInternalLinksDomain(this))
.append(std::move(query));
}
bool Session::supportMode() const {

View File

@@ -146,6 +146,10 @@ public:
[[nodiscard]] QString createInternalLink(const QString &query) const;
[[nodiscard]] QString createInternalLinkFull(const QString &query) const;
[[nodiscard]] TextWithEntities createInternalLink(
const TextWithEntities &query) const;
[[nodiscard]] TextWithEntities createInternalLinkFull(
TextWithEntities query) const;
void setTmpPassword(const QByteArray &password, TimeId validUntil);
[[nodiscard]] QByteArray validTmpPassword() const;

View File

@@ -319,7 +319,7 @@ OverlayWidget::OverlayWidget()
tr::lng_mediaview_downloads(tr::now),
"internal:show_saved_message"),
Ui::Text::WithEntities);
_saveMsgText.setMarkedText(st::mediaviewSaveMsgStyle, text, Ui::DialogTextOptions());
_saveMsgText.setMarkedText(st::mediaviewSaveMsgStyle, text);
_saveMsg = QRect(0, 0, _saveMsgText.maxWidth() + st::mediaviewSaveMsgPadding.left() + st::mediaviewSaveMsgPadding.right(), st::mediaviewSaveMsgStyle.font->height + st::mediaviewSaveMsgPadding.top() + st::mediaviewSaveMsgPadding.bottom());
_saveMsgImage = QImage(
_saveMsg.size() * cIntRetinaFactor(),

View File

@@ -1,7 +1,7 @@
AppVersion 3004004
AppVersion 3004005
AppVersionStrMajor 3.4
AppVersionStrSmall 3.4.4
AppVersionStr 3.4.4
AppVersionStrSmall 3.4.5
AppVersionStr 3.4.5
BetaChannel 1
AlphaVersion 0
AppVersionOriginal 3.4.4.beta
AppVersionOriginal 3.4.5.beta

View File

@@ -1,3 +1,8 @@
3.4.5 beta (16.01.21)
- Fix crash in monospace blocks processing.
- Fix reaction animations stopping after an hour uptime.
3.4.4 beta (14.01.21)
- Nice animations in reactions.