Make pasting repo url better

This commit is contained in:
Blatzar 2022-08-11 19:41:54 +02:00
parent 132dda6f4c
commit 9509692b39
1 changed files with 9 additions and 1 deletions

View File

@ -92,7 +92,15 @@ class ExtensionsFragment : Fragment() {
(activity?.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager?)?.primaryClip?.getItemAt(
0
)?.text?.toString()?.let { copy ->
dialog.repo_url_input?.setText(copy)
// Fix our own repo links and only paste the text if it's a link.
if (copy.startsWith("http")) {
val fixedUrl = if (copy.startsWith("https://cs.repo")) {
"https://" + copy.substringAfter("?")
} else {
copy
}
dialog.repo_url_input?.setText(fixedUrl)
}
}
// dialog.text2?.text = provider.name