Coverage Summary for Class: NoOpAuthRemoteRepository (com.georgeci.moneysurfer.offline.noop)
| Class |
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
| NoOpAuthRemoteRepository |
0%
(0/12)
|
|
0%
(0/12)
|
0%
(0/31)
|
| NoOpAuthRemoteRepository$Companion |
|
| Total |
0%
(0/12)
|
|
0%
(0/12)
|
0%
(0/31)
|
package com.georgeci.moneysurfer.offline.noop
import arrow.core.Either
import arrow.core.left
import com.georgeci.moneysurfer.domain.auth.AuthError
import com.georgeci.moneysurfer.domain.repositories.AuthRemoteRepository
/**
* Offline build has no Firebase Auth. Reads return empty session state; any
* write call (sign-in, sign-up, sign-out) reports `Unknown` so the UI surfaces
* a generic auth error rather than crashing on a missing definition.
*/
class NoOpAuthRemoteRepository : AuthRemoteRepository {
private val authDisabledError: AuthError
get() = AuthError(AuthError.Type.Unknown, AUTH_DISABLED_MESSAGE)
override fun currentUid(): String? = null
override fun currentEmail(): String? = null
override fun isCurrentUserAnonymous(): Boolean = false
override suspend fun signInWithEmail(email: String, password: String): Either<AuthError, String> =
unsupported()
override suspend fun createUserWithEmail(email: String, password: String): Either<AuthError, String> =
unsupported()
override suspend fun signInAnonymously(): Either<AuthError, String> = unsupported()
override suspend fun signOut(): Either<AuthError, Unit> =
authDisabledError.left()
override suspend fun reauthenticateWithEmail(email: String, password: String): Either<AuthError, Unit> =
authDisabledError.left()
override suspend fun deleteCurrentUser(): Either<AuthError, Unit> =
authDisabledError.left()
private fun unsupported(): Either<AuthError, String> =
authDisabledError.left()
private companion object {
const val AUTH_DISABLED_MESSAGE = "Auth disabled in offline build"
}
}