forked from recloudstream/cloudstream
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@{
|
||||
val name = dialog.repo_name_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)
|
||||
return@secondListener
|
||||
}
|
||||
|
||||
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)
|
||||
extensionViewModel.loadRepositories()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue