fix: resolve all build compilation and style check warnings (#597)
* fix: resolve all build compilation and style check warnings * fix: remove unused import in SystemViewModel
This commit is contained in:
28 files changed
+293
-192
No files matched your search
@@ -274,21 +274,25 @@ private fun OAuthFlowDialog(
|
||||
Text(stringResource(R.string.providers_action_submit_code))
|
||||
}
|
||||
}
|
||||
|
||||
OAuthFlowPhase.DONE -> {
|
||||
Button(onClick = onDismissFlow) {
|
||||
Text(stringResource(R.string.action_done))
|
||||
}
|
||||
}
|
||||
|
||||
OAuthFlowPhase.ERROR -> {
|
||||
Button(onClick = onDismissFlow) {
|
||||
Text(stringResource(R.string.action_close))
|
||||
}
|
||||
}
|
||||
|
||||
OAuthFlowPhase.SHOW_CLI -> {
|
||||
Button(onClick = onDismissFlow) {
|
||||
Text(stringResource(R.string.action_close))
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
TextButton(onClick = onCancel) {
|
||||
Text(stringResource(R.string.action_cancel))
|
||||
@@ -301,8 +305,6 @@ private fun OAuthFlowDialog(
|
||||
TextButton(onClick = onCancel) {
|
||||
Text(stringResource(R.string.action_cancel))
|
||||
}
|
||||
} else {
|
||||
Unit
|
||||
}
|
||||
},
|
||||
title = { Text(provider.name, style = MaterialTheme.typography.titleLarge) },
|
||||
@@ -312,6 +314,7 @@ private fun OAuthFlowDialog(
|
||||
provider.flow == "external" -> {
|
||||
ExternalFlowContent(provider = provider)
|
||||
}
|
||||
|
||||
state.flowPhase == OAuthFlowPhase.WAITING_CODE && start?.authUrl != null -> {
|
||||
PkceFlowContent(
|
||||
authUrl = start.authUrl,
|
||||
@@ -321,6 +324,7 @@ private fun OAuthFlowDialog(
|
||||
error = state.flowErrorMessage,
|
||||
)
|
||||
}
|
||||
|
||||
state.flowPhase == OAuthFlowPhase.POLLING -> {
|
||||
DeviceCodeFlowContent(
|
||||
start = start,
|
||||
@@ -329,15 +333,17 @@ private fun OAuthFlowDialog(
|
||||
error = state.flowErrorMessage,
|
||||
)
|
||||
}
|
||||
|
||||
state.flowPhase == OAuthFlowPhase.DONE -> {
|
||||
Text(
|
||||
text = stringResource(R.string.providers_flow_success),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
)
|
||||
}
|
||||
|
||||
state.flowErrorMessage != null -> {
|
||||
Text(
|
||||
text = state.flowErrorMessage!!,
|
||||
text = state.flowErrorMessage,
|
||||
color = MaterialTheme.colorScheme.error,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
)
|
||||
|
||||
@@ -77,7 +77,7 @@ class ProvidersViewModel :
|
||||
_uiState.update {
|
||||
it.copy(
|
||||
isLoading = false,
|
||||
providers = data?.providers.orEmpty(),
|
||||
providers = data.providers.orEmpty(),
|
||||
)
|
||||
}
|
||||
},
|
||||
@@ -161,16 +161,7 @@ class ProvidersViewModel :
|
||||
val result = safeApiCall { ApiClient.hermesApi.startOAuthLogin(provider.id) }
|
||||
when (result) {
|
||||
is NetworkResult.Success -> {
|
||||
val start =
|
||||
result.data ?: run {
|
||||
_uiState.update {
|
||||
it.copy(
|
||||
flowPhase = OAuthFlowPhase.IDLE,
|
||||
flowErrorMessage = "Empty start response",
|
||||
)
|
||||
}
|
||||
return@launch
|
||||
}
|
||||
val start = result.data
|
||||
_uiState.update {
|
||||
it.copy(
|
||||
flowPhase =
|
||||
@@ -224,13 +215,13 @@ class ProvidersViewModel :
|
||||
when (result) {
|
||||
is NetworkResult.Success -> {
|
||||
val submit = result.data
|
||||
if (submit?.ok == true) {
|
||||
if (submit.ok) {
|
||||
finishFlow("approved")
|
||||
} else {
|
||||
_uiState.update {
|
||||
it.copy(
|
||||
flowStatus = submit?.status ?: "error",
|
||||
flowErrorMessage = submit?.message ?: "Submission rejected",
|
||||
flowStatus = submit.status ?: "error",
|
||||
flowErrorMessage = submit.message ?: "Submission rejected",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -271,6 +262,7 @@ class ProvidersViewModel :
|
||||
finishFlow("approved")
|
||||
return@launch
|
||||
}
|
||||
|
||||
"denied", "expired", "error" -> {
|
||||
_uiState.update {
|
||||
it.copy(
|
||||
@@ -283,6 +275,7 @@ class ProvidersViewModel :
|
||||
}
|
||||
return@launch
|
||||
}
|
||||
|
||||
else -> { /* still pending — keep polling */ }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user