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
Showing only changes of commit 6d8f8d3079 - Show all commits
@@ -48,17 +48,30 @@ class AppSessionViewModel @Inject constructor(
init { init {
Outdated
Review

可用性绕过

stateFor 未校验当前构建中的 ProviderAvailability。如果设备保留了来自允许 ABox 的构建或旧版本的活动配置,release 构建仍会直接进入该提供方的登录页并允许发起登录,而不是按禁用状态返回提供方选择。应在启动时拒绝或清除当前构建中已禁用的活动配置。

**可用性绕过** `stateFor` 未校验当前构建中的 `ProviderAvailability`。如果设备保留了来自允许 ABox 的构建或旧版本的活动配置,release 构建仍会直接进入该提供方的登录页并允许发起登录,而不是按禁用状态返回提供方选择。应在启动时拒绝或清除当前构建中已禁用的活动配置。 <!-- pr-agent-dedup: 19fa23f0789e --> <!-- pr-agent-key-issue-location: ba588bc35666 -->
viewModelScope.launch { viewModelScope.launch {
val activeProfile = profileStore.activeProfile() try {
if (activeProfile != null && availability.forType(activeProfile.type) is Availability.Disabled) { val activeProfile = profileStore.activeProfile()
coordinator.switchProvider() if (activeProfile != null && availability.forType(activeProfile.type) is Availability.Disabled) {
coordinator.switchProvider()
bootstrapResult.value = ProviderBootstrapResult(
profileId = null,
result = DomainResult.Success(null),
)
} else {
bootstrapResult.value = ProviderBootstrapResult(
profileId = activeProfile?.id,
result = coordinator.bootstrap(),
)
}
} catch (error: kotlinx.coroutines.CancellationException) {
throw error
} catch (error: Exception) {
bootstrapResult.value = ProviderBootstrapResult( bootstrapResult.value = ProviderBootstrapResult(
profileId = null, profileId = null,
result = DomainResult.Success(null), result = DomainResult.Failure(
) com.flagship.abox.manager.domain.DomainError.Unknown(
} else { detail = error.message ?: "Unable to load provider settings",
bootstrapResult.value = ProviderBootstrapResult( ),
profileId = activeProfile?.id, ),
result = coordinator.bootstrap(),
) )
} }
} }