mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-05 15:59:50 +07:00
Update mods even if we have cached data
This commit is contained in:
@ -163,16 +163,14 @@ class ModManagementScreen private constructor(
|
||||
if (isPortrait) initPortrait()
|
||||
else initLandscape()
|
||||
showLoadingImage()
|
||||
|
||||
|
||||
if (installedModInfo.isEmpty())
|
||||
refreshInstalledModInfo()
|
||||
|
||||
refreshInstalledModTable()
|
||||
|
||||
if (onlineModInfo.isEmpty())
|
||||
reloadOnlineMods()
|
||||
else
|
||||
refreshOnlineModTable()
|
||||
|
||||
refreshOnlineModTable() // Refresh table - chances are we have cached data...
|
||||
reloadOnlineMods() //... and still try to get fresh data from online
|
||||
}
|
||||
|
||||
private fun initPortrait() {
|
||||
@ -272,12 +270,7 @@ class ModManagementScreen private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun reloadOnlineMods() {
|
||||
onlineModsTable.clear()
|
||||
onlineModInfo.clear()
|
||||
onlineModsTable.add(getDownloadFromUrlButton()).padBottom(15f).row()
|
||||
tryDownloadPage(1)
|
||||
}
|
||||
private fun reloadOnlineMods() = tryDownloadPage(1)
|
||||
|
||||
/** background worker: querying GitHub for Mods (repos with 'unciv-mod' in its topics)
|
||||
*
|
||||
@ -312,9 +305,6 @@ class ModManagementScreen private constructor(
|
||||
if (stopBackgroundTasks) return
|
||||
repo.name = repo.name.repoNameToFolderName()
|
||||
|
||||
if (onlineModInfo.containsKey(repo.name))
|
||||
continue // we already got this mod in a previous download, since one has been added in between
|
||||
|
||||
val installedMod = RulesetCache.values.firstOrNull { it.name == repo.name }
|
||||
val isUpdatedVersionOfInstalledMod = installedMod?.modOptions?.let {
|
||||
it.lastUpdated != "" && it.lastUpdated != repo.pushed_at
|
||||
@ -346,6 +336,7 @@ class ModManagementScreen private constructor(
|
||||
|
||||
val mod = ModUIData(repo, isUpdatedVersionOfInstalledMod)
|
||||
onlineModInfo[repo.name] = mod
|
||||
modButtons.remove(mod) // Remove *cached* mod button since we have NEW DATA
|
||||
onlineModsTable.add(getCachedModButton(mod)).row()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user