mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
Pick the newest Windows upload across types for replaced builds and let an update past its commit point finish
This commit is contained in:
5 files changed
+24
-4
No files matched your search
@@ -216,7 +216,6 @@ internal class ItchInstaller(
|
||||
throw t
|
||||
}
|
||||
ItchStaging.merge(work, folder)
|
||||
if (cancelled.get()) return null
|
||||
ItchStaging.delete(work)
|
||||
}
|
||||
return exe
|
||||
|
||||
@@ -38,7 +38,7 @@ internal object ItchUpdates {
|
||||
val stamp = ItchUploads.updatedAt(current)
|
||||
return if (stamp > version) ItchUpdate(uploadId, stamp, ItchUploads.filename(current), false) else null
|
||||
}
|
||||
val next = ItchUploads.windows(uploads)?.takeIf { ItchUploads.windows(it) } ?: return null
|
||||
val next = ItchUploads.newestWindows(uploads) ?: return null
|
||||
val stamp = ItchUploads.updatedAt(next)
|
||||
if (uploadId.isBlank() && stamp <= version) return null
|
||||
return ItchUpdate(next.optString("id"), stamp, ItchUploads.filename(next), uploadId.isNotBlank())
|
||||
|
||||
@@ -18,6 +18,14 @@ internal object ItchUploads {
|
||||
return candidates.maxWithOrNull(compareBy({ it.optString("updated_at", it.optString("updatedAt")) }, { it.optLong("id") }))
|
||||
}
|
||||
|
||||
fun newestWindows(uploads: JSONArray?): JSONObject? {
|
||||
if (uploads == null) return null
|
||||
val windows = (0 until uploads.length()).mapNotNull { uploads.optJSONObject(it) }
|
||||
.filter { it.optString("storage") != "external" && !it.optBoolean("demo") && windows(it) }
|
||||
val games = windows.filter { it.optString("type") in GAME_TYPES }
|
||||
return games.ifEmpty { windows }.maxWithOrNull(compareBy({ updatedAt(it) }, { it.optLong("id") }))
|
||||
}
|
||||
|
||||
fun windows(upload: JSONObject): Boolean {
|
||||
val platforms = upload.optJSONObject("platforms")
|
||||
if (platforms != null) {
|
||||
|
||||
Reference in new issue
Block a user