mirror of
https://github.com/Qz3rK/tdesktop.git
synced 2026-07-03 14:15:08 +02:00
Handle MSG_VOICE_TOO_LONG for voice messages.
This commit is contained in:
@@ -78,12 +78,14 @@ void Transcribes::load(not_null<HistoryItem*> item) {
|
||||
_session->data().requestItemResize(item);
|
||||
}
|
||||
});
|
||||
}).fail([=] {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
auto &entry = _map[id];
|
||||
entry.requestId = 0;
|
||||
entry.pending = false;
|
||||
entry.failed = true;
|
||||
if (const auto item = _session->data().message(id)) {
|
||||
if (error.type() == qstr("MSG_VOICE_TOO_LONG")) {
|
||||
entry.toolong = true;
|
||||
} else if (const auto item = _session->data().message(id)) {
|
||||
_session->data().requestItemResize(item);
|
||||
}
|
||||
}).send();
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
QString result;
|
||||
bool shown = false;
|
||||
bool failed = false;
|
||||
bool toolong = false;
|
||||
bool pending = false;
|
||||
mtpRequestId requestId = 0;
|
||||
};
|
||||
|
||||
@@ -256,9 +256,13 @@ QSize Document::countOptimalSize() {
|
||||
update);
|
||||
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 };
|
||||
: TextWithEntities{
|
||||
entry.result + (entry.pending ? " [...]" : ""),
|
||||
};
|
||||
voice->transcribe->setOpened(!text.empty(), update);
|
||||
if (text.empty()) {
|
||||
voice->transcribeText = {};
|
||||
|
||||
Reference in New Issue
Block a user