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 { job?.invokeOnCompletion {
if (showUpdatedNotification) { if (showUpdatedNotification && installedExtensions.size > 0) {
notifier.showUpdatedNotification(installedExtensions, preferences.hideNotificationContent()) notifier.showUpdatedNotification(installedExtensions, preferences.hideNotificationContent())
} }
if (reRunUpdateCheck || installedExtensions.size != list.size) { 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 extensionManager = Injekt.get<ExtensionManager>()
val extensionsInstalledByApp = val extensionsInstalledByApp =
extensions.filter { extensionManager.isInstalledByApp(it) } extensions.filter { extensionManager.isInstalledByApp(it) }
if (extensionsInstalledByApp.isNotEmpty()) {
val intent = val intent =
ExtensionInstallService.jobIntent( ExtensionInstallService.jobIntent(
context, context,
extensionsInstalledByApp, 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) { if (extensionsInstalledByApp.size == extensions.size) {
1 1
} else { } else {
@ -78,6 +79,7 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
} else { } else {
extensions.removeAll(extensionsInstalledByApp) extensions.removeAll(extensionsInstalledByApp)
} }
}
} else { } else {
runJobAgain(context, NetworkType.UNMETERED) runJobAgain(context, NetworkType.UNMETERED)
} }