Resolved #6106 - correctly recognize mod changes of content, not just metadata

This commit is contained in:
Yair Morgenstern 2022-02-10 16:57:00 +02:00
parent 680bd1a113
commit a5ad6c5e81
3 changed files with 5 additions and 6 deletions

View File

@ -184,7 +184,7 @@ class ModUIData(
state.hasUpdate = isUpdated
}
fun lastUpdated() = ruleset?.modOptions?.lastUpdated ?: repo?.updated_at ?: ""
fun lastUpdated() = ruleset?.modOptions?.lastUpdated ?: repo?.pushed_at ?: ""
fun stargazers() = repo?.stargazers_count ?: 0
fun author() = ruleset?.modOptions?.author ?: repo?.owner?.login ?: ""
fun matchesFilter(filterText: String): Boolean = when {

View File

@ -224,7 +224,7 @@ class ModManagementScreen(
val installedMod = RulesetCache.values.firstOrNull { it.name == repo.name }
val isUpdatedVersionOfInstalledMod = installedMod?.modOptions?.let {
it.lastUpdated != "" && it.lastUpdated != repo.updated_at
it.lastUpdated != "" && it.lastUpdated != repo.pushed_at
} == true
if (installedMod != null) {
@ -305,7 +305,7 @@ class ModManagementScreen(
* @param repo: the repository instance as received from the GitHub api
*/
private fun addModInfoToActionTable(repo: Github.Repo) {
addModInfoToActionTable(repo.name, repo.html_url, repo.updated_at, repo.owner.login, repo.size)
addModInfoToActionTable(repo.name, repo.html_url, repo.pushed_at, repo.owner.login, repo.size)
}
/** Recreate the information part of the right-hand column
* @param modName: The mod name (name from the RuleSet)
@ -419,7 +419,7 @@ class ModManagementScreen(
val modOptionsFile = modFolder.child("jsons/ModOptions.json")
val modOptions = if (modOptionsFile.exists()) JsonParser().getFromJson(ModOptions::class.java, modOptionsFile) else ModOptions()
modOptions.modUrl = repo.html_url
modOptions.lastUpdated = repo.updated_at
modOptions.lastUpdated = repo.pushed_at
modOptions.author = repo.owner.login
modOptions.modSize = repo.size
Json().toJson(modOptions, modOptionsFile)

View File

@ -259,8 +259,7 @@ object Github {
var stargazers_count = 0
var default_branch = ""
var html_url = ""
var updated_at = ""
//var pushed_at = "" // if > updated_at might indicate an update soon?
var pushed_at = "" // don't use updated_at - see https://github.com/yairm210/Unciv/issues/6106
var size = 0
//var stargazers_url = ""
//var homepage: String? = null // might use instead of go to repo?