Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] 로그인 시 Sentry User 정보 설정 #86

Merged
merged 2 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import kotlinx.serialization.Serializable

@Serializable
data class GetProfileRes(
@SerialName("id")
val id: Long,
@SerialName("email")
val email: String,
@SerialName("profileImageUrl")
val profileImageUrl: String,
@SerialName("name")
val name: String,
@SerialName("nickname")
Expand All @@ -19,6 +25,9 @@ data class GetProfileRes(
) : DataMapper<Profile> {
override fun toDomain(): Profile {
return Profile(
id = id,
email = email,
profileImageUrl = profileImageUrl,
name = name,
nickname = nickname,
gender = gender,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class MockMemberRepository @Inject constructor() : MemberRepository {
randomShortDelay()
return Result.success(
Profile(
id = 0L,
email = "[email protected]",
profileImageUrl = "https://avatars.githubusercontent.com/u/71167956",
name = "김진우",
nickname = "진우에몽",
gender = "male",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ package ac.dnd.bookkeeping.android.domain.model.member
import kotlinx.datetime.LocalDate

data class Profile(
val id: Long,
val email: String,
val profileImageUrl: String,
val name: String,
val nickname: String,
val gender: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ package ac.dnd.bookkeeping.android.domain.usecase.authentication

import ac.dnd.bookkeeping.android.domain.model.legacy.Login
import ac.dnd.bookkeeping.android.domain.repository.AuthenticationRepository
import ac.dnd.bookkeeping.android.domain.usecase.member.GetProfileUseCase
import io.sentry.Sentry
import io.sentry.protocol.User
import javax.inject.Inject

class LoginUseCase @Inject constructor(
private val authenticationRepository: AuthenticationRepository
private val authenticationRepository: AuthenticationRepository,
private val getProfileUseCase: GetProfileUseCase
) {
suspend operator fun invoke(
socialId: Long,
Expand All @@ -14,6 +18,17 @@ class LoginUseCase @Inject constructor(
return authenticationRepository.login(
socialId = socialId,
email = email
)
).onSuccess {
getProfileUseCase().onSuccess { profile ->
Sentry.setUser(
User().apply {
this.id = profile.id.toString()
this.email = profile.email
this.name = profile.name
this.username = profile.nickname
}
)
}.getOrThrow()
}
}
}
Loading