feat: add provider login flow #4
+13
@@ -48,6 +48,7 @@ class AppSessionViewModel @Inject constructor(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
|
try {
|
||||||
val activeProfile = profileStore.activeProfile()
|
val activeProfile = profileStore.activeProfile()
|
||||||
if (activeProfile != null && availability.forType(activeProfile.type) is Availability.Disabled) {
|
if (activeProfile != null && availability.forType(activeProfile.type) is Availability.Disabled) {
|
||||||
coordinator.switchProvider()
|
coordinator.switchProvider()
|
||||||
@@ -61,6 +62,18 @@ class AppSessionViewModel @Inject constructor(
|
|||||||
result = coordinator.bootstrap(),
|
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 {
|
viewModelScope.launch {
|
||||||
coordinator.observeActiveSession()
|
coordinator.observeActiveSession()
|
||||||
|
|||||||
Reference in New Issue
Block a user