diff --git a/core/src/com/unciv/ui/screens/modmanager/ModManagementScreen.kt b/core/src/com/unciv/ui/screens/modmanager/ModManagementScreen.kt index c8706147b2..b32b86f949 100644 --- a/core/src/com/unciv/ui/screens/modmanager/ModManagementScreen.kt +++ b/core/src/com/unciv/ui/screens/modmanager/ModManagementScreen.kt @@ -498,8 +498,10 @@ class ModManagementScreen( actualDownloadButton.disable() val repo = Github.Repo().parseUrl(textField.text) if (repo == null) { - ToastPopup("Invalid link!", this@ModManagementScreen) - popup.close() // Re-enabling button would be nice, but Toast doesn't work over other Popups + ToastPopup("«RED»{Invalid link!}«»", this@ModManagementScreen) + .apply { isVisible = true } + actualDownloadButton.setText("Download".tr()) + actualDownloadButton.enable() } else downloadMod(repo) { popup.close() } } @@ -568,19 +570,21 @@ class ModManagementScreen( repo, Gdx.files.local("mods") ) - ?: throw Exception("downloadAndExtract returns null for 404 errors and the like") // downloadAndExtract returns null for 404 errors and the like -> display something! + ?: throw Exception("Exception during GitHub download") // downloadAndExtract returns null for 404 errors and the like -> display something! Github.rewriteModOptions(repo, modFolder) launchOnGLThread { - ToastPopup("[${repo.name}] Downloaded!", this@ModManagementScreen) + val repoName = modFolder.name() // repo.name still has the replaced "-"'s + ToastPopup("[$repoName] Downloaded!", this@ModManagementScreen) RulesetCache.loadRulesets() TileSetCache.loadTileSetConfigs(false) UncivGame.Current.translations.tryReadTranslationForCurrentLanguage() - RulesetCache[repo.name]?.let { - installedModInfo[repo.name] = ModUIData(it) + RulesetCache[repoName]?.let { + installedModInfo[repoName] = ModUIData(it) } refreshInstalledModTable() - showModDescription(repo.name) - unMarkUpdatedMod(repo.name) + lastSelectedButton?.let { syncOnlineSelected(repoName, it) } + showModDescription(repoName) + unMarkUpdatedMod(repoName) postAction() } } catch (ex: Exception) { diff --git a/core/src/com/unciv/ui/screens/pickerscreens/GitHub.kt b/core/src/com/unciv/ui/screens/pickerscreens/GitHub.kt index f5242fabaf..389c4681b4 100644 --- a/core/src/com/unciv/ui/screens/pickerscreens/GitHub.kt +++ b/core/src/com/unciv/ui/screens/pickerscreens/GitHub.kt @@ -462,8 +462,8 @@ object Github { * * Replaces '-' with blanks but ensures no leading or trailing blanks. * As mad modders know no limits, trailing "-" did indeed happen, causing things to break due to trailing blanks on a folder name. - * As "test-" and "test" are different allowed repository names, trimmed blanks are replaced with one overscore per side. - * @param onlyOuterBlanks If `true` ignores inner dashes - only start and end are treated. Useful when modders have manually creted local folder names using dashes. + * As "test-" and "test" are different allowed repository names, trimmed blanks are replaced with one equals sign per side. + * @param onlyOuterBlanks If `true` ignores inner dashes - only start and end are treated. Useful when modders have manually created local folder names using dashes. */ fun String.repoNameToFolderName(onlyOuterBlanks: Boolean = false): String { var result = if (onlyOuterBlanks) this else replace('-', ' ')