From c0d0ff66b6b73efae29635a61e4ee2ea13a925b3 Mon Sep 17 00:00:00 2001 From: Andreas Date: Sun, 14 Nov 2021 16:23:12 +0100 Subject: [PATCH] Fix "Check for updates" not working due to time cooldown (#6232) * Fix "Check for updates" not working due to time cooldown * Update AppUpdateChecker.kt Co-authored-by: arkon --- .../java/eu/kanade/tachiyomi/data/updater/AppUpdateChecker.kt | 4 ++-- .../main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateChecker.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateChecker.kt index 7a202a9ea..ccd9be10c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateChecker.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateChecker.kt @@ -17,9 +17,9 @@ class AppUpdateChecker { private val networkService: NetworkHelper by injectLazy() private val preferences: PreferencesHelper by injectLazy() - suspend fun checkForUpdate(context: Context): AppUpdateResult { + suspend fun checkForUpdate(context: Context, isUserPrompt: Boolean = false): AppUpdateResult { // Limit checks to once a day at most - if (Date().time < preferences.lastAppCheck().get() + TimeUnit.DAYS.toMillis(1)) { + if (isUserPrompt.not() && Date().time < preferences.lastAppCheck().get() + TimeUnit.DAYS.toMillis(1)) { return AppUpdateResult.NoNewUpdate } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt index 81794456a..472c74cf2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt @@ -107,7 +107,7 @@ class AboutController : SettingsController(), NoAppBarElevationController { launchNow { try { - when (val result = updateChecker.checkForUpdate(activity!!)) { + when (val result = updateChecker.checkForUpdate(activity!!, isUserPrompt = true)) { is AppUpdateResult.NewUpdate -> { NewUpdateDialogController(result).showDialog(router) }