mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
fix(stores): EA and Ubisoft libraries list only games the account can download (#2521)
* fix(stores): EA and Ubisoft libraries list only games the account can download * fix(stores): keep owned games through entitlement and manifest lookup failures
This commit is contained in:
1 parent
a8237e8927
commit
c8dec0a8bc
4 files changed
+106
-64
No files matched your search
@@ -225,6 +225,20 @@ class EaTest {
|
||||
assertEquals(listOf("1", "3"), picked.map { it.first.offerId })
|
||||
}
|
||||
|
||||
@Test fun anOwnedProductWithoutAnActiveGameDownloadIsLeftOut() {
|
||||
fun row(id: String, type: String, tag: String = type, status: String = "ACTIVE") =
|
||||
JSONObject().put("productId", id).put("entitlementType", type).put("entitlementTag", tag).put("status", status)
|
||||
val rows = listOf(
|
||||
row("DR:106479900", "DEFAULT", "VALIDATED_ONLINE_ACCESS"),
|
||||
row("DR:231813200", "ORIGIN_DOWNLOAD", status = "DISABLED"),
|
||||
row("Origin.OFR.50.0003426", "ONLINE_ACCESS"),
|
||||
row("Origin.OFR.50.0003426", "ORIGIN_DOWNLOAD"),
|
||||
row("Origin.OFR.50.0005237", "ORIGIN_DOWNLOAD"),
|
||||
)
|
||||
assertEquals(setOf("DR:106479900", "DR:231813200"), EaLibrary.withoutGameDownload(rows).keys)
|
||||
assertTrue(EaLibrary.withoutGameDownload(emptyList()).isEmpty())
|
||||
}
|
||||
|
||||
@Test fun ownedPageParses() {
|
||||
val page = JSONObject(
|
||||
"""{"me":{"ownedGameProducts":{"next":"100","items":[{"originOfferId":"Origin.OFR.50.0001","product":{"id":"x","name":"N","downloadable":true,"gameSlug":"titanfall-2",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.droiddeck.launcher.stores.ubisoft
|
||||
|
||||
import com.droiddeck.launcher.stores.CatalogItem
|
||||
import com.droiddeck.launcher.stores.Store
|
||||
import com.droiddeck.launcher.stores.StoreGameSidecar
|
||||
import com.droiddeck.launcher.stores.StoreLaunch
|
||||
@@ -20,18 +21,28 @@ class UbisoftTest {
|
||||
private val steamConfig = "version: 2.0\r\nroot:\r\n name: Assassin's Creed Syndicate\r\n start_game:\r\n steam:\r\n steam_app_id: 368500\r\n" +
|
||||
" third_party_platform:\r\n name: Steam\r\n override_uplayid: 1875\r\n"
|
||||
|
||||
@Test fun aProductUbisoftDeliversThroughSteamNamesItsSteamApp() {
|
||||
assertEquals("368500", UbisoftLibrary.steamApp(steamConfig))
|
||||
assertNull(UbisoftLibrary.steamApp("root:\n start_game:\n online:\n executables:\n - path:\n relative: bin/game.exe\n"))
|
||||
private fun listed(space: String, name: String) = CatalogItem(Store.UBISOFT, space, name, null, owned = true, extra = mapOf("spaceId" to space))
|
||||
|
||||
private val owned = JSONObject().put("games", JSONArray()
|
||||
.put(JSONObject().put("productId", 1957).put("spaceId", "space-s").put("productType", 0).put("owned", true).put("configuration", steamConfig))
|
||||
.put(JSONObject().put("productId", 109).put("spaceId", "space-sc").put("productType", 0).put("owned", true).put("manifest", "AB").put("configuration", "root: {}"))
|
||||
.put(JSONObject().put("productId", 1961).put("spaceId", "space-addon").put("productType", 1).put("owned", true).put("manifest", "CD").put("configuration", steamConfig))
|
||||
.put(JSONObject().put("productId", 720).put("spaceId", "space-plus").put("productType", 0).put("owned", false).put("manifest", "EF").put("configuration", "root: {}"))
|
||||
.put(JSONObject().put("productId", 3539).put("spaceId", "space-o").put("productType", 0).put("owned", true).put("configuration", "root: {}")))
|
||||
|
||||
@Test fun onlyGamesConnectDeliversAreInTheLibrary() {
|
||||
val profile = listOf(listed("space-sc", "Splinter Cell"), listed("space-s", "Syndicate"), listed("space-plus", "Ubisoft+ Game"), listed("space-gone", "Free Weekend"), listed("space-o", "Origins"))
|
||||
val games = UbisoftLibrary.assemble(profile, owned)
|
||||
assertEquals(listOf("space-o", "space-sc"), games.map { it.id })
|
||||
assertEquals(listOf("3539", "109"), games.map { it.extra["productId"] })
|
||||
assertEquals(null, games.first().extra["manifest"])
|
||||
assertEquals("Steam", UbisoftLibrary.thirdParty(steamConfig))
|
||||
}
|
||||
|
||||
@Test fun steamOwnedGamesAreKeyedByTheirSpace() {
|
||||
val owned = JSONObject().put("games", JSONArray()
|
||||
.put(JSONObject().put("productId", 1957).put("spaceId", "space-s").put("productType", 0).put("owned", true).put("configuration", steamConfig))
|
||||
.put(JSONObject().put("productId", 109).put("spaceId", "space-sc").put("productType", 0).put("owned", true).put("manifest", "AB").put("configuration", "root: {}"))
|
||||
.put(JSONObject().put("productId", 1961).put("spaceId", "space-addon").put("productType", 1).put("owned", true).put("configuration", steamConfig)))
|
||||
assertEquals(mapOf("space-s" to "368500"), UbisoftLibrary.steamBySpace(owned))
|
||||
assertEquals(setOf("space-sc"), UbisoftLibrary.ownedBySpace(owned).keys)
|
||||
@Test fun withoutAnOwnershipAnswerTheProfileListStays() {
|
||||
val profile = listOf(listed("space-sc", "Splinter Cell"), listed("space-gone", "Free Weekend"))
|
||||
assertEquals(listOf("space-gone", "space-sc"), UbisoftLibrary.assemble(profile, JSONObject().put("error", "demux closed")).map { it.id })
|
||||
assertEquals(listOf("space-gone", "space-sc"), UbisoftLibrary.assemble(profile, null).map { it.id })
|
||||
}
|
||||
|
||||
@Test fun theEntitlementNamesTheGamesApplication() {
|
||||
|
||||
Reference in new issue
Block a user