fix: switch visibility

This commit is contained in:
rebelonion 2024-05-01 21:19:29 -05:00
parent a3e1cc45b3
commit 97ff591b62
4 changed files with 7 additions and 5 deletions

View file

@ -19,7 +19,7 @@ abstract class AddonManager<T : Addon.Installed>(
protected var onListenerAction: ((AddonListener.ListenerAction) -> Unit)? = null protected var onListenerAction: ((AddonListener.ListenerAction) -> Unit)? = null
abstract suspend fun init() abstract suspend fun init()
abstract fun isAvailable(): Boolean abstract fun isAvailable(andEnabled: Boolean = true): Boolean
abstract fun getVersion(): String? abstract fun getVersion(): String?
abstract fun getPackageName(): String? abstract fun getPackageName(): String?
abstract fun hadError(context: Context): String? abstract fun hadError(context: Context): String?

View file

@ -63,7 +63,7 @@ class DownloadAddonManager(
} }
} }
override fun isAvailable(): Boolean { override fun isAvailable(andEnabled: Boolean): Boolean {
return extension?.extension != null return extension?.extension != null
} }

View file

@ -71,8 +71,10 @@ class TorrentAddonManager(
} }
} }
override fun isAvailable(): Boolean { override fun isAvailable(andEnabled: Boolean): Boolean {
return extension?.extension != null && PrefManager.getVal(PrefName.TorrentEnabled) return extension?.extension != null && if (andEnabled) {
PrefManager.getVal(PrefName.TorrentEnabled)
} else true
} }
override fun getVersion(): String? { override fun getVersion(): String? {

View file

@ -203,7 +203,7 @@ class SettingsAddonActivity : AppCompatActivity() {
} }
} }
}, },
isVisible = torrentAddonManager.isAvailable() isVisible = torrentAddonManager.isAvailable(false)
) )
) )
) )