fix(epic): say which launcher installs a third-party-managed game (#2344)

* fix(epic): handle third-party managed titles

* Clear a cached third-party launcher when catalog details report none
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-15 09:36:33 -05:00
1 parent 448d296a2b
commit fbb705cf6f
39 files changed
+113 -3

No files matched your search

@@ -30,6 +30,29 @@ class EpicLibraryTest {
assertEquals(listOf(game), EpicLibrary.fromCacheJson(text))
}
@Test fun thirdPartyLauncherIsCarriedToCatalogItems() {
val game = EpicLibrary.gameFrom(
JSONObject().put("appName", "Fig").put("namespace", "ns").put("catalogItemId", "cat"),
JSONObject().put("thirdPartyManagedApp", "EA app"),
null,
)
assertEquals("EA app", game.thirdPartyManagedApp)
assertEquals("EA app", EpicLibrary.toCatalogItem(app, game).extra["thirdPartyManagedApp"])
}
@Test fun catalogDetailsClearTheCachedThirdPartyLauncher() {
val record = JSONObject().put("appName", "Fig").put("namespace", "ns").put("catalogItemId", "cat")
val before = EpicGame("Fig", "ns", "cat", "Fig", thirdPartyManagedApp = "EA app")
val fresh = EpicLibrary.gameFrom(record, JSONObject().put("thirdPartyManagedApp", ""), before)
assertEquals("", fresh.thirdPartyManagedApp)
assertEquals("", EpicLibrary.toCatalogItem(app, fresh).extra["thirdPartyManagedApp"])
assertEquals(listOf(fresh), EpicLibrary.fromCacheJson(EpicLibrary.toCacheJson(listOf(fresh))))
assertEquals("", EpicLibrary.gameFrom(record, JSONObject(), before).thirdPartyManagedApp)
assertEquals("Ubisoft Connect", EpicLibrary.gameFrom(record,
JSONObject().put("thirdPartyManagedApp", "Ubisoft Connect"), before).thirdPartyManagedApp)
assertEquals("EA app", EpicLibrary.gameFrom(record, null, before).thirdPartyManagedApp)
}
@Test fun readingSkipsDedupsSortsAndCapsSizes() {
val text = JSONArray()
.put(JSONObject().put("appName", "b").put("title", "beta").put("installSize", (1L shl 41)))
@@ -55,7 +78,7 @@ class EpicLibraryTest {
assertEquals("Hi", item.description)
assertTrue(item.owned)
assertEquals("https://store.epicgames.com/en-US/browse?q=Fig+%26+Co", item.storeUrl)
assertEquals(mapOf("namespace" to "ns", "catalogItemId" to "cat", "version" to ""), item.extra)
assertEquals(mapOf("namespace" to "ns", "catalogItemId" to "cat", "version" to "", "thirdPartyManagedApp" to ""), item.extra)
val old = EpicLibrary.toCatalogItem(app, EpicGame("Old", "ns", "c", "Old", artSquare = "wide", installSize = 9L))
assertEquals("2001", old.releaseDate)
assertEquals(9L, old.sizeBytes)