From 8aa11951bffd491f52d89815f0f61b40187e37ef Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 13 Aug 2021 18:24:21 -0400 Subject: [PATCH] Do background app/extension checks less frequently Since the in-app checks occur at least once a day anyway. --- .../java/eu/kanade/tachiyomi/data/updater/UpdaterJob.kt | 9 ++++++++- .../eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterJob.kt index 0a48282d1d..4410b7c127 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterJob.kt @@ -8,6 +8,7 @@ import androidx.work.PeriodicWorkRequestBuilder import androidx.work.WorkManager import androidx.work.Worker import androidx.work.WorkerParameters +import eu.kanade.tachiyomi.BuildConfig import kotlinx.coroutines.runBlocking import java.util.concurrent.TimeUnit @@ -31,12 +32,18 @@ class UpdaterJob(private val context: Context, workerParams: WorkerParameters) : private const val TAG = "UpdateChecker" fun setupTask(context: Context) { + // Never check for updates in debug builds that don't include the updater + if (BuildConfig.DEBUG && !BuildConfig.INCLUDE_UPDATER) { + cancelTask(context) + return + } + val constraints = Constraints.Builder() .setRequiredNetworkType(NetworkType.CONNECTED) .build() val request = PeriodicWorkRequestBuilder( - 3, + 7, TimeUnit.DAYS, 3, TimeUnit.HOURS diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt index 974b42827b..fbf2b6f640 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt @@ -73,9 +73,9 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam .build() val request = PeriodicWorkRequestBuilder( - 12, - TimeUnit.HOURS, - 1, + 2, + TimeUnit.DAYS, + 3, TimeUnit.HOURS ) .addTag(TAG)