From 0e52f08aa56a52cd5516cbeb2a85415a99d6963b Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sun, 24 Sep 2023 10:03:50 +0200 Subject: Fix file deletion and queueing after download (#6652) WorkManager does not tell us whether it was cancelled by the user (not retried) or by the system (retried later). So we need to delete the file and remove from queue when we know that it was actually the user. Also make sure to always delete the file when the download fails. Also, don't show "will retry" message on last retry attempt. --- .../net/download/serviceinterface/DownloadServiceInterface.java | 3 ++- .../net/download/serviceinterface/DownloadServiceInterfaceStub.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'net/download') diff --git a/net/download/service-interface/src/main/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadServiceInterface.java b/net/download/service-interface/src/main/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadServiceInterface.java index 5fac79ce8..a04c24ee4 100644 --- a/net/download/service-interface/src/main/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadServiceInterface.java +++ b/net/download/service-interface/src/main/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadServiceInterface.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.net.download.serviceinterface; import android.content.Context; import de.danoeh.antennapod.model.download.DownloadStatus; import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import java.util.HashMap; import java.util.Map; @@ -38,7 +39,7 @@ public abstract class DownloadServiceInterface { */ public abstract void download(Context context, FeedItem item); - public abstract void cancel(Context context, String url); + public abstract void cancel(Context context, FeedMedia media); public abstract void cancelAll(Context context); diff --git a/net/download/service-interface/src/main/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadServiceInterfaceStub.java b/net/download/service-interface/src/main/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadServiceInterfaceStub.java index 716d68d14..70f551a9c 100644 --- a/net/download/service-interface/src/main/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadServiceInterfaceStub.java +++ b/net/download/service-interface/src/main/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadServiceInterfaceStub.java @@ -2,6 +2,7 @@ package de.danoeh.antennapod.net.download.serviceinterface; import android.content.Context; import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; public class DownloadServiceInterfaceStub extends DownloadServiceInterface { @@ -14,7 +15,7 @@ public class DownloadServiceInterfaceStub extends DownloadServiceInterface { } @Override - public void cancel(Context context, String url) { + public void cancel(Context context, FeedMedia media) { } @Override -- cgit v1.2.3