mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 22:36:00 +00:00
fix(agent): install helpers off the main thread and offer sign-in only after the install
This commit is contained in:
1 parent
8ffac40b4f
commit
3f5e3bb19d
3 files changed
+4
-2
No files matched your search
@@ -10,3 +10,4 @@ tools/mangoapp/mangoapp text eol=lf
|
|||||||
app/src/main/assets/desktop-removal/*.json text eol=lf
|
app/src/main/assets/desktop-removal/*.json text eol=lf
|
||||||
app/src/main/assets/desktop-removal/*.txt text eol=lf
|
app/src/main/assets/desktop-removal/*.txt text eol=lf
|
||||||
*.pdf binary
|
*.pdf binary
|
||||||
|
app/src/main/assets/agent/* text eol=lf
|
||||||
@@ -63,7 +63,6 @@ object AgentSetup {
|
|||||||
val command = when (step) {
|
val command = when (step) {
|
||||||
Step.CONNECTION -> return
|
Step.CONNECTION -> return
|
||||||
Step.INSTALL -> {
|
Step.INSTALL -> {
|
||||||
installHelpers(app)
|
|
||||||
listOf("sh", "-c", "set -e; export DEBIAN_FRONTEND=noninteractive; " +
|
listOf("sh", "-c", "set -e; export DEBIAN_FRONTEND=noninteractive; " +
|
||||||
"apt-get install -y --no-install-recommends git gh adb curl ca-certificates python3; ${harness.install}")
|
"apt-get install -y --no-install-recommends git gh adb curl ca-certificates python3; ${harness.install}")
|
||||||
}
|
}
|
||||||
@@ -76,6 +75,7 @@ object AgentSetup {
|
|||||||
detail.remove(step)
|
detail.remove(step)
|
||||||
Thread({
|
Thread({
|
||||||
val result = runCatching {
|
val result = runCatching {
|
||||||
|
if (step == Step.INSTALL) installHelpers(app)
|
||||||
val child = AgentHost.guest(app, command).start()
|
val child = AgentHost.guest(app, command).start()
|
||||||
child.outputStream.close()
|
child.outputStream.close()
|
||||||
child.inputStream.bufferedReader().forEachLine { line ->
|
child.inputStream.bufferedReader().forEachLine { line ->
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ internal fun AgentSetupView(modifier: Modifier, onDone: () -> Unit = {}) {
|
|||||||
},
|
},
|
||||||
title, detail, divider = index < steps.lastIndex,
|
title, detail, divider = index < steps.lastIndex,
|
||||||
) {
|
) {
|
||||||
if (status == Status.TODO || status == Status.FAILED) {
|
val blocked = step == Step.SIGN_IN && AgentSetup.status[Step.INSTALL] != Status.DONE
|
||||||
|
if ((status == Status.TODO || status == Status.FAILED) && !blocked) {
|
||||||
val label = stringResource(if (status == Status.FAILED) R.string.agent_setup_retry else action(step))
|
val label = stringResource(if (status == Status.FAILED) R.string.agent_setup_retry else action(step))
|
||||||
val run = { if (step == Step.CONNECTION) pair(context) else AgentSetup.run(context, step) }
|
val run = { if (step == Step.CONNECTION) pair(context) else AgentSetup.run(context, step) }
|
||||||
if (step.required) PrimaryButton(label, compact = true, onClick = run) else SecondaryButton(label, compact = true, onClick = run)
|
if (step.required) PrimaryButton(label, compact = true, onClick = run) else SecondaryButton(label, compact = true, onClick = run)
|
||||||
|
|||||||
Reference in new issue
Block a user