mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-24 21:58:34 +03:00
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 <arkon@users.noreply.github.com>
This commit is contained in:
parent
1e4d7f8c6e
commit
c0d0ff66b6
2 changed files with 3 additions and 3 deletions
|
@ -17,9 +17,9 @@ class AppUpdateChecker {
|
||||||
private val networkService: NetworkHelper by injectLazy()
|
private val networkService: NetworkHelper by injectLazy()
|
||||||
private val preferences: PreferencesHelper 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
|
// 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
|
return AppUpdateResult.NoNewUpdate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ class AboutController : SettingsController(), NoAppBarElevationController {
|
||||||
|
|
||||||
launchNow {
|
launchNow {
|
||||||
try {
|
try {
|
||||||
when (val result = updateChecker.checkForUpdate(activity!!)) {
|
when (val result = updateChecker.checkForUpdate(activity!!, isUserPrompt = true)) {
|
||||||
is AppUpdateResult.NewUpdate -> {
|
is AppUpdateResult.NewUpdate -> {
|
||||||
NewUpdateDialogController(result).showDialog(router)
|
NewUpdateDialogController(result).showDialog(router)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue