* feat(#441): add profile cloning and description editing * feat(#441): add profile builder wizard and API enhancements Introduce 5-step Profile Builder wizard into ProfilesScreen and add support for create/clone endpoints. * fix(#441): restore imports and add ProfileInfo constructor defaults * style: run ktlint format on codebase to fix styling errors * fix(#441): address PR review comments including provider slug bug, validation, and strings * fix(#441): remove unused McpServerConfigInput import --------- Co-authored-by: Hermes Agent <hermes@agent.local>
This commit is contained in:
1 parent
846a9380e2
commit
d181851670
37 files changed
+2299
-448
No files matched your search
@@ -140,6 +140,7 @@ class PairingCodeEntryViewModel(
|
||||
ApiClient.rebuild()
|
||||
_uiState.update { it.copy(isConnecting = false, connectionSuccess = true) }
|
||||
}
|
||||
|
||||
is NetworkResult.Failure -> {
|
||||
val msg = buildErrorMessage(result)
|
||||
setError(msg)
|
||||
@@ -148,8 +149,8 @@ class PairingCodeEntryViewModel(
|
||||
}
|
||||
}
|
||||
|
||||
private fun buildErrorMessage(result: NetworkResult.Failure): String {
|
||||
return when (val err = result.error) {
|
||||
private fun buildErrorMessage(result: NetworkResult.Failure): String =
|
||||
when (val err = result.error) {
|
||||
is NetworkError.Http -> {
|
||||
when (err.code) {
|
||||
401 -> app.getString(R.string.connect_error_401)
|
||||
@@ -157,13 +158,19 @@ class PairingCodeEntryViewModel(
|
||||
else -> app.getString(R.string.connect_error_http_code, err.code)
|
||||
}
|
||||
}
|
||||
is NetworkError.AuthExpired -> app.getString(R.string.connect_error_401)
|
||||
is NetworkError.Connection ->
|
||||
|
||||
is NetworkError.AuthExpired -> {
|
||||
app.getString(R.string.connect_error_401)
|
||||
}
|
||||
|
||||
is NetworkError.Connection -> {
|
||||
app.getString(R.string.connect_error_connection_failed, err.cause.message ?: "")
|
||||
is NetworkError.Unknown ->
|
||||
}
|
||||
|
||||
is NetworkError.Unknown -> {
|
||||
app.getString(R.string.connect_error_connection_failed, err.cause.message ?: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setError(msg: String) {
|
||||
_uiState.update { it.copy(isConnecting = false, errorMessage = msg) }
|
||||
|
||||
@@ -26,7 +26,9 @@ data class PairingUiState(
|
||||
val toastMessage: String? = null,
|
||||
)
|
||||
|
||||
class PairingViewModel : ViewModel(), ToastHost {
|
||||
class PairingViewModel :
|
||||
ViewModel(),
|
||||
ToastHost {
|
||||
private val _uiState = MutableStateFlow(PairingUiState())
|
||||
val uiState: StateFlow<PairingUiState> = _uiState.asStateFlow()
|
||||
|
||||
|
||||
Reference in new issue
Block a user