Skip to content

Commit

Permalink
fix(SecurityConfig): update admin_key to repeated field
Browse files Browse the repository at this point in the history
  • Loading branch information
andrekir committed Sep 9, 2024
1 parent cab2c29 commit 44e0f45
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import com.geeksville.mesh.ui.components.EditBase64Preference
import com.geeksville.mesh.ui.components.PreferenceCategory
import com.geeksville.mesh.ui.components.PreferenceFooter
import com.geeksville.mesh.ui.components.SwitchPreference
import com.google.protobuf.ByteString

@Suppress("LongMethod")
@Composable
Expand Down Expand Up @@ -61,17 +62,20 @@ fun SecurityConfigItemList(
item {
EditBase64Preference(
title = "Admin Key",
value = securityInput.adminKey,
value = securityInput.adminKeyList.firstOrNull() ?: ByteString.EMPTY,
enabled = enabled,
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
onValueChange = {
securityInput = securityInput.copy { adminKey = it }
securityInput = securityInput.copy {
adminKey.clear()
adminKey.add(it)
}
},
)
}

item {
SwitchPreference(title = "Managed mode",
SwitchPreference(title = "Managed Mode",
checked = securityInput.isManaged,
enabled = enabled,
onCheckedChange = {
Expand All @@ -81,7 +85,7 @@ fun SecurityConfigItemList(
item { Divider() }

item {
SwitchPreference(title = "Serial enabled",
SwitchPreference(title = "Serial console",
checked = securityInput.serialEnabled,
enabled = enabled,
onCheckedChange = { securityInput = securityInput.copy { serialEnabled = it } })
Expand All @@ -99,7 +103,7 @@ fun SecurityConfigItemList(
item { Divider() }

item {
SwitchPreference(title = "Legacy Admin Channel",
SwitchPreference(title = "Legacy Admin channel",
checked = securityInput.adminChannelEnabled,
enabled = enabled,
onCheckedChange = {
Expand Down

0 comments on commit 44e0f45

Please sign in to comment.