mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
fix(steam): show progress while applying client updates
Forward extraction and installation messages from the x64 bootstrap log and replace stale download percentages with the applying-update state. Add regression coverage for phase ordering and log forwarding. Fixes #812
This commit is contained in:
1 parent
fe1dd8ca72
commit
0544933abd
6 files changed
+176
-1
No files matched your search
@@ -77,6 +77,7 @@ class LoadingState(context: Context, private val steam: Boolean = true) {
|
||||
var stepText: String? = null
|
||||
var downloadAt = -1
|
||||
var downloadPercent = -1
|
||||
var applyingAt = -1
|
||||
var clientDownloadAt = -1
|
||||
var clientDownload: String? = null
|
||||
var clientPercent = -1
|
||||
@@ -99,10 +100,16 @@ class LoadingState(context: Context, private val steam: Boolean = true) {
|
||||
val done = m.groupValues[1].toLong()
|
||||
val total = maxOf(1L, m.groupValues[2].toLong())
|
||||
downloadPercent = (done * 100 / total).toInt()
|
||||
} else if (steam && UPDATE_APPLYING.matches(line)) {
|
||||
applyingAt = at
|
||||
}
|
||||
}
|
||||
}
|
||||
return when {
|
||||
applyingAt > stepAt && applyingAt > downloadAt -> Line(
|
||||
context.getString(com.droiddeck.launcher.R.string.loadstate_steam_update_applying), -1,
|
||||
Topic.STEAM, readable = true,
|
||||
)
|
||||
downloadAt > stepAt && downloadPercent >= 0 -> Line(
|
||||
context.getString(com.droiddeck.launcher.R.string.loadstate_steam_update, downloadPercent), downloadPercent,
|
||||
Topic.STEAM, readable = true,
|
||||
@@ -151,6 +158,7 @@ class LoadingState(context: Context, private val steam: Boolean = true) {
|
||||
|
||||
private const val TAIL_BYTES = 48L * 1024
|
||||
private val UPDATE_PROGRESS = Regex("""Downloading update \((\d+) of (\d+) KB\)""")
|
||||
private val UPDATE_APPLYING = Regex("""^\s*(?:\[[^\]]+\]\s*)*(?:Extracting package|Installing update)\.\.\.\s*$""")
|
||||
private val INSTALL_COUNT = Regex("""downloading Steam: (\S+) \((\d+)/(\d+)\)""")
|
||||
private val INSTALL_MEGABYTES = Regex("""^, (\d+) of (\d+) MB""")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user