diff --git a/Telegram/Resources/animations/transcribe_loading.tgs b/Telegram/Resources/animations/transcribe_loading.tgs
new file mode 100644
index 0000000000..f63b6e9a02
Binary files /dev/null and b/Telegram/Resources/animations/transcribe_loading.tgs differ
diff --git a/Telegram/Resources/qrc/telegram/animations.qrc b/Telegram/Resources/qrc/telegram/animations.qrc
index cc9c2313ed..4e206e01ca 100644
--- a/Telegram/Resources/qrc/telegram/animations.qrc
+++ b/Telegram/Resources/qrc/telegram/animations.qrc
@@ -39,6 +39,7 @@
../../animations/edit_peers/topics_list.tgs
../../animations/edit_peers/direct_messages.tgs
../../animations/no_chats.tgs
+ ../../animations/transcribe_loading.tgs
../../animations/dice/dice_idle.tgs
../../animations/dice/dart_idle.tgs
diff --git a/Telegram/SourceFiles/history/view/media/history_view_document.cpp b/Telegram/SourceFiles/history/view/media/history_view_document.cpp
index 2f0030cdec..2a14dd78e6 100644
--- a/Telegram/SourceFiles/history/view/media/history_view_document.cpp
+++ b/Telegram/SourceFiles/history/view/media/history_view_document.cpp
@@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "lottie/lottie_icon.h"
#include "storage/localstorage.h"
+#include "lottie/lottie_icon.h"
#include "main/main_session.h"
#include "media/player/media_player_float.h" // Media::Player::RoundPainter.
#include "media/audio/media_audio.h"
@@ -25,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/media/history_view_media_common.h"
#include "ui/text/format_values.h"
#include "ui/text/format_song_document_name.h"
+#include "ui/text/text_lottie_custom_emoji.h"
#include "ui/text/text_utilities.h"
#include "ui/chat/chat_style.h"
#include "ui/painter.h"
@@ -440,15 +442,23 @@ QSize Document::countOptimalSize() {
voice->transcribe->setLoading(
entry.shown && (entry.requestId || entry.pending),
update);
+ const auto pending = entry.pending;
+ auto descriptor = pending
+ ? Lottie::IconDescriptor{
+ .name = u"transcribe_loading"_q,
+ .sizeOverride = Size(st::historyTranscribeLoadingSize),
+ }
+ : Lottie::IconDescriptor();
auto text = (entry.requestId || !entry.shown)
? TextWithEntities()
: entry.toolong
? Ui::Text::Italic(tr::lng_audio_transcribe_long(tr::now))
: entry.failed
? Ui::Text::Italic(tr::lng_attach_failed(tr::now))
- : TextWithEntities{
- entry.result + (entry.pending ? " [...]" : ""),
- };
+ : TextWithEntities(entry.result).append(
+ pending
+ ? Ui::Text::LottieEmoji(descriptor)
+ : TextWithEntities());
voice->transcribe->setOpened(
!text.empty(),
creating ? Fn() : update);
@@ -461,7 +471,11 @@ QSize Document::countOptimalSize() {
voice->transcribeText = Ui::Text::String(minResizeWidth);
voice->transcribeText.setMarkedText(
st::messageTextStyle,
- text);
+ text,
+ kMarkupTextOptions,
+ pending
+ ? Ui::Text::LottieEmojiContext(std::move(descriptor))
+ : Ui::Text::MarkedContext());
hasTranscribe = true;
if (const auto skipBlockWidth = _parent->hasVisibleText()
? 0
diff --git a/Telegram/SourceFiles/ui/chat/chat.style b/Telegram/SourceFiles/ui/chat/chat.style
index a2ed0b4544..dd4c670b74 100644
--- a/Telegram/SourceFiles/ui/chat/chat.style
+++ b/Telegram/SourceFiles/ui/chat/chat.style
@@ -528,6 +528,7 @@ historyVoiceMessageOutTTLSelected: icon {{ "chat/mini_media_once", historyFileOu
historyTranscribeSkip: 10px;
historyTranscribeSize: size(28px, 22px);
historyTranscribeRadius: 4px;
+historyTranscribeLoadingSize: 24px;
historyTranscribeInIcon: icon {{ "chat/voice_to_text", msgFileInBg }};
historyTranscribeInIconSelected: icon {{ "chat/voice_to_text", msgFileInBgSelected }};
historyTranscribeOutIcon: icon {{ "chat/voice_to_text", msgFileOutBg }};