feat: add provider login flow #4

Merged
KremeCN merged 26 commits from feat/provider-login into main 2026-08-25 01:59:00 +08:00
5 changed files with 4 additions and 19 deletions
Showing only changes of commit 8d5984fb36 - Show all commits
@@ -27,19 +27,15 @@ class ProviderSelectionScreenTest {
ProviderProfile(ProviderProfileId("local"), ProviderType.LOCAL_EXPERIENCE, "Local"),
Availability.Enabled,
)
val compatible = ProviderOption(
ProviderProfile(
ProviderProfileId("compatible"),
ProviderType.COMPATIBLE_BACKEND,
"Compatible",
),
val abox = ProviderOption(
ProviderProfile(ProviderProfileId("abox"), ProviderType.ABOX, "ABox"),
Availability.Disabled(UnavailableReason.PROTOCOL_PENDING),
)
var selected: ProviderOption? = null
composeRule.setContent {
ABoxTheme {
ProviderSelectionScreen(
state = ProviderSelectionUiState(listOf(local, compatible)),
state = ProviderSelectionUiState(listOf(local, abox)),
onSelect = { selected = it },
)
Review

测试编译

assertDoesNotExist 是 Compose 测试包中的顶层扩展,但当前文件未导入它,androidTest 源集编译时会出现未解析引用。请添加 androidx.compose.ui.test.assertDoesNotExist 导入。

**测试编译** `assertDoesNotExist` 是 Compose 测试包中的顶层扩展,但当前文件未导入它,androidTest 源集编译时会出现未解析引用。请添加 `androidx.compose.ui.test.assertDoesNotExist` 导入。 <!-- pr-agent-dedup: bb180150bdf8 --> <!-- pr-agent-key-issue-location: 5be7c2c517bf -->
}
@@ -47,6 +43,6 @@ class ProviderSelectionScreenTest {
composeRule.onNodeWithText("Local experience").assertIsEnabled().performClick()
assertEquals(local, selected)
composeRule.onNodeWithText("Compatible backend").assertIsNotEnabled()
composeRule.onNodeWithText("ABox").assertIsNotEnabled()
}
}
@@ -222,7 +222,6 @@ private fun LoginErrorMessage.stringResource(): Int = when (this) {
private fun providerName(type: ProviderType): String = stringResource(
when (type) {
ProviderType.ABOX -> R.string.provider_abox_name
ProviderType.COMPATIBLE_BACKEND -> R.string.provider_compatible_name
ProviderType.LOCAL_EXPERIENCE -> R.string.provider_local_name
},
)
@@ -231,7 +230,6 @@ private fun providerName(type: ProviderType): String = stringResource(
private fun providerDescription(type: ProviderType): String = stringResource(
when (type) {
ProviderType.ABOX -> R.string.provider_abox_description
ProviderType.COMPATIBLE_BACKEND -> R.string.provider_compatible_description
ProviderType.LOCAL_EXPERIENCE -> R.string.provider_local_description
},
)
@@ -9,7 +9,6 @@ data class ProviderAvailability(
) {
fun forType(type: ProviderType): Availability = when (type) {
ProviderType.ABOX -> abox
ProviderType.COMPATIBLE_BACKEND -> compatible
ProviderType.LOCAL_EXPERIENCE -> local
}
}
@@ -185,7 +185,6 @@ private fun ProviderOptionCard(
private fun providerName(type: ProviderType): String = stringResource(
when (type) {
ProviderType.ABOX -> R.string.provider_abox_name
ProviderType.COMPATIBLE_BACKEND -> R.string.provider_compatible_name
ProviderType.LOCAL_EXPERIENCE -> R.string.provider_local_name
},
)
@@ -194,14 +193,12 @@ private fun providerName(type: ProviderType): String = stringResource(
private fun providerDescription(type: ProviderType): String = stringResource(
when (type) {
ProviderType.ABOX -> R.string.provider_abox_description
ProviderType.COMPATIBLE_BACKEND -> R.string.provider_compatible_description
ProviderType.LOCAL_EXPERIENCE -> R.string.provider_local_description
},
)
private fun providerMark(type: ProviderType): String = when (type) {
ProviderType.ABOX -> "A"
ProviderType.COMPATIBLE_BACKEND -> "C"
ProviderType.LOCAL_EXPERIENCE -> "L"
}
@@ -43,11 +43,6 @@ class ProviderSelectionViewModel @Inject constructor(
companion object {
private val PROFILES = listOf(
Review

本地化错误

内置提供方的英文名称被写入 ProviderProfile.displayName 并持久化,而认证页面直接展示该字段。在中文区域选择本地体验后,标题会显示为“已连接到 Local experience”。内置提供方应按 ProviderType 从资源中解析名称,而不是持久化固定的英文展示文案。

**本地化错误** 内置提供方的英文名称被写入 `ProviderProfile.displayName` 并持久化,而认证页面直接展示该字段。在中文区域选择本地体验后,标题会显示为“已连接到 Local experience”。内置提供方应按 `ProviderType` 从资源中解析名称,而不是持久化固定的英文展示文案。 <!-- pr-agent-dedup: 827c2f76b8e4 --> <!-- pr-agent-key-issue-location: 17e03af68498 -->
ProviderProfile(ProviderProfileId("abox-default"), ProviderType.ABOX, "ABox"),
ProviderProfile(
ProviderProfileId("compatible-default"),
ProviderType.COMPATIBLE_BACKEND,
"Compatible backend",
),
ProviderProfile(
ProviderProfileId("local-experience"),
ProviderType.LOCAL_EXPERIENCE,