Hopefully fix app installation progress badges not disappearing

This commit is contained in:
MM20 2021-12-07 17:51:45 +01:00
parent 9b4028f9f8
commit 73d65d1a30
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389

View File

@ -119,6 +119,13 @@ class AppRepository(
override fun onProgressChanged(sessionId: Int, progress: Float) {
val session = packageInstaller.getSessionInfo(sessionId) ?: return
val pkg = session.appPackageName ?: return
if (!installingPackages.containsKey(sessionId)) {
val key = "app://$pkg"
val badge = badgeProvider.getBadge(key)?.also { it.progress = null }
?: Badge()
badgeProvider.setBadge(key, badge)
return
}
badgeProvider.updateBadge("app://$pkg", Badge(progress = progress))
}