mirror of
https://github.com/narrrl/proton-stream.git
synced 2026-11-03 16:41:26 +01:00
feat(app,android): play from the Downloads page, and say why a download waits
- A finished download on the desktop could only be deleted from the Downloads page; watching it meant finding it in the library. Finished rows gain Play, from wherever the library says it was left, and Open. - Android showed "Queued" for a download WorkManager was holding back on mobile data because of Wi-Fi only, or for want of any connection, which reads as stuck. Those now say "Waiting for Wi-Fi" and "Waiting for a connection".
This commit is contained in:
1 parent
01c252b794
commit
690455f7dd
5 files changed
+54
-6
No files matched your search
@@ -112,6 +112,9 @@ const NAV: [Page; 5] = [
|
||||
pub enum Action {
|
||||
Goto(Page),
|
||||
Play(PlaybackTarget),
|
||||
/// Play a file from wherever the library says it was left, for a caller
|
||||
/// whose target may be older than that — a download queued last week.
|
||||
PlayResuming(PlaybackTarget),
|
||||
/// Download one or more files as complete local copies.
|
||||
MakeOffline(Vec<PlaybackTarget>),
|
||||
PauseDownload(DownloadKey),
|
||||
@@ -1559,6 +1562,18 @@ impl App {
|
||||
self.form.repair_password.clear();
|
||||
self.engine.repair_share(id, url, password);
|
||||
}
|
||||
Action::PlayResuming(mut target) => {
|
||||
target.resume_at = self.library.titles.iter().find_map(|title| {
|
||||
title
|
||||
.episodes()
|
||||
.find(|episode| {
|
||||
episode.node.share_id == target.share_id
|
||||
&& episode.node.link_id == target.link_id
|
||||
})
|
||||
.and_then(|episode| episode.resume_at())
|
||||
});
|
||||
self.apply(ctx, Action::Play(target));
|
||||
}
|
||||
Action::OpenShareForm => {
|
||||
self.page = Page::Shares;
|
||||
self.form.focus = true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Inspectable desktop download queue.
|
||||
|
||||
use crate::app::Action;
|
||||
use crate::app::{Action, Page};
|
||||
use crate::engine::{DownloadItem, DownloadState};
|
||||
use crate::{theme, ui};
|
||||
|
||||
@@ -222,6 +222,14 @@ fn buttons(ui: &mut egui::Ui, item: &DownloadItem, actions: &mut Vec<Action>) {
|
||||
}
|
||||
}
|
||||
DownloadState::Completed => {
|
||||
// The point of a download is to watch it, and the library is a
|
||||
// detour from here — offline most of all.
|
||||
if ui::accent_button(ui, "Play").clicked() {
|
||||
actions.push(Action::PlayResuming(item.target.clone()));
|
||||
}
|
||||
if ui.button("Open").on_hover_text("Go to its title").clicked() {
|
||||
actions.push(Action::Goto(Page::Title(item.target.title_key.clone())));
|
||||
}
|
||||
if ui
|
||||
.button("Delete")
|
||||
.on_hover_text("Delete the offline copy; keep the online source")
|
||||
|
||||
Reference in new issue
Block a user