mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
invoke on auto repo add
This commit is contained in:
parent
40141f2d27
commit
d0424a271f
2 changed files with 29 additions and 21 deletions
|
@ -373,7 +373,7 @@ object PluginManager {
|
|||
)
|
||||
}
|
||||
|
||||
private suspend fun downloadAllPluginsFromRepository(
|
||||
suspend fun downloadAllPluginsFromRepository(
|
||||
activity: Activity,
|
||||
repositoryUrl: String
|
||||
) {
|
||||
|
@ -387,26 +387,6 @@ object PluginManager {
|
|||
}
|
||||
}
|
||||
|
||||
fun Activity.downloadAllPluginsDialog(repositoryUrl: String) {
|
||||
runOnUiThread {
|
||||
val context = this
|
||||
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
|
||||
builder.setTitle(
|
||||
"Download all plugins from this repo?"
|
||||
)
|
||||
builder.apply {
|
||||
// TODO: R.string Yes No
|
||||
setPositiveButton("Yes") { _, _ ->
|
||||
showToast(context, R.string.download_started, Toast.LENGTH_LONG)
|
||||
ioSafe { downloadAllPluginsFromRepository(context, repositoryUrl) }
|
||||
}
|
||||
|
||||
setNegativeButton("No") { _, _ -> }
|
||||
}
|
||||
builder.show()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isFilePath will treat the pluginUrl as as the filepath instead of url
|
||||
* */
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.widget.Toast
|
|||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.text.HtmlCompat
|
||||
|
@ -48,6 +49,7 @@ import com.lagradost.cloudstream3.CommonActivity.showToast
|
|||
import com.lagradost.cloudstream3.MainActivity.Companion.afterRepositoryLoadedEvent
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
|
||||
import com.lagradost.cloudstream3.plugins.PluginManager
|
||||
import com.lagradost.cloudstream3.plugins.RepositoryManager
|
||||
import com.lagradost.cloudstream3.ui.WebviewFragment
|
||||
import com.lagradost.cloudstream3.ui.result.ResultFragment
|
||||
|
@ -257,6 +259,32 @@ object AppUtils {
|
|||
)
|
||||
}
|
||||
afterRepositoryLoadedEvent.invoke(true)
|
||||
downloadAllPluginsDialog(url)
|
||||
}
|
||||
}
|
||||
|
||||
fun Activity.downloadAllPluginsDialog(repositoryUrl: String) {
|
||||
runOnUiThread {
|
||||
val context = this
|
||||
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
|
||||
builder.setTitle(
|
||||
"Download all plugins from this repo?"
|
||||
)
|
||||
builder.apply {
|
||||
// TODO: R.string Yes No
|
||||
setPositiveButton("Yes") { _, _ ->
|
||||
showToast(context, R.string.download_started, Toast.LENGTH_LONG)
|
||||
ioSafe {
|
||||
PluginManager.downloadAllPluginsFromRepository(
|
||||
context,
|
||||
repositoryUrl
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
setNegativeButton("No") { _, _ -> }
|
||||
}
|
||||
builder.show()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue