fix(#115): send enabled flag on config save and propagate configuration errors (#186)

This commit is contained in:
M57 authored and GitHub committed 2026-06-20 23:54:43 +03:00
1 parent 2b7facb7f4
commit 49fd12ac34
2 files changed
+16 -3

No files matched your search

@@ -158,7 +158,13 @@ fun ChannelsScreen(
Button(
onClick = {
viewModel.configurePlatform(platform.id, inputValues.toMap())
viewModel.configurePlatform(
platform.id,
MessagingPlatformUpdate(
enabled = platform.enabled,
env = inputValues.toMap(),
),
)
showConfigureForm = false
},
modifier = Modifier.align(Alignment.End),
@@ -54,6 +54,7 @@ class ChannelsViewModel : ViewModel() {
platformId: String,
update: MessagingPlatformUpdate,
) {
_uiState.update { it.copy(isLoading = true, errorMessage = null) }
viewModelScope.launch {
val result =
withContext(Dispatchers.IO) {
@@ -61,12 +62,18 @@ class ChannelsViewModel : ViewModel() {
}
when (result) {
is NetworkResult.Success -> {
_uiState.update { it.copy(toastMessage = "$platformId configured successfully") }
_uiState.update { it.copy(isLoading = false, toastMessage = "$platformId configured successfully") }
loadPlatforms()
}
is NetworkResult.Failure -> {
_uiState.update { it.copy(toastMessage = "Failed to configure platform: ${result.error.message}") }
_uiState.update {
it.copy(
isLoading = false,
errorMessage = "Failed to configure platform: ${result.error.message}",
toastMessage = "Failed to configure platform: ${result.error.message}",
)
}
}
}
}