mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-24 23:36:04 +00:00
feat(onboarding): background first-run downloads, one setup card, no wait for Steam (#3091)
* feat(onboarding): one setup card, Steam client and Proton downloaded in the background, no component toast * feat(onboarding): an optional Bluetooth controllers row in the setup card asks for the permission up front * feat(onboarding): prefetch Steam's whole package cache, one foreground notification, child-process setup while downloads run * test(steam): the cache pass keeps packages under Steam's names and is not repeated * feat(onboarding): unpack the whole Steam client ahead of time and record it as installed, downloads no longer wait for a cool device * feat(onboarding): setup progress on the Steam home page, Bluetooth asked only from the setup card, Steam unpacks its own files * fix(onboarding): review fixes: removal does not report setup progress, cancel stops the whole prefetch, cache files are verified, no resume toast * fix(onboarding): a cancelled prefetch is never a setup failure * fix(onboarding): the Steam fact is updated atomically * feat(onboarding): Bluetooth controllers moves into the Steam integration list
This commit is contained in:
1 parent
15b1e196af
commit
59e98afae7
22 files changed
+590
-37
No files matched your search
@@ -35,6 +35,7 @@ import java.util.concurrent.atomic.AtomicInteger
|
||||
class ProtonMenuAutoTest {
|
||||
private val online = AutoComponents.online
|
||||
private val constrained = AutoComponents.unfavourable
|
||||
private val firstRunHeldBack = AutoComponents.firstRunHeldBack
|
||||
private lateinit var activity: Activity
|
||||
private lateinit var menu: ProtonMenu
|
||||
private lateinit var root: File
|
||||
@@ -49,6 +50,7 @@ class ProtonMenuAutoTest {
|
||||
}
|
||||
AutoComponents.online = { true }
|
||||
AutoComponents.unfavourable = { false }
|
||||
AutoComponents.firstRunHeldBack = { false }
|
||||
SessionState.running = false
|
||||
SessionState.phase = SessionPhase.IDLE
|
||||
SessionState.stopRequested = false
|
||||
@@ -77,6 +79,7 @@ class ProtonMenuAutoTest {
|
||||
menu.protonPercent = -1
|
||||
AutoComponents.online = online
|
||||
AutoComponents.unfavourable = constrained
|
||||
AutoComponents.firstRunHeldBack = firstRunHeldBack
|
||||
SessionState.running = false
|
||||
SessionState.phase = SessionPhase.IDLE
|
||||
SessionState.stopRequested = false
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import com.droiddeck.launcher.session.Onboarding.Facts
|
||||
import com.droiddeck.launcher.session.Onboarding.Progress
|
||||
import com.droiddeck.launcher.session.Onboarding.State
|
||||
import com.droiddeck.launcher.session.Onboarding.Step
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class OnboardingTest {
|
||||
private val none = Facts(runtime = false, proton = false, steam = false)
|
||||
|
||||
@Test fun everythingReadyShowsNothing() {
|
||||
val rows = Onboarding.rows(emptyMap(), emptyMap(), Facts())
|
||||
assertFalse(Onboarding.pending(rows))
|
||||
assertEquals(100, Onboarding.overall(rows))
|
||||
}
|
||||
|
||||
@Test fun stepsAreActiveFailedOrWaiting() {
|
||||
val rows = Onboarding.rows(mapOf(Step.RUNTIME to Progress("x", 50)), mapOf(Step.PROTON to "no"), none)
|
||||
assertEquals(listOf(State.ACTIVE, State.FAILED, State.WAITING), rows.map { it.state })
|
||||
assertTrue(Onboarding.pending(rows))
|
||||
}
|
||||
|
||||
@Test fun anActiveStepStaysActiveWhenItsFactIsAlreadyTrue() {
|
||||
val rows = Onboarding.rows(mapOf(Step.STEAM to Progress("x", -1)), emptyMap(), Facts())
|
||||
assertEquals(State.ACTIVE, rows.first { it.step == Step.STEAM }.state)
|
||||
}
|
||||
|
||||
@Test fun overallWeighsDownloadsBySize() {
|
||||
val rows = Onboarding.rows(mapOf(Step.RUNTIME to Progress("x", 50)), emptyMap(), Facts(runtime = false))
|
||||
assertEquals(30 + 15 + 25, Onboarding.overall(rows))
|
||||
}
|
||||
|
||||
@Test fun reportingClearsAPriorFailure() {
|
||||
Onboarding.fail(Step.STEAM, "boom")
|
||||
Onboarding.report(Step.STEAM, "again", 3)
|
||||
assertTrue(Onboarding.failed.value[Step.STEAM] == null)
|
||||
Onboarding.finish(Step.STEAM)
|
||||
assertTrue(Onboarding.active.value[Step.STEAM] == null)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Test
|
||||
|
||||
class SteamClientPrefetchTest {
|
||||
@Test fun readsPercentAndTotalFromTheInstallersStepLine() {
|
||||
val line = "== STEP 14:21:07 downloading Steam: bins_linuxarm64.zip (2/5), 120 of 480 MB"
|
||||
assertEquals(25 to 480, SteamClientPrefetch.parse(line))
|
||||
}
|
||||
|
||||
@Test fun aRetryNoteDoesNotChangeTheReading() {
|
||||
val line = "== STEP 14:21:07 downloading Steam: x.zip (1/3), 10 of 40 MB - retrying in 5s"
|
||||
assertEquals(25 to 40, SteamClientPrefetch.parse(line))
|
||||
}
|
||||
|
||||
@Test fun otherLinesAreIgnored() {
|
||||
assertNull(SteamClientPrefetch.parse("== STEP 14:21:07 the Steam client now follows steamdeck_stable"))
|
||||
assertNull(SteamClientPrefetch.parse("downloading Steam: x (1/1), 5 of 0 MB"))
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,8 @@ class SteamIntegrationGroupTest {
|
||||
compose.onNodeWithTag("integration-action-brightness").performClick()
|
||||
compose.onNodeWithTag("integration-action-home").performClick()
|
||||
compose.onNodeWithTag("integration-action-shortcuts").performClick()
|
||||
assertEquals(listOf(Feature.BRIGHTNESS, Feature.HOME, Feature.SHORTCUTS), requests)
|
||||
compose.onNodeWithTag("integration-action-bluetooth").performClick()
|
||||
assertEquals(listOf(Feature.BRIGHTNESS, Feature.HOME, Feature.SHORTCUTS, Feature.BLUETOOTH), requests)
|
||||
}
|
||||
|
||||
@Test fun switchesReflectAndroidGrants() {
|
||||
@@ -50,7 +51,8 @@ class SteamIntegrationGroupTest {
|
||||
compose.onNodeWithTag("integration-action-brightness").assert(stateIs("On"))
|
||||
compose.onNodeWithTag("integration-action-shortcuts").assert(stateIs("On"))
|
||||
compose.onNodeWithTag("integration-action-wifi").assert(stateIs("Off"))
|
||||
compose.onNodeWithText("3 of 4 on").assertExists()
|
||||
compose.onNodeWithTag("integration-action-bluetooth").assert(stateIs("Off"))
|
||||
compose.onNodeWithText("3 of 5 on").assertExists()
|
||||
}
|
||||
|
||||
@Test fun shortcutsDoNotNeedHome() {
|
||||
|
||||
Reference in new issue
Block a user