Skip to content

Commit

Permalink
#219 SignInState -> LoginState 이름 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
pknujsp committed Mar 11, 2024
1 parent db48a95 commit b1754d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.android.mediproject.core.model.sign.LoginParameter
import com.android.mediproject.core.model.sign.SignUpParameter

interface SignRepository {
suspend fun login(loginParameter: LoginParameter): SignInState
suspend fun login(loginParameter: LoginParameter): LoginState
suspend fun signUp(signUpParameter: SignUpParameter): Result<Boolean>

suspend fun signOut()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ internal class SignRepositoryImpl(
override val isSignedIn: Boolean
get() = session != null


override suspend fun login(loginParameter: LoginParameter) = signDataSource.logIn(loginParameter).fold(
onSuccess = {
_session = it.userSession
Expand All @@ -40,21 +39,20 @@ internal class SignRepositoryImpl(
myAccountId = 0L,
)
}
SignInState.Success
LoginState.Success
},
onFailure = {
if (it is UserNotConfirmedException) {
SignInState.NotVerified
LoginState.NotVerified
} else {
SignInState.Failed(it)
LoginState.Failed(it)
}
},
)


override suspend fun signUp(signUpParameter: SignUpParameter): Result<Boolean> {
val result = signDataSource.signUp(signUpParameter)
if (result.isSuccess) {
signDataSource.signUp(signUpParameter).onSuccess {
appDataStore.saveSkipIntro(true)
}
return Result.success(true)
Expand All @@ -67,8 +65,8 @@ internal class SignRepositoryImpl(
}


sealed interface SignInState {
data object Success : SignInState
data object NotVerified : SignInState
data class Failed(val exception: Throwable) : SignInState
sealed interface LoginState {
data object Success : LoginState
data object NotVerified : LoginState
data class Failed(val exception: Throwable) : LoginState
}

0 comments on commit b1754d7

Please sign in to comment.