Beta version 1.7.4: Use loadedInMediaCache for songs.

This commit is contained in:
John Preston 2019-06-04 18:59:26 +03:00
parent 961fd1dbab
commit c7b1683f6e
3 changed files with 16 additions and 4 deletions

View File

@ -395,10 +395,16 @@ void Instance::playStreamed(
data->streamed->player.updates(
) | rpl::start_with_next_error([=](Streaming::Update &&update) {
handleStreamingUpdate(data, std::move(update));
}, [=](Streaming::Error && error) {
}, [=](Streaming::Error &&error) {
handleStreamingError(data, std::move(error));
}, data->streamed->player.lifetime());
data->streamed->player.fullInCache(
) | rpl::start_with_next([=](bool fullInCache) {
const auto document = data->streamed->id.audio();
document->setLoadedInMediaCache(fullInCache);
}, data->streamed->player.lifetime());
data->streamed->player.play(streamingOptions(audioId));
emitUpdate(audioId.type());

View File

@ -1986,6 +1986,7 @@ void OverlayWidget::initStreaming() {
createStreamingObjects();
Core::App().updateNonIdle();
_streamed->player.updates(
) | rpl::start_with_next_error([=](Streaming::Update &&update) {
handleStreamingUpdate(std::move(update));

View File

@ -1088,7 +1088,9 @@ void Document::paint(Painter &p, const QRect &clip, TextSelection selection, con
}
void Document::drawCornerDownload(Painter &p, bool selected, const PaintContext *context) const {
if (_data->loaded() || !downloadInCorner()) {
if (_data->loaded()
|| _data->loadedInMediaCache()
|| !downloadInCorner()) {
return;
}
const auto size = st::overviewSmallCheck.size;
@ -1124,7 +1126,9 @@ TextState Document::cornerDownloadTextState(
QPoint point,
StateRequest request) const {
auto result = TextState(parent());
if (!downloadInCorner() || _data->loaded()) {
if (!downloadInCorner()
|| _data->loaded()
|| _data->loadedInMediaCache()) {
return result;
}
const auto size = st::overviewSmallCheck.size;
@ -1163,7 +1167,8 @@ TextState Document::getState(
_st.songThumbSize,
_width);
if (inner.contains(point)) {
const auto link = (_data->loading() || _data->uploading())
const auto link = (!downloadInCorner()
&& (_data->loading() || _data->uploading()))
? _cancell
: (loaded || _data->canBePlayed())
? _openl