mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-02-03 03:57:41 +01:00
made conditional for auto-download easier to read, moved log message output to a better spot
This commit is contained in:
parent
abc1c8a8dc
commit
fe5d1debc2
@ -463,12 +463,20 @@ public final class DBTasks {
|
|||||||
return autodownloadExec.submit(new Runnable() {
|
return autodownloadExec.submit(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (BuildConfig.DEBUG)
|
|
||||||
|
// true if we should auto download based on network status
|
||||||
|
boolean networkShouldAutoDl = NetworkUtils.autodownloadNetworkAvailable(context)
|
||||||
|
&& UserPreferences.isEnableAutodownload();
|
||||||
|
|
||||||
|
// true if we should auto download based on power status
|
||||||
|
boolean powerShouldAutoDl = PowerUtils.deviceCharging(context)
|
||||||
|
|| UserPreferences.isEnableAutodownloadOnBattery();
|
||||||
|
|
||||||
|
// we should only auto download if both network AND power are happy
|
||||||
|
if (networkShouldAutoDl && powerShouldAutoDl) {
|
||||||
|
|
||||||
Log.d(TAG, "Performing auto-dl of undownloaded episodes");
|
Log.d(TAG, "Performing auto-dl of undownloaded episodes");
|
||||||
if ((NetworkUtils.autodownloadNetworkAvailable(context)
|
|
||||||
&& UserPreferences.isEnableAutodownload())
|
|
||||||
&& (PowerUtils.deviceCharging(context)
|
|
||||||
|| UserPreferences.isEnableAutodownloadOnBattery())) {
|
|
||||||
final List<FeedItem> queue = DBReader.getQueue(context);
|
final List<FeedItem> queue = DBReader.getQueue(context);
|
||||||
final List<FeedItem> unreadItems = DBReader
|
final List<FeedItem> unreadItems = DBReader
|
||||||
.getUnreadItemsList(context);
|
.getUnreadItemsList(context);
|
||||||
|
@ -255,8 +255,7 @@ public class DownloadRequester {
|
|||||||
* Cancels all running downloads
|
* Cancels all running downloads
|
||||||
*/
|
*/
|
||||||
public synchronized void cancelAllDownloads(Context context) {
|
public synchronized void cancelAllDownloads(Context context) {
|
||||||
if (BuildConfig.DEBUG)
|
Log.d(TAG, "Cancelling all running downloads");
|
||||||
Log.d(TAG, "Cancelling all running downloads");
|
|
||||||
context.sendBroadcast(new Intent(
|
context.sendBroadcast(new Intent(
|
||||||
DownloadService.ACTION_CANCEL_ALL_DOWNLOADS));
|
DownloadService.ACTION_CANCEL_ALL_DOWNLOADS));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user