Skip to content

Commit

Permalink
style: ktLint 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
kimhm0728 committed Jan 6, 2025
1 parent cd426e3 commit 823a1c8
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,49 +15,49 @@ import com.mulberry.ody.domain.model.AuthToken
import javax.inject.Inject

class KakaoRemoteAuthDataSource
@Inject
constructor(
private val loginService: LoginService,
private val authService: AuthService,
private val refreshTokenService: RefreshTokenService,
private val kakaoOAuthLoginService: KakaoOAuthLoginService,
) : RemoteAuthDataSource {
override suspend fun isLoggedIn(): Boolean {
return kakaoOAuthLoginService.isLoggedIn()
}

override suspend fun postAuthToken(): ApiResult<AuthToken> {
return refreshTokenService.postRefreshToken().map {
it.toAuthToken()
@Inject
constructor(
private val loginService: LoginService,
private val authService: AuthService,
private val refreshTokenService: RefreshTokenService,
private val kakaoOAuthLoginService: KakaoOAuthLoginService,
) : RemoteAuthDataSource {
override suspend fun isLoggedIn(): Boolean {
return kakaoOAuthLoginService.isLoggedIn()
}
}

override suspend fun login(
fcmToken: String,
context: Context,
): ApiResult<AuthToken> {
val loginResult =
kakaoOAuthLoginService.login(context).toApiResult()
.map { LoginRequest(fcmToken, it.providerId, it.nickname, it.imageUrl) }
override suspend fun postAuthToken(): ApiResult<AuthToken> {
return refreshTokenService.postRefreshToken().map {
it.toAuthToken()
}
}

return loginResult.flatMap { loginRequest ->
loginService.postLoginWithKakao(loginRequest).map { it.toAuthToken() }
override suspend fun login(
fcmToken: String,
context: Context,
): ApiResult<AuthToken> {
val loginResult =
kakaoOAuthLoginService.login(context).toApiResult()
.map { LoginRequest(fcmToken, it.providerId, it.nickname, it.imageUrl) }

return loginResult.flatMap { loginRequest ->
loginService.postLoginWithKakao(loginRequest).map { it.toAuthToken() }
}
}
}

override suspend fun logout(): ApiResult<Unit> {
val kakaoLogoutResult = kakaoOAuthLoginService.logout()
val odyLogoutResult = authService.postLogout()
override suspend fun logout(): ApiResult<Unit> {
val kakaoLogoutResult = kakaoOAuthLoginService.logout()
val odyLogoutResult = authService.postLogout()

val exception = kakaoLogoutResult.exceptionOrNull()
if (exception != null) {
return ApiResult.Unexpected(exception)
}
val exception = kakaoLogoutResult.exceptionOrNull()
if (exception != null) {
return ApiResult.Unexpected(exception)
}

return odyLogoutResult
}
return odyLogoutResult
}

override suspend fun withdraw(): ApiResult<Unit> {
return authService.deleteMember()
override suspend fun withdraw(): ApiResult<Unit> {
return authService.deleteMember()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.mulberry.ody.data.remote.core.service

import com.mulberry.ody.data.remote.core.entity.login.request.LoginRequest
import com.mulberry.ody.data.remote.core.entity.login.response.LoginResponse
import com.mulberry.ody.domain.apiresult.ApiResult
import retrofit2.http.Body
import retrofit2.http.POST

interface LoginService {
@POST("/v1/auth/kakao")
suspend fun postLoginWithKakao(
@Body loginRequest: LoginRequest,
): ApiResult<LoginResponse>
}

0 comments on commit 823a1c8

Please sign in to comment.