fix(SecurityConfig): update `admin_key` to repeated field

pull/1219/head
andrekir 2024-09-09 06:43:26 -03:00
rodzic cab2c29c25
commit 44e0f453a6
1 zmienionych plików z 9 dodań i 5 usunięć

Wyświetl plik

@ -18,6 +18,7 @@ import com.geeksville.mesh.ui.components.EditBase64Preference
import com.geeksville.mesh.ui.components.PreferenceCategory import com.geeksville.mesh.ui.components.PreferenceCategory
import com.geeksville.mesh.ui.components.PreferenceFooter import com.geeksville.mesh.ui.components.PreferenceFooter
import com.geeksville.mesh.ui.components.SwitchPreference import com.geeksville.mesh.ui.components.SwitchPreference
import com.google.protobuf.ByteString
@Suppress("LongMethod") @Suppress("LongMethod")
@Composable @Composable
@ -61,17 +62,20 @@ fun SecurityConfigItemList(
item { item {
EditBase64Preference( EditBase64Preference(
title = "Admin Key", title = "Admin Key",
value = securityInput.adminKey, value = securityInput.adminKeyList.firstOrNull() ?: ByteString.EMPTY,
enabled = enabled, enabled = enabled,
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }), keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
onValueChange = { onValueChange = {
securityInput = securityInput.copy { adminKey = it } securityInput = securityInput.copy {
adminKey.clear()
adminKey.add(it)
}
}, },
) )
} }
item { item {
SwitchPreference(title = "Managed mode", SwitchPreference(title = "Managed Mode",
checked = securityInput.isManaged, checked = securityInput.isManaged,
enabled = enabled, enabled = enabled,
onCheckedChange = { onCheckedChange = {
@ -81,7 +85,7 @@ fun SecurityConfigItemList(
item { Divider() } item { Divider() }
item { item {
SwitchPreference(title = "Serial enabled", SwitchPreference(title = "Serial console",
checked = securityInput.serialEnabled, checked = securityInput.serialEnabled,
enabled = enabled, enabled = enabled,
onCheckedChange = { securityInput = securityInput.copy { serialEnabled = it } }) onCheckedChange = { securityInput = securityInput.copy { serialEnabled = it } })
@ -99,7 +103,7 @@ fun SecurityConfigItemList(
item { Divider() } item { Divider() }
item { item {
SwitchPreference(title = "Legacy Admin Channel", SwitchPreference(title = "Legacy Admin channel",
checked = securityInput.adminChannelEnabled, checked = securityInput.adminChannelEnabled,
enabled = enabled, enabled = enabled,
onCheckedChange = { onCheckedChange = {