Fix ANR caused by URL checking for Github URL with query

This commit is contained in:
yairm210 2024-12-17 13:11:30 +02:00
parent 992100412d
commit 5e6a3e0f67

View File

@ -414,15 +414,19 @@ class ModManagementScreen private constructor(
actualDownloadButton.onClick {
actualDownloadButton.setText("Downloading...".tr())
actualDownloadButton.disable()
val repo = GithubAPI.Repo.parseUrl(textField.text)
if (repo == null) {
ToastPopup("«RED»{Invalid link!}«»", this@ModManagementScreen)
actualDownloadButton.setText("Download".tr())
actualDownloadButton.enable()
} else
downloadMod(repo, {
actualDownloadButton.setText("{Downloading...} ${it}%".tr())
}) { popup.close() }
Concurrency.run {
val repo = GithubAPI.Repo.parseUrl(textField.text)
if (repo == null) {
Concurrency.runOnGLThread {
ToastPopup("«RED»{Invalid link!}«»", this@ModManagementScreen)
actualDownloadButton.setText("Download".tr())
actualDownloadButton.enable()
}
} else
downloadMod(repo, {
actualDownloadButton.setText("{Downloading...} ${it}%".tr())
}) { popup.close() }
}
}
popup.add(actualDownloadButton).row()
popup.addCloseButton()