Prevent re-loading plugins if they're already loaded previously upon checking for plugin updates.

This commit is contained in:
Jace 2022-11-01 10:15:47 +08:00
parent 006d8e37de
commit 7341f23c0f
2 changed files with 7 additions and 6 deletions

View file

@ -576,7 +576,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
false false
) )
) { ) {
PluginManager.downloadNotExistingPluginsAndLoad(this@MainActivity) PluginManager.downloadNotExistingPluginsAndLoad(this@MainActivity, isLoaded)
isLoaded = true isLoaded = true
} }

View file

@ -284,11 +284,12 @@ object PluginManager {
* 2. Fetch all not downloaded plugins * 2. Fetch all not downloaded plugins
* 3. Download them and reload plugins * 3. Download them and reload plugins
**/ **/
fun downloadNotExistingPluginsAndLoad(activity: Activity) { fun downloadNotExistingPluginsAndLoad(activity: Activity, isLoaded: Boolean) {
// Load all plugins as fast as possible! // Load all plugins as fast as possible, if its not loaded yet.
loadAllOnlinePlugins(activity) if (!isLoaded) {
loadAllOnlinePlugins(activity)
afterPluginsLoadedEvent.invoke(true) afterPluginsLoadedEvent.invoke(true)
}
val newDownloadPlugins = mutableListOf<String>() val newDownloadPlugins = mutableListOf<String>()
val urls = (getKey<Array<RepositoryData>>(REPOSITORIES_KEY) val urls = (getKey<Array<RepositoryData>>(REPOSITORIES_KEY)