mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 20:31:02 -05:00
Fixed extensions showing as obsolete when call fails
(cherry picked from commit a44e9a19b0cfceeaeecd8ad378f14ccd47c8683c)
This commit is contained in:
parent
f3e228e8a4
commit
b74fb2ef5e
1 changed files with 8 additions and 6 deletions
|
@ -159,6 +159,10 @@ class ExtensionManager(
|
||||||
* @param availableExtensions The list of extensions given by the [api].
|
* @param availableExtensions The list of extensions given by the [api].
|
||||||
*/
|
*/
|
||||||
private fun updatedInstalledExtensionsStatuses(availableExtensions: List<Extension.Available>) {
|
private fun updatedInstalledExtensionsStatuses(availableExtensions: List<Extension.Available>) {
|
||||||
|
if (availableExtensions.isEmpty()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val mutInstalledExtensions = installedExtensions.toMutableList()
|
val mutInstalledExtensions = installedExtensions.toMutableList()
|
||||||
var changed = false
|
var changed = false
|
||||||
|
|
||||||
|
@ -166,12 +170,10 @@ class ExtensionManager(
|
||||||
val pkgName = installedExt.pkgName
|
val pkgName = installedExt.pkgName
|
||||||
val availableExt = availableExtensions.find { it.pkgName == pkgName }
|
val availableExt = availableExtensions.find { it.pkgName == pkgName }
|
||||||
|
|
||||||
if (availableExt == null) {
|
if (availableExt == null && !installedExt.isObsolete) {
|
||||||
if (!installedExt.isObsolete) {
|
|
||||||
mutInstalledExtensions[index] = installedExt.copy(isObsolete = true)
|
mutInstalledExtensions[index] = installedExt.copy(isObsolete = true)
|
||||||
changed = true
|
changed = true
|
||||||
}
|
} else if (availableExt != null) {
|
||||||
} else {
|
|
||||||
val hasUpdate = availableExt.versionCode > installedExt.versionCode
|
val hasUpdate = availableExt.versionCode > installedExt.versionCode
|
||||||
if (installedExt.hasUpdate != hasUpdate) {
|
if (installedExt.hasUpdate != hasUpdate) {
|
||||||
mutInstalledExtensions[index] = installedExt.copy(hasUpdate = hasUpdate)
|
mutInstalledExtensions[index] = installedExt.copy(hasUpdate = hasUpdate)
|
||||||
|
|
Loading…
Reference in a new issue