Apply PR code change for readability.

This commit is contained in:
Jace 2022-11-03 08:28:52 +08:00
parent e029ceefc0
commit 53a6e4affb
2 changed files with 7 additions and 4 deletions

View file

@ -45,6 +45,7 @@ import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
import com.lagradost.cloudstream3.network.initClient import com.lagradost.cloudstream3.network.initClient
import com.lagradost.cloudstream3.plugins.PluginManager import com.lagradost.cloudstream3.plugins.PluginManager
import com.lagradost.cloudstream3.plugins.PluginManager.loadAllOnlinePlugins
import com.lagradost.cloudstream3.plugins.PluginManager.loadSinglePlugin import com.lagradost.cloudstream3.plugins.PluginManager.loadSinglePlugin
import com.lagradost.cloudstream3.receivers.VideoDownloadRestartReceiver import com.lagradost.cloudstream3.receivers.VideoDownloadRestartReceiver
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.OAuth2Apis import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.OAuth2Apis
@ -561,17 +562,16 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
} }
ioSafe { ioSafe {
// Load all plugins as fast as possible!
PluginManager.loadAllOnlinePlugins(this@MainActivity)
afterPluginsLoadedEvent.invoke(true)
if (settingsManager.getBoolean( if (settingsManager.getBoolean(
getString(R.string.auto_update_plugins_key), getString(R.string.auto_update_plugins_key),
true true
) )
) { ) {
PluginManager.updateAllOnlinePluginsAndLoadThem(this@MainActivity) PluginManager.updateAllOnlinePluginsAndLoadThem(this@MainActivity)
} else {
loadAllOnlinePlugins(this@MainActivity)
} }
//Automatically download not existing plugins //Automatically download not existing plugins
if (settingsManager.getBoolean( if (settingsManager.getBoolean(
getString(R.string.auto_download_plugins_key), getString(R.string.auto_download_plugins_key),

View file

@ -220,6 +220,9 @@ object PluginManager {
* 4. Else load the plugin normally * 4. Else load the plugin normally
**/ **/
fun updateAllOnlinePluginsAndLoadThem(activity: Activity) { fun updateAllOnlinePluginsAndLoadThem(activity: Activity) {
// Load all plugins as fast as possible!
loadAllOnlinePlugins(activity)
afterPluginsLoadedEvent.invoke(true)
val urls = (getKey<Array<RepositoryData>>(REPOSITORIES_KEY) val urls = (getKey<Array<RepositoryData>>(REPOSITORIES_KEY)
?: emptyArray()) + PREBUILT_REPOSITORIES ?: emptyArray()) + PREBUILT_REPOSITORIES