aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/flame/FlameModIndex.cpp
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2023-05-26 13:50:22 -0700
committerRachel Powers <508861+Ryex@users.noreply.github.com>2023-05-26 13:50:22 -0700
commitc15603406907383c58786cb1dc235ac79c7f9626 (patch)
treefcdfa364e9a1fbfc3f0bafbc78dfcc3316771337 /launcher/modplatform/flame/FlameModIndex.cpp
parentf24211e8b5d9af24ac3e27b0fdb50000a962c35f (diff)
downloadPrismLauncher-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/flame/FlameModIndex.cpp')
-rw-r--r--launcher/modplatform/flame/FlameModIndex.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/launcher/modplatform/flame/FlameModIndex.cpp b/launcher/modplatform/flame/FlameModIndex.cpp
index 7498e830..5866cfbd 100644
--- a/launcher/modplatform/flame/FlameModIndex.cpp
+++ b/launcher/modplatform/flame/FlameModIndex.cpp
@@ -94,8 +94,11 @@ void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
}
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;
@@ -123,6 +126,9 @@ auto FlameMod::loadIndexedPackVersion(QJsonObject& obj, bool load_changelog) ->
file.version = Json::requireString(obj, "displayName");
file.downloadUrl = Json::ensureString(obj, "downloadUrl");
file.fileName = Json::requireString(obj, "fileName");
+ auto version_type = ModPlatform::IndexedVersionType(Json::requireInteger(obj, "releaseType"));
+ if (version_type.isValid())
+ file.verison_type = version_type;
auto hash_list = Json::ensureArray(obj, "hashes");
for (auto h : hash_list) {