mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 21:35:59 +00:00
Offline mode on the main screen: start the client without signing in to Valve
The client runs without a connection - installed games launch, Proton and the frame-gen are all local - but only with credentials from an earlier sign-in, and it decides by two keys in loginusers.vdf that it reads once while it starts. That is why the switch belongs here and not in the session's drawer: changed during a session it would write the file and change nothing until the next launch. The button is disabled, and says so, until the client has signed in once. The client rewrites the file when it exits, so the request is kept as the app's own preference and written in again at every session start.
This commit is contained in:
1 parent
6c380528f3
commit
1b3c1cbf86
4 files changed
+142
No files matched your search
@@ -43,6 +43,9 @@ class MainUiState(
|
||||
val failed: Boolean,
|
||||
val frameGenLabel: String,
|
||||
val desktopInstalled: Boolean,
|
||||
/** The account the client would sign in as offline, or null if it has never signed in. */
|
||||
val offlineAccount: String?,
|
||||
val offline: Boolean,
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -63,6 +66,7 @@ fun MainScreen(
|
||||
onRuntime: () -> Unit,
|
||||
onFrameGen: () -> Unit,
|
||||
onProtons: () -> Unit,
|
||||
onOffline: () -> Unit,
|
||||
onCredits: () -> Unit,
|
||||
) {
|
||||
BoxWithConstraints(
|
||||
@@ -136,6 +140,21 @@ fun MainScreen(
|
||||
onClick = onDesktop, enabled = state.ready && !state.busy && state.desktopInstalled,
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 5.dp * k).height(buttonHeight + 5.dp * k),
|
||||
) { Text(if (state.desktopInstalled) "Desktop" else "Desktop — install it under Desktop & apps", fontSize = 13.sp * k) }
|
||||
// Offline is read while the client starts, so it is decided here rather than in the
|
||||
// session's drawer, and it needs credentials from an earlier sign-in to be possible.
|
||||
OutlinedButton(
|
||||
onClick = onOffline, enabled = state.offlineAccount != null,
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 5.dp * k).height(buttonHeight + 5.dp * k),
|
||||
) {
|
||||
Text(
|
||||
when {
|
||||
state.offlineAccount == null -> "Start offline — sign in once first"
|
||||
state.offline -> "Start offline: on · ${state.offlineAccount}"
|
||||
else -> "Start offline: off"
|
||||
},
|
||||
fontSize = 13.sp * k,
|
||||
)
|
||||
}
|
||||
val runtimeLabel = when {
|
||||
state.busy -> "Working…"
|
||||
!state.ready -> "Install Linux runtime"
|
||||
|
||||
Reference in new issue
Block a user