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 {
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(),
) )
} }
} }