mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-27 03:18:25 +01:00
Fix issues when updating extensions
This commit is contained in:
parent
39407407f2
commit
cb06898430
@ -203,7 +203,13 @@ private fun ExtensionContent(
|
|||||||
items(
|
items(
|
||||||
items = items,
|
items = items,
|
||||||
contentType = { "item" },
|
contentType = { "item" },
|
||||||
key = { "extension-${it.hashCode()}" },
|
key = { item ->
|
||||||
|
when (item.extension) {
|
||||||
|
is Extension.Untrusted -> "extension-untrusted-${item.hashCode()}"
|
||||||
|
is Extension.Installed -> "extension-installed-${item.hashCode()}"
|
||||||
|
is Extension.Available -> "extension-available-${item.hashCode()}"
|
||||||
|
}
|
||||||
|
},
|
||||||
) { item ->
|
) { item ->
|
||||||
ExtensionItem(
|
ExtensionItem(
|
||||||
modifier = Modifier.animateItemPlacement(),
|
modifier = Modifier.animateItemPlacement(),
|
||||||
|
@ -338,6 +338,10 @@ class ExtensionManager(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onExtensionUntrusted(extension: Extension.Untrusted) {
|
override fun onExtensionUntrusted(extension: Extension.Untrusted) {
|
||||||
|
val installedExtension = _installedExtensionsFlow.value
|
||||||
|
.find { it.pkgName == extension.pkgName }
|
||||||
|
?: return
|
||||||
|
_installedExtensionsFlow.value -= installedExtension
|
||||||
_untrustedExtensionsFlow.value += extension
|
_untrustedExtensionsFlow.value += extension
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,8 +70,7 @@ internal class ExtensionInstallReceiver(private val listener: Listener) :
|
|||||||
launchNow {
|
launchNow {
|
||||||
when (val result = getExtensionFromIntent(context, intent)) {
|
when (val result = getExtensionFromIntent(context, intent)) {
|
||||||
is LoadResult.Success -> listener.onExtensionUpdated(result.extension)
|
is LoadResult.Success -> listener.onExtensionUpdated(result.extension)
|
||||||
// Not needed as a package can't be upgraded if the signature is different
|
is LoadResult.Untrusted -> listener.onExtensionUntrusted(result.extension)
|
||||||
// is LoadResult.Untrusted -> {}
|
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user