fix: use full key path for config field lookup and save

- Prefix field keys with sectionKey in ConfigViewModel so
  extractNestedValue and buildNestedJsonObject resolve the correct
  nested paths in the config JSON.
- Replace slash in BACKEND_SETTINGS_LIST route to avoid Compose
  Navigation path-segment collision.
- Add *.jks to .gitignore.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kohei 2026-02-27 20:28:47 +09:00
parent ac66b252c5
commit c94fc58353
3 changed files with 6 additions and 3 deletions

1
android/.gitignore vendored
View file

@ -13,3 +13,4 @@ local.properties
/core/*/build
keystore.properties
keystore/
*.jks

View file

@ -4,7 +4,7 @@ object NavRoutes {
const val CHAT = "chat"
const val SETTINGS = "settings"
const val BACKEND_SETTINGS = "backend_settings"
const val BACKEND_SETTINGS_LIST = "backend_settings/list"
const val BACKEND_SETTINGS_LIST = "backend_settings_list"
const val BACKEND_SETTINGS_SECTION = "backend_settings/{sectionKey}"
const val APP_SETTINGS = "app_settings"
}

View file

@ -54,7 +54,8 @@ class ConfigViewModel(private val apiClient: ConfigApiClient) : ViewModel() {
val section = s.sections.find { it.key == sectionKey } ?: return
val fields = section.fields.map { field ->
val raw = extractNestedValue(config, field.key)
val fullKey = "$sectionKey.${field.key}"
val raw = extractNestedValue(config, fullKey)
val display = jsonElementToEditString(raw, field.type)
FieldState(
key = field.key,
@ -97,7 +98,8 @@ class ConfigViewModel(private val apiClient: ConfigApiClient) : ViewModel() {
saveJob = viewModelScope.launch {
try {
val payload = buildNestedJsonObject(changed)
val prefixed = changed.map { it.copy(key = "${detail.sectionKey}.${it.key}") }
val payload = buildNestedJsonObject(prefixed)
val result = apiClient.saveConfig(payload)
if (result.error != null) {
_uiState.update { it.copy(saveState = SaveState.Error(result.error)) }