diff --git a/app/src/main/java/com/futo/platformplayer/states/StateApp.kt b/app/src/main/java/com/futo/platformplayer/states/StateApp.kt index 124c2c2f..36551de6 100644 --- a/app/src/main/java/com/futo/platformplayer/states/StateApp.kt +++ b/app/src/main/java/com/futo/platformplayer/states/StateApp.kt @@ -568,14 +568,23 @@ class StateApp { StateAnnouncement.instance.deleteAnnouncement("plugin-update") scopeOrNull?.launch(Dispatchers.IO) { - val updateAvailableCount = StatePlatform.instance.checkForUpdates() + val updateAvailable = StatePlatform.instance.checkForUpdates() withContext(Dispatchers.Main) { - if (updateAvailableCount > 0) { + if (updateAvailable.isNotEmpty()) { + UIDialogs.appToast( + ToastView.Toast(updateAvailable + .map { " - " + it.name } + .joinToString("\n"), + true, + null, + "Plugin updates available" + )); + StateAnnouncement.instance.registerAnnouncement( "plugin-update", "Plugin updates available", - "There are $updateAvailableCount plugin updates available.", + "There are ${updateAvailable.size} plugin updates available.", AnnouncementType.SESSION_RECURRING ) } diff --git a/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt b/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt index fe06e78d..5c8f77c5 100644 --- a/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt +++ b/app/src/main/java/com/futo/platformplayer/states/StatePlatform.kt @@ -941,8 +941,8 @@ class StatePlatform { } } - suspend fun checkForUpdates(): Int = withContext(Dispatchers.IO) { - var updateAvailableCount = 0 + suspend fun checkForUpdates(): List = withContext(Dispatchers.IO) { + var configs = mutableListOf() val updatesAvailableFor = hashSetOf() for (availableClient in getAvailableClients()) { if (availableClient !is JSClient) { @@ -950,13 +950,13 @@ class StatePlatform { } if (checkForUpdates(availableClient.config)) { - updateAvailableCount++ + configs.add(availableClient.config); updatesAvailableFor.add(availableClient.config.id) } } _updatesAvailableMap = updatesAvailableFor - return@withContext updateAvailableCount + return@withContext configs; } fun clearUpdateAvailable(c: SourcePluginConfig) {