mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 00:59:17 +01:00
Fix extension update badge reset when app resumed (#6822)
This commit is contained in:
parent
5c0a43e8d6
commit
ef600c0956
@ -34,7 +34,7 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
|
|||||||
return@coroutineScope Result.failure()
|
return@coroutineScope Result.failure()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pendingUpdates.isNotEmpty()) {
|
if (!pendingUpdates.isNullOrEmpty()) {
|
||||||
createUpdateNotification(pendingUpdates.map { it.name })
|
createUpdateNotification(pendingUpdates.map { it.name })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,10 +39,10 @@ internal class ExtensionGithubApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun checkForUpdates(context: Context): List<Extension.Installed> {
|
suspend fun checkForUpdates(context: Context): List<Extension.Installed>? {
|
||||||
// Limit checks to once a day at most
|
// Limit checks to once a day at most
|
||||||
if (Date().time < preferences.lastExtCheck().get() + TimeUnit.DAYS.toMillis(1)) {
|
if (Date().time < preferences.lastExtCheck().get() + TimeUnit.DAYS.toMillis(1)) {
|
||||||
return emptyList()
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
val extensions = findExtensions()
|
val extensions = findExtensions()
|
||||||
|
@ -361,8 +361,9 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
|||||||
|
|
||||||
// Extension updates
|
// Extension updates
|
||||||
try {
|
try {
|
||||||
val pendingUpdates = ExtensionGithubApi().checkForUpdates(this@MainActivity)
|
ExtensionGithubApi().checkForUpdates(this@MainActivity)?.let { pendingUpdates ->
|
||||||
preferences.extensionUpdatesCount().set(pendingUpdates.size)
|
preferences.extensionUpdatesCount().set(pendingUpdates.size)
|
||||||
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logcat(LogPriority.ERROR, e)
|
logcat(LogPriority.ERROR, e)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user