2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Rename some methods in DocumentData.

Also fix voice message mark as read when autoplaying after previous.
Also show play icon and don't show playlist for audio files that do
not have shared music files attributes but have audio file mime type.
This commit is contained in:
John Preston
2017-12-10 14:26:58 +04:00
parent 4ef3de5287
commit 8b69e6ab99
29 changed files with 342 additions and 257 deletions

View File

@@ -239,7 +239,7 @@ bool Instance::moveInPlaylist(
item->fullId()
});
}
if (document->tryPlaySong()) {
if (document->isAudioFile()) {
play(AudioMsgId(document, item->fullId()));
} else {
DocumentOpenClickHandler::doOpen(
@@ -298,18 +298,19 @@ void Instance::play(AudioMsgId::Type type) {
}
void Instance::play(const AudioMsgId &audioId) {
if (!audioId) {
const auto document = audioId.audio();
if (!audioId || !document) {
return;
}
if (audioId.audio()->tryPlaySong() || audioId.audio()->voice()) {
if (document->isAudioFile() || document->isVoiceMessage()) {
mixer()->play(audioId);
setCurrent(audioId);
if (audioId.audio()->loading()) {
documentLoadProgress(audioId.audio());
if (document->loading()) {
documentLoadProgress(document);
}
} else if (audioId.audio()->isRoundVideo()) {
if (auto item = App::histItemById(audioId.contextId())) {
if (auto media = item->getMedia()) {
} else if (document->isVideoMessage()) {
if (const auto item = App::histItemById(audioId.contextId())) {
if (const auto media = item->getMedia()) {
media->playInline();
}
}
@@ -395,7 +396,7 @@ void Instance::stopSeeking(AudioMsgId::Type type) {
}
void Instance::documentLoadProgress(DocumentData *document) {
const auto type = document->tryPlaySong()
const auto type = document->isAudioFile()
? AudioMsgId::Type::Song
: AudioMsgId::Type::Voice;
emitUpdate(type, [document](const AudioMsgId &audioId) {