소스 검색

Fixed extensions showing as obsolete when call fails

(cherry picked from commit a44e9a19b0cfceeaeecd8ad378f14ccd47c8683c)
Jay 5 년 전
부모
커밋
b74fb2ef5e
1개의 변경된 파일8개의 추가작업 그리고 6개의 파일을 삭제
  1. 8 6
      app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionManager.kt

+ 8 - 6
app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionManager.kt

@@ -159,6 +159,10 @@ class ExtensionManager(
      * @param availableExtensions The list of extensions given by the [api].
      */
     private fun updatedInstalledExtensionsStatuses(availableExtensions: List<Extension.Available>) {
+        if (availableExtensions.isEmpty()) {
+            return
+        }
+
         val mutInstalledExtensions = installedExtensions.toMutableList()
         var changed = false
 
@@ -166,12 +170,10 @@ class ExtensionManager(
             val pkgName = installedExt.pkgName
             val availableExt = availableExtensions.find { it.pkgName == pkgName }
 
-            if (availableExt == null) {
-                if (!installedExt.isObsolete) {
-                    mutInstalledExtensions[index] = installedExt.copy(isObsolete = true)
-                    changed = true
-                }
-            } else {
+            if (availableExt == null && !installedExt.isObsolete) {
+                mutInstalledExtensions[index] = installedExt.copy(isObsolete = true)
+                changed = true
+            } else if (availableExt != null) {
                 val hasUpdate = availableExt.versionCode > installedExt.versionCode
                 if (installedExt.hasUpdate != hasUpdate) {
                     mutInstalledExtensions[index] = installedExt.copy(hasUpdate = hasUpdate)