mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-07 10:46:06 -10:00
fix(components): repaired components reach prefixes that already have them (#2121)
fix(components): the library sweep refreshes the catalog when it is safe to A game job reads the cached catalog, and the installed check compares against the cached revision, so a repaired component never reached a prefix that already had it. The sweep now fetches the catalog first when online and not on a metered or constrained connection.
This commit is contained in:
1 parent
a309428a2a
commit
4c23092c55
2 files changed
+19
No files matched your search
@@ -516,6 +516,7 @@ object AutoComponents {
|
||||
fun refreshLater(context: Context, game: Library.SteamGame) = queueGame(context, game, asked = true)
|
||||
|
||||
fun sweep(context: Context, games: List<Library.SteamGame>) {
|
||||
if (online(context) && !unfavourable(context)) catalogOf(context, true)
|
||||
val apps = games.mapNotNull { steamAppOf(context, it) }.distinct()
|
||||
if (apps.isNotEmpty() && SteamAppInfo.needLookup(context, apps).isNotEmpty()) enqueue(context, Job(null, null, false, seq.incrementAndGet(), pics = apps))
|
||||
games.forEach { queueGame(context, it, asked = false) }
|
||||
|
||||
@@ -290,6 +290,24 @@ class WinCompSourcesTest {
|
||||
assertFalse(requests.first())
|
||||
}
|
||||
|
||||
@Test fun aSweepRefreshesTheCatalogOnlyOnAFavourableConnection() = withFakeWorker {
|
||||
installedNow.addAll(catalog3.map { it.name })
|
||||
val requests = ArrayList<Boolean>()
|
||||
AutoComponents.catalogOf = { _, network -> requests.add(network); catalog3 }
|
||||
val games = listOf(payback())
|
||||
AutoComponents.sweep(app, games)
|
||||
assertTrue(requests.first())
|
||||
requests.clear()
|
||||
AutoComponents.unfavourable = { true }
|
||||
AutoComponents.sweep(app, games)
|
||||
assertFalse(requests.contains(true))
|
||||
requests.clear()
|
||||
AutoComponents.unfavourable = { false }
|
||||
AutoComponents.online = { false }
|
||||
AutoComponents.sweep(app, games)
|
||||
assertFalse(requests.contains(true))
|
||||
}
|
||||
|
||||
@Test fun aSteamListedComponentNotYetDownloadedTurnsOnWhenItLands() = withFakeWorker {
|
||||
installedNow.add("d3dx9")
|
||||
val game = payback()
|
||||
|
||||
Reference in new issue
Block a user