mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Apply PR changes
This commit is contained in:
parent
9976cc1323
commit
e029ceefc0
2 changed files with 9 additions and 22 deletions
|
@ -561,14 +561,16 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
}
|
||||
|
||||
ioSafe {
|
||||
var isLoaded = false
|
||||
// Load all plugins as fast as possible!
|
||||
PluginManager.loadAllOnlinePlugins(this@MainActivity)
|
||||
afterPluginsLoadedEvent.invoke(true)
|
||||
|
||||
if (settingsManager.getBoolean(
|
||||
getString(R.string.auto_update_plugins_key),
|
||||
true
|
||||
)
|
||||
) {
|
||||
PluginManager.updateAllOnlinePluginsAndLoadThem(this@MainActivity)
|
||||
isLoaded = true
|
||||
}
|
||||
//Automatically download not existing plugins
|
||||
if (settingsManager.getBoolean(
|
||||
|
@ -576,12 +578,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
false
|
||||
)
|
||||
) {
|
||||
PluginManager.downloadNotExistingPluginsAndLoad(this@MainActivity, isLoaded)
|
||||
isLoaded = true
|
||||
}
|
||||
|
||||
if (!isLoaded) {
|
||||
PluginManager.loadAllOnlinePlugins(this@MainActivity)
|
||||
PluginManager.downloadNotExistingPluginsAndLoad(this@MainActivity)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.os.Build
|
|||
import android.os.Environment
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
|
@ -219,11 +220,6 @@ object PluginManager {
|
|||
* 4. Else load the plugin normally
|
||||
**/
|
||||
fun updateAllOnlinePluginsAndLoadThem(activity: Activity) {
|
||||
// Load all plugins as fast as possible!
|
||||
loadAllOnlinePlugins(activity)
|
||||
|
||||
afterPluginsLoadedEvent.invoke(true)
|
||||
|
||||
|
||||
val urls = (getKey<Array<RepositoryData>>(REPOSITORIES_KEY)
|
||||
?: emptyArray()) + PREBUILT_REPOSITORIES
|
||||
|
@ -283,13 +279,7 @@ object PluginManager {
|
|||
* 2. Fetch all not downloaded plugins
|
||||
* 3. Download them and reload plugins
|
||||
**/
|
||||
fun downloadNotExistingPluginsAndLoad(activity: Activity, isLoaded: Boolean) {
|
||||
// Load all plugins as fast as possible, if its not loaded yet.
|
||||
if (!isLoaded) {
|
||||
loadAllOnlinePlugins(activity)
|
||||
afterPluginsLoadedEvent.invoke(true)
|
||||
}
|
||||
|
||||
fun downloadNotExistingPluginsAndLoad(activity: Activity) {
|
||||
val newDownloadPlugins = mutableListOf<String>()
|
||||
val urls = (getKey<Array<RepositoryData>>(REPOSITORIES_KEY)
|
||||
?: emptyArray()) + PREBUILT_REPOSITORIES
|
||||
|
@ -324,7 +314,7 @@ object PluginManager {
|
|||
//Omit NSFW, if disabled
|
||||
sitePlugin.tvTypes?.let { tvtypes ->
|
||||
if (!settingsForProvider.enableAdult) {
|
||||
if (tvtypes.contains("NSFW")) {
|
||||
if (tvtypes.contains(TvType.NSFW.name)) {
|
||||
return@outer null
|
||||
}
|
||||
}
|
||||
|
@ -616,7 +606,7 @@ object PluginManager {
|
|||
private fun createNotification(
|
||||
context: Context,
|
||||
extensionNames: List<String>,
|
||||
title: Int
|
||||
@StringRes title: Int
|
||||
): Notification? {
|
||||
try {
|
||||
if (extensionNames.isEmpty()) return null
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue