mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Now possible to add repositories without names
This commit is contained in:
parent
72dc24c455
commit
a1dd6cc106
1 changed files with 5 additions and 2 deletions
|
@ -98,13 +98,16 @@ class ExtensionsFragment : Fragment() {
|
||||||
dialog.apply_btt?.setOnClickListener secondListener@{
|
dialog.apply_btt?.setOnClickListener secondListener@{
|
||||||
val name = dialog.repo_name_input?.text?.toString()
|
val name = dialog.repo_name_input?.text?.toString()
|
||||||
val url = dialog.repo_url_input?.text?.toString()
|
val url = dialog.repo_url_input?.text?.toString()
|
||||||
if (url.isNullOrBlank() || name.isNullOrBlank()) {
|
if (url.isNullOrBlank()) {
|
||||||
showToast(activity, R.string.error_invalid_data, Toast.LENGTH_SHORT)
|
showToast(activity, R.string.error_invalid_data, Toast.LENGTH_SHORT)
|
||||||
return@secondListener
|
return@secondListener
|
||||||
}
|
}
|
||||||
|
|
||||||
ioSafe {
|
ioSafe {
|
||||||
val newRepo = RepositoryData(name, url)
|
val fixedName = if (!name.isNullOrBlank()) name
|
||||||
|
else RepositoryManager.parseRepository(url)?.name ?: "No name"
|
||||||
|
|
||||||
|
val newRepo = RepositoryData(fixedName, url)
|
||||||
RepositoryManager.addRepository(newRepo)
|
RepositoryManager.addRepository(newRepo)
|
||||||
extensionViewModel.loadRepositories()
|
extensionViewModel.loadRepositories()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue