mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Merge branch 'master' of https://github.com/recloudstream/cloudstream
This commit is contained in:
commit
64fd8fdf45
3 changed files with 37 additions and 32 deletions
|
@ -447,13 +447,15 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
|
||||
changeStatusBarState(isEmulatorSettings())
|
||||
|
||||
if (settingsManager.getBoolean(getString(R.string.auto_update_plugins_key), true)) {
|
||||
PluginManager.updateAllOnlinePluginsAndLoadThem(this)
|
||||
} else {
|
||||
PluginManager.loadAllOnlinePlugins(this)
|
||||
}
|
||||
ioSafe {
|
||||
if (settingsManager.getBoolean(getString(R.string.auto_update_plugins_key), true)) {
|
||||
PluginManager.updateAllOnlinePluginsAndLoadThem(this@MainActivity)
|
||||
} else {
|
||||
PluginManager.loadAllOnlinePlugins(this@MainActivity)
|
||||
}
|
||||
|
||||
PluginManager.loadAllLocalPlugins(this)
|
||||
PluginManager.loadAllLocalPlugins(this@MainActivity)
|
||||
}
|
||||
|
||||
// ioSafe {
|
||||
// val plugins =
|
||||
|
@ -466,8 +468,10 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
// }
|
||||
|
||||
// init accounts
|
||||
for (api in accountManagers) {
|
||||
api.init()
|
||||
ioSafe {
|
||||
for (api in accountManagers) {
|
||||
api.init()
|
||||
}
|
||||
}
|
||||
|
||||
ioSafe {
|
||||
|
@ -482,28 +486,29 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
|
||||
SearchResultBuilder.updateCache(this)
|
||||
|
||||
|
||||
initAll()
|
||||
apis = allProviders
|
||||
|
||||
try {
|
||||
getKey<Array<SettingsGeneral.CustomSite>>(USER_PROVIDER_API)?.let { list ->
|
||||
list.forEach { custom ->
|
||||
allProviders.firstOrNull { it.javaClass.simpleName == custom.parentJavaClass }
|
||||
?.let {
|
||||
allProviders.add(it.javaClass.newInstance().apply {
|
||||
name = custom.name
|
||||
lang = custom.lang
|
||||
mainUrl = custom.url.trimEnd('/')
|
||||
canBeOverridden = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
ioSafe {
|
||||
initAll()
|
||||
apis = allProviders
|
||||
APIHolder.apiMap = null
|
||||
} catch (e: Exception) {
|
||||
logError(e)
|
||||
|
||||
try {
|
||||
getKey<Array<SettingsGeneral.CustomSite>>(USER_PROVIDER_API)?.let { list ->
|
||||
list.forEach { custom ->
|
||||
allProviders.firstOrNull { it.javaClass.simpleName == custom.parentJavaClass }
|
||||
?.let {
|
||||
allProviders.add(it.javaClass.newInstance().apply {
|
||||
name = custom.name
|
||||
lang = custom.lang
|
||||
mainUrl = custom.url.trimEnd('/')
|
||||
canBeOverridden = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
apis = allProviders
|
||||
APIHolder.apiMap = null
|
||||
} catch (e: Exception) {
|
||||
logError(e)
|
||||
}
|
||||
}
|
||||
|
||||
// val navView: BottomNavigationView = findViewById(R.id.nav_view)
|
||||
|
|
|
@ -234,7 +234,7 @@ object PluginManager {
|
|||
val sortedPlugins = dir.listFiles()
|
||||
// Always sort plugins alphabetically for reproducible results
|
||||
|
||||
Log.d(TAG, "Files in '${LOCAL_PLUGINS_PATH}' folder: ${sortedPlugins}")
|
||||
Log.d(TAG, "Files in '${LOCAL_PLUGINS_PATH}' folder: $sortedPlugins")
|
||||
|
||||
sortedPlugins?.sortedBy { it.name }?.apmap { file ->
|
||||
maybeLoadPlugin(activity, file)
|
||||
|
@ -375,7 +375,7 @@ object PluginManager {
|
|||
* */
|
||||
suspend fun deletePlugin(pluginIdentifier: String, isFilePath: Boolean): Boolean {
|
||||
val data =
|
||||
(if (isFilePath) getPluginsLocal().firstOrNull { it.filePath == pluginIdentifier }
|
||||
(if (isFilePath) (getPluginsLocal() + getPluginsOnline()).firstOrNull { it.filePath == pluginIdentifier }
|
||||
else getPluginsOnline().firstOrNull { it.url == pluginIdentifier }) ?: return false
|
||||
|
||||
return try {
|
||||
|
|
|
@ -128,7 +128,7 @@ class PluginsViewModel : ViewModel() {
|
|||
plugin: Plugin,
|
||||
isLocal: Boolean
|
||||
) = ioSafe {
|
||||
Log.i(TAG, "handlePluginAction = $repositoryUrl, $plugin")
|
||||
Log.i(TAG, "handlePluginAction = $repositoryUrl, $plugin, $isLocal")
|
||||
|
||||
if (activity == null) return@ioSafe
|
||||
val (repo, metadata) = plugin
|
||||
|
|
Loading…
Reference in a new issue