From 38f251339d6384109c9c156d85d81d8ac7f28fd6 Mon Sep 17 00:00:00 2001 From: C10udburst <18114966+C10udburst@users.noreply.github.com> Date: Tue, 9 Aug 2022 17:03:58 +0200 Subject: [PATCH] fix online plugins and update unloading --- .../com/lagradost/cloudstream3/plugins/PluginManager.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/plugins/PluginManager.kt b/app/src/main/java/com/lagradost/cloudstream3/plugins/PluginManager.kt index 58151019..3b515e64 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/plugins/PluginManager.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/plugins/PluginManager.kt @@ -24,6 +24,7 @@ import com.lagradost.cloudstream3.ui.settings.extensions.REPOSITORIES_KEY import com.lagradost.cloudstream3.ui.settings.extensions.RepositoryData import com.lagradost.cloudstream3.utils.VideoDownloadManager.sanitizeFilename import com.lagradost.cloudstream3.APIHolder +import com.lagradost.cloudstream3.APIHolder.removePluginMapping import com.lagradost.cloudstream3.MainAPI import com.lagradost.cloudstream3.utils.ExtractorApi import com.lagradost.cloudstream3.utils.extractorApis @@ -139,7 +140,7 @@ object PluginManager { * 4. Else load the plugin normally **/ fun updateAllOnlinePluginsAndLoadThem(activity: Activity) { - val urls = getKey>(REPOSITORIES_KEY) ?: emptyArray() + val urls = (getKey>(REPOSITORIES_KEY) ?: emptyArray()) + PREBUILT_REPOSITORIES val onlinePlugins = urls.toList().apmap { getRepoPlugins(it.url)?.toList() ?: emptyList() @@ -294,9 +295,14 @@ object PluginManager { } // remove all registered apis + APIHolder.apis.filter { it -> it.sourcePlugin == plugin.__filename }.forEach { + removePluginMapping(it) + } APIHolder.allProviders.removeIf { provider: MainAPI -> provider.sourcePlugin == plugin.`__filename` } extractorApis.removeIf { provider: ExtractorApi -> provider.sourcePlugin == plugin.`__filename` } + classLoaders.values.removeIf { v -> v == plugin} + plugins.remove(absolutePath) }