Fix extension installer running on loop when all updates for extensions are previously installed by app

This commit is contained in:
Jays2Kings 2021-08-07 13:21:56 -04:00
parent 9f31529870
commit 7dfbd6aab3
2 changed files with 19 additions and 17 deletions

View File

@ -109,7 +109,7 @@ class ExtensionInstallService(
}
job?.invokeOnCompletion {
if (showUpdatedNotification) {
if (showUpdatedNotification && installedExtensions.size > 0) {
notifier.showUpdatedNotification(installedExtensions, preferences.hideNotificationContent())
}
if (reRunUpdateCheck || installedExtensions.size != list.size) {

View File

@ -61,11 +61,12 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
val extensionManager = Injekt.get<ExtensionManager>()
val extensionsInstalledByApp =
extensions.filter { extensionManager.isInstalledByApp(it) }
if (extensionsInstalledByApp.isNotEmpty()) {
val intent =
ExtensionInstallService.jobIntent(
context,
extensionsInstalledByApp,
// Re reun this job if not all the extensions can be auto updated
// Re run this job if not all the extensions can be auto updated
if (extensionsInstalledByApp.size == extensions.size) {
1
} else {
@ -78,6 +79,7 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
} else {
extensions.removeAll(extensionsInstalledByApp)
}
}
} else {
runJobAgain(context, NetworkType.UNMETERED)
}