mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02:00
Added floating panel of playing playlist for scheduled audio files.
This commit is contained in:
parent
348cf4829c
commit
af7ea90246
3 changed files with 18 additions and 3 deletions
|
@ -70,7 +70,22 @@ rpl::producer<SparseIdsMergedSlice> AbstractController::mediaSource(
|
||||||
int limitAfter) const {
|
int limitAfter) const {
|
||||||
Expects(peer() != nullptr);
|
Expects(peer() != nullptr);
|
||||||
|
|
||||||
return SharedMediaMergedViewer(
|
const auto isScheduled = [&] {
|
||||||
|
if (IsServerMsgId(aroundId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const auto channelId = peerToChannel(peer()->id);
|
||||||
|
if (const auto item = session().data().message(channelId, aroundId)) {
|
||||||
|
return item->isScheduled();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}();
|
||||||
|
|
||||||
|
auto mediaViewer = isScheduled
|
||||||
|
? SharedScheduledMediaViewer
|
||||||
|
: SharedMediaMergedViewer;
|
||||||
|
|
||||||
|
return mediaViewer(
|
||||||
&session(),
|
&session(),
|
||||||
SharedMediaMergedKey(
|
SharedMediaMergedKey(
|
||||||
SparseIdsMergedSlice::Key(
|
SparseIdsMergedSlice::Key(
|
||||||
|
|
|
@ -913,7 +913,7 @@ SparseIdsMergedSlice::Key ListWidget::sliceKey(
|
||||||
|
|
||||||
void ListWidget::refreshViewer() {
|
void ListWidget::refreshViewer() {
|
||||||
_viewerLifetime.destroy();
|
_viewerLifetime.destroy();
|
||||||
auto idForViewer = sliceKey(_universalAroundId).universalId;
|
const auto idForViewer = sliceKey(_universalAroundId).universalId;
|
||||||
_controller->mediaSource(
|
_controller->mediaSource(
|
||||||
idForViewer,
|
idForViewer,
|
||||||
_idsLimit,
|
_idsLimit,
|
||||||
|
|
|
@ -244,7 +244,7 @@ void Panel::refreshList() {
|
||||||
const auto document = media ? media->document() : nullptr;
|
const auto document = media ? media->document() : nullptr;
|
||||||
if (!document
|
if (!document
|
||||||
|| !document->isSharedMediaMusic()
|
|| !document->isSharedMediaMusic()
|
||||||
|| !IsServerMsgId(item->id)) {
|
|| (!IsServerMsgId(item->id) && !item->isScheduled())) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
const auto result = item->history()->peer;
|
const auto result = item->history()->peer;
|
||||||
|
|
Loading…
Add table
Reference in a new issue