feat: route device operations by active provider
This commit is contained in:
-31
@@ -1,31 +0,0 @@
|
||||
package com.flagship.abox.manager.session.gateway
|
||||
|
||||
import com.flagship.abox.manager.domain.DomainError
|
||||
import com.flagship.abox.manager.domain.DomainResult
|
||||
import com.flagship.abox.manager.domain.LoginCredentials
|
||||
import com.flagship.abox.manager.domain.ProviderProfileId
|
||||
import com.flagship.abox.manager.domain.Session
|
||||
import com.flagship.abox.manager.domain.SessionGateway
|
||||
import com.flagship.abox.manager.domain.SessionValidity
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flowOf
|
||||
|
||||
class UnavailableRemoteSessionGateway : SessionGateway {
|
||||
override fun observeSession(profileId: ProviderProfileId): Flow<Session?> = flowOf(null)
|
||||
|
||||
override suspend fun login(
|
||||
profileId: ProviderProfileId,
|
||||
credentials: LoginCredentials,
|
||||
): DomainResult<Session> = unavailable()
|
||||
|
||||
override suspend fun validateSession(
|
||||
profileId: ProviderProfileId,
|
||||
): DomainResult<SessionValidity> = unavailable()
|
||||
|
||||
override suspend fun logout(profileId: ProviderProfileId): DomainResult<Unit> =
|
||||
DomainResult.Success(Unit)
|
||||
|
||||
private fun <T> unavailable(): DomainResult<T> = DomainResult.Failure(
|
||||
DomainError.InvalidRequest(detail = "Remote providers are not enabled in this build"),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user