feat: remove every subscription from Settings, and reopen the last video
Remove all sits beside Import in Settings, since emptying the list is the other half of replacing it. It asks first and counts what goes: 210 channels, 3339 videos, 50 downloaded files, in those words. Nothing changes on YouTube, and the confirmation says so — importing or reading the list again brings it all back. It takes the same path an import does when nothing survives, so a video saved on its own from the menu bar is left alone: its channel was never a subscription, and this is about subscriptions. The app also reopens whatever was playing when it last closed, if that video is still in the feed and still playable — offline, one that was streaming is not. The note is made while the player is open and dropped when it is closed, so a restart only reopens something you were in the middle of, never something you had deliberately finished with. Verified both ways: quitting mid-video came back to it, closing the player first came back to the feed. The panel's Remove all downloads is gone; it was a misreading of the request.
This commit is contained in:
@@ -1737,6 +1737,30 @@ pub async fn import_scraped(
|
||||
state.db.lock().await.replace_channels(&channels)
|
||||
}
|
||||
|
||||
/// What clearing the subscription list would take with it.
|
||||
#[tauri::command]
|
||||
pub async fn preview_remove_all_subscriptions(
|
||||
state: State<'_, AppState>,
|
||||
) -> Result<ImportPreview, String> {
|
||||
state.db.lock().await.preview_replace(&[])
|
||||
}
|
||||
|
||||
/// Empties the subscription list, and the videos and files hanging off it.
|
||||
///
|
||||
/// The same path an import takes when nothing survives it, so a video saved on
|
||||
/// its own from the menu bar is left alone here too: its channel was never a
|
||||
/// subscription, and this is about subscriptions.
|
||||
#[tauri::command]
|
||||
pub async fn remove_all_subscriptions(state: State<'_, AppState>) -> Result<usize, String> {
|
||||
let dropped = state.db.lock().await.paths_dropped_by_replace(&[])?;
|
||||
for path in &dropped {
|
||||
let _ = tokio::fs::remove_file(path).await;
|
||||
}
|
||||
let before = state.db.lock().await.list_channels()?.len();
|
||||
state.db.lock().await.replace_channels(&[])?;
|
||||
Ok(before)
|
||||
}
|
||||
|
||||
/// What deleting one subscription would take with it.
|
||||
#[derive(Serialize)]
|
||||
pub struct RemovalPreview {
|
||||
|
||||
@@ -144,6 +144,8 @@ pub fn run() {
|
||||
tray::quit_app,
|
||||
commands::preview_scraped_import,
|
||||
commands::import_scraped,
|
||||
commands::preview_remove_all_subscriptions,
|
||||
commands::remove_all_subscriptions,
|
||||
commands::delete_channel,
|
||||
commands::preview_delete_channel,
|
||||
commands::set_download_defaults,
|
||||
|
||||
@@ -357,7 +357,7 @@ pub fn quit_app(app: AppHandle) {
|
||||
|
||||
/// The panel's own size. Fixed, because it is a menu: it does not resize.
|
||||
const PANEL_W: f64 = 304.0;
|
||||
const PANEL_H: f64 = 296.0;
|
||||
const PANEL_H: f64 = 252.0;
|
||||
|
||||
/// Opens the panel under the menu bar icon.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user