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 837336644..1c4deb199 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt @@ -34,7 +34,7 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam return@coroutineScope Result.failure() } - if (pendingUpdates.isNotEmpty()) { + if (!pendingUpdates.isNullOrEmpty()) { createUpdateNotification(pendingUpdates.map { it.name }) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt index 4971000e5..87d1de650 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt @@ -39,10 +39,10 @@ internal class ExtensionGithubApi { } } - suspend fun checkForUpdates(context: Context): List { + suspend fun checkForUpdates(context: Context): List? { // Limit checks to once a day at most if (Date().time < preferences.lastExtCheck().get() + TimeUnit.DAYS.toMillis(1)) { - return emptyList() + return null } val extensions = findExtensions() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 566ebe9f0..3bd4c1d74 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -361,8 +361,9 @@ class MainActivity : BaseViewBindingActivity() { // Extension updates try { - val pendingUpdates = ExtensionGithubApi().checkForUpdates(this@MainActivity) - preferences.extensionUpdatesCount().set(pendingUpdates.size) + ExtensionGithubApi().checkForUpdates(this@MainActivity)?.let { pendingUpdates -> + preferences.extensionUpdatesCount().set(pendingUpdates.size) + } } catch (e: Exception) { logcat(LogPriority.ERROR, e) }