From 18f1fba047a102ed0b759783269f72cce00d7d2c Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Sun, 14 Aug 2022 18:13:44 +0200 Subject: [PATCH] Fix merge conflict --- .../lagradost/cloudstream3/MainActivity.kt | 63 ++++++++++--------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt index 9d8b43b1..5a915183 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt @@ -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>(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>(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)