diff options
author | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2023-05-26 13:50:22 -0700 |
---|---|---|
committer | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2023-05-26 13:50:22 -0700 |
commit | c15603406907383c58786cb1dc235ac79c7f9626 (patch) | |
tree | fcdfa364e9a1fbfc3f0bafbc78dfcc3316771337 /launcher/modplatform/modrinth/ModrinthPackIndex.cpp | |
parent | f24211e8b5d9af24ac3e27b0fdb50000a962c35f (diff) | |
download | PrismLauncher-c15603406907383c58786cb1dc235ac79c7f9626.tar.gz PrismLauncher-c15603406907383c58786cb1dc235ac79c7f9626.tar.bz2 PrismLauncher-c15603406907383c58786cb1dc235ac79c7f9626.zip |
feat: add verion_type / release_type to IndexedVersion
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'launcher/modplatform/modrinth/ModrinthPackIndex.cpp')
-rw-r--r-- | launcher/modplatform/modrinth/ModrinthPackIndex.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp index 7ade131e..c87fa302 100644 --- a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp +++ b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp @@ -109,8 +109,11 @@ void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, unsortedVersions.append(file); } auto orderSortPredicate = [](const ModPlatform::IndexedVersion& a, const ModPlatform::IndexedVersion& b) -> bool { + bool a_better_release = true; + if (a.verison_type.has_value() && b.verison_type.has_value()) + a_better_release = a.verison_type.value() < b.verison_type.value(); // dates are in RFC 3339 format - return a.date > b.date; + return a.date > b.date && a_better_release; }; std::sort(unsortedVersions.begin(), unsortedVersions.end(), orderSortPredicate); pack.versions = unsortedVersions; @@ -138,6 +141,10 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, QString preferred_hash_t } file.version = Json::requireString(obj, "name"); file.version_number = Json::requireString(obj, "version_number"); + auto verison_type = ModPlatform::IndexedVersionType(Json::requireString(obj, "version_type")); + if (verison_type.isValid()) + file.verison_type = verison_type; + file.changelog = Json::requireString(obj, "changelog"); auto files = Json::requireArray(obj, "files"); |