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,6 +48,7 @@ class AppSessionViewModel @Inject constructor(
init {
viewModelScope.launch {
try {
val activeProfile = profileStore.activeProfile()
if (activeProfile != null && availability.forType(activeProfile.type) is Availability.Disabled) {
coordinator.switchProvider()
@@ -61,6 +62,18 @@ class AppSessionViewModel @Inject constructor(
result = coordinator.bootstrap(),
)
}
} catch (error: kotlinx.coroutines.CancellationException) {
throw error
} catch (error: Exception) {
bootstrapResult.value = ProviderBootstrapResult(
profileId = null,
result = DomainResult.Failure(
com.flagship.abox.manager.domain.DomainError.Unknown(
detail = error.message ?: "Unable to load provider settings",
),
),
)
}
}
viewModelScope.launch {
coordinator.observeActiveSession()