mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 13:55:58 +00:00
fix: refresh repaired components and render Ubisoft Connect (#2090)
* fix: refresh repaired components and render Ubisoft Connect * fix: address component repair and Wine registry review * fix: repair manually enabled components and check registry writes * fix: serialize component repairs and use Proton runinprefix * fix: report queued component repair failures * fix: preserve newer component repair waits * Make component queue transitions atomic * Isolate component apply failures by game * Preserve pending repair when catalog is stale * Restore persisted component repair revisions * Update pending requirements atomically * Respect disabled pending components per game * Keep queue key state atomic while worker waits * Pass selected game to component repairs * Preserve pending repair when component is absent * Preserve pending revision on catalog failure * Test legacy pending repair revision recovery * Isolate fake worker Steam app info lookup * Merge queued Steam app info lookups * Persist launch component revisions before repair * Gate launch on component repair discovery * Expand and refresh launch repair discovery * Include new automatic picks in launch requirements * Log repair persistence failures and align repair keys * Use runtime key for Battle.net component repairs * Retain failed component reapplications for retry * Harden pending repairs and launch preparation * Isolate wait-cool sleep mocking * Allow launches without catalog when no repair is pending * Queue launch repairs even if persistence fails * Block launch when repair state cannot persist * Allow launch when no component repair is needed * Persist selected repairs when catalog is offline * Drain offline component repair in test
This commit is contained in:
1 parent
ab92033b90
commit
516e3862fa
14 files changed
+756
-83
No files matched your search
@@ -900,6 +900,7 @@ fun ComponentsPage(
|
||||
winOpen,
|
||||
compat = selectedGame.protonPrefix,
|
||||
steamAppId = selectedGame.appId.takeIf { selectedGame.library != Library.ADDED },
|
||||
game = selectedGame,
|
||||
) {
|
||||
winComponentsOpen = null
|
||||
winComponentsRevision++
|
||||
|
||||
@@ -104,6 +104,7 @@ internal fun WinComponentsDialog(
|
||||
var slowCatalog by remember { mutableStateOf(false) }
|
||||
LaunchedEffect(Unit) { kotlinx.coroutines.delay(300); slowCatalog = true }
|
||||
var installed by remember { mutableStateOf(emptySet<String>()) }
|
||||
var freshInstalled by remember { mutableStateOf(emptySet<String>()) }
|
||||
var present by remember { mutableStateOf(emptySet<String>()) }
|
||||
var selection by remember { mutableStateOf(WinComponents.selection(context, appKey)) }
|
||||
val picks = selection.effective
|
||||
@@ -141,9 +142,11 @@ internal fun WinComponentsDialog(
|
||||
findings = found
|
||||
selection = withContext(Dispatchers.IO) { WinComponents.selection(context, appKey) }
|
||||
present = withContext(Dispatchers.IO) { PrefixInstalledDetector.detect(compat) }
|
||||
installed = withContext(Dispatchers.IO) { WinComponents.installedIds(context).toSet() }
|
||||
installed = withContext(Dispatchers.IO) { WinComponents.downloadedIds(context).toSet() }
|
||||
freshInstalled = withContext(Dispatchers.IO) { WinComponents.installedIds(context).toSet() }
|
||||
}
|
||||
val autoDownloading by com.droiddeck.launcher.frontend.AutoComponents.downloading.collectAsState()
|
||||
val repairFailures by com.droiddeck.launcher.frontend.AutoComponents.repairFailures.collectAsState()
|
||||
val online = rememberOnline()
|
||||
val autoChanges by com.droiddeck.launcher.frontend.AutoComponents.changes.collectAsState()
|
||||
val pendingGames by com.droiddeck.launcher.frontend.AutoComponents.pendingGames.collectAsState()
|
||||
@@ -152,7 +155,8 @@ internal fun WinComponentsDialog(
|
||||
if (game != null) withContext(Dispatchers.IO) { com.droiddeck.launcher.frontend.AutoComponents.cachedFindings(context, appKey) }
|
||||
?.let { findings = it; if (appKey !in pendingGames) findingsKnown = true }
|
||||
selection = withContext(Dispatchers.IO) { WinComponents.selection(context, appKey) }
|
||||
installed = withContext(Dispatchers.IO) { WinComponents.installedIds(context).toSet() }
|
||||
installed = withContext(Dispatchers.IO) { WinComponents.downloadedIds(context).toSet() }
|
||||
freshInstalled = withContext(Dispatchers.IO) { WinComponents.installedIds(context).toSet() }
|
||||
}
|
||||
fun setUser(id: String, on: Boolean) {
|
||||
selection = WinComponents.Selection(selection.auto, selection.user + (id to on))
|
||||
@@ -173,15 +177,25 @@ internal fun WinComponentsDialog(
|
||||
}
|
||||
val all = catalog.orEmpty()
|
||||
val c = all[id]
|
||||
if (id in installed || c == null) { setUser(id, true); return }
|
||||
if (id in installed) {
|
||||
setUser(id, true)
|
||||
if (c != null && id !in freshInstalled) {
|
||||
com.droiddeck.launcher.frontend.AutoComponents.queueRepair(context, id,
|
||||
game?.let { com.droiddeck.launcher.frontend.AutoComponents.appKey(it) }, c.revision)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (c == null) { setUser(id, true); return }
|
||||
busyId = id; reverting = false
|
||||
progress = WinComponents.Progress(id, "", WinComponents.Phase.DOWNLOAD, -1)
|
||||
progress = null
|
||||
coroutine.launch {
|
||||
val problem = withContext(Dispatchers.IO) {
|
||||
WinComponents.install(context, c, all) { p -> progress = p }
|
||||
if (WinComponents.installed(context, id) != null) null
|
||||
else WinComponents.install(context, c, all) { p -> progress = p }
|
||||
}
|
||||
progress = null
|
||||
installed = withContext(Dispatchers.IO) { WinComponents.installedIds(context).toSet() }
|
||||
installed = withContext(Dispatchers.IO) { WinComponents.downloadedIds(context).toSet() }
|
||||
freshInstalled = withContext(Dispatchers.IO) { WinComponents.installedIds(context).toSet() }
|
||||
if (problem != null) { error = problem; failed = id } else setUser(id, true)
|
||||
busyId = null
|
||||
}
|
||||
@@ -244,6 +258,9 @@ internal fun WinComponentsDialog(
|
||||
val status = when {
|
||||
!online && id !in installed && support == Support.READY -> stringResource(R.string.wincomp_when_online)
|
||||
id == failed && error != null -> stringResource(R.string.wincomp_failed, error.orEmpty())
|
||||
id in repairFailures -> stringResource(R.string.wincomp_failed, repairFailures.getValue(id))
|
||||
id in pendingComponents && id in installed && id !in freshInstalled -> stringResource(R.string.wincomp_repair_queued)
|
||||
id in installed && id !in freshInstalled -> stringResource(R.string.wincomp_repair_required)
|
||||
id in here && id !in picks -> stringResource(R.string.wincomp_already_here)
|
||||
id in installed -> stringResource(R.string.wincomp_downloaded)
|
||||
support == Support.NEEDS_INSTALLER -> stringResource(R.string.wincomp_needs_installer)
|
||||
@@ -275,6 +292,12 @@ internal fun WinComponentsDialog(
|
||||
modifier = (if (usable && focus != null) Modifier.focusRequester(focus) else Modifier)
|
||||
.onFocusChanged { if (it.isFocused) switchFocused = true },
|
||||
) { on -> toggle(id, on) }
|
||||
if (id in repairFailures && c != null) {
|
||||
SecondaryButton(stringResource(R.string.wincomp_retry), compact = true) {
|
||||
com.droiddeck.launcher.frontend.AutoComponents.queueRepair(context, id,
|
||||
game?.let { com.droiddeck.launcher.frontend.AutoComponents.appKey(it) }, c.revision)
|
||||
}
|
||||
}
|
||||
}
|
||||
fun firstUsable(ids: List<String>, focus: FocusRequester): (String) -> FocusRequester? {
|
||||
val first = ids.firstOrNull { supportOf(it) == Support.READY }
|
||||
|
||||
Reference in new issue
Block a user