cloudstream-extensions/NginxProvider/src/main/kotlin/com/lagradost/NginxProviderPlugin.kt

33 lines
1.1 KiB
Kotlin
Raw Normal View History

package com.lagradost
2022-08-09 17:42:39 +00:00
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
import com.lagradost.cloudstream3.plugins.Plugin
import android.content.Context
2022-08-17 20:20:31 +00:00
import androidx.appcompat.app.AppCompatActivity
import com.lagradost.cloudstream3.AcraApplication.Companion.context
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
import com.lagradost.cloudstream3.AcraApplication.Companion.getActivity
import com.lagradost.cloudstream3.ui.settings.SettingsAccount
2022-08-09 17:42:39 +00:00
@CloudstreamPlugin
2022-08-17 20:20:31 +00:00
class NginxProviderPlugin : Plugin() {
val nginxApi = NginxApi(0)
2022-08-09 17:42:39 +00:00
override fun load(context: Context) {
// All providers should be added in this manner. Please don't edit the providers list directly.
registerMainAPI(NginxProvider())
2022-08-17 20:20:31 +00:00
ioSafe {
nginxApi.initialize()
}
}
init {
this.openSettings = {
val activity = context as? AppCompatActivity
if (activity != null) {
val frag = NginxSettingsFragment(this, nginxApi)
frag.show(activity.supportFragmentManager, nginxApi.name)
}
}
2022-08-09 17:42:39 +00:00
}
}