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

[feat/kakao_login]: 카카오 소셜 로그인, 닉네임 불러오기, 로그아웃 구현 #30

Merged
merged 36 commits into from
Jan 4, 2024

Conversation

kangyuri1114
Copy link
Member

@kangyuri1114 kangyuri1114 commented Jan 2, 2024

개요

작업 사항

  • 카카오 소셜 로그인 기능 작업
    • 로그인
    • 닉네임 반환
    • 로그아웃
  • UI 작업
    • 로그인 화면 진입 시 뷰페이저 구현
    • 인디케이터 구현

변경 사항(optional)

  • 로그인 모듈 새로 생성됨
  • app 모듈 내 샘플 액티비티에서 바로 로그인 액티비티로 이동하도록 임시 구현
  • conflict 해결하면서 온보딩쪽 test 파일 건드려서 빨간줄 뜨는데 확인 해주심 감사하겠습니다.. 빌드는 잘 됩니다.
  • local properties kakaoAppKey 네이밍 변경됨

스크린샷(optional)

_2024_01_03_18_13_35_557.mp4

@kangyuri1114 kangyuri1114 added 💻feat 새로운 기능 추가 🐰유리 유리 작업 labels Jan 2, 2024
@kangyuri1114 kangyuri1114 self-assigned this Jan 2, 2024
@kangyuri1114 kangyuri1114 requested a review from a team as a code owner January 2, 2024 11:53
class LoginViewModel : ViewModel(){

private val _kakaoLoginResult = MutableLiveData<Boolean>()
val kakaoLoginResult: LiveData<Boolean> get() = _kakaoLoginResult
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿!@!@

class UserInfoActivity : AppCompatActivity() {
private lateinit var binding: ActivityUserInfoBinding

private val userInfoViewModel: UserInfoViewModel by viewModels()
Copy link
Collaborator

@jihyun0v0 jihyun0v0 Jan 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

viewModel을 사용한 곳이 안보이는데, 외부 API에서 사용되는 건가요?? 궁금하네요

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아직 뷰모델 코드가 반영이 안되어 있습니답 ㅎ,, 릴리즈 위해서 기능 구현 우선 했습니다

Copy link
Collaborator

@jihyun0v0 jihyun0v0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

강화유리 미쳤다

Copy link
Member

@kez-lab kez-lab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코멘트 확인하시면 바로 머지 진행할게요 고생하셨습니당~!

Comment on lines +64 to +82
private fun loginWithKakaoApp() {
if (UserApiClient.instance.isKakaoTalkLoginAvailable(this)) {
UserApiClient.instance.loginWithKakaoTalk(this) { token, error ->
if (error != null) {
toast("카카오 로그인 실패")
if (error is ClientError && error.reason == ClientErrorCause.Cancelled) {
toast("다시 로그인 해주세요.")
return@loginWithKakaoTalk
}
loginWithKakaoAccount()
} else if (token != null) {
toast("카카오 로그인 성공")
moveToUserInfoActivity()
}
}
} else {
loginWithKakaoAccount()
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요기로직은 추후 관심사 분리가 필요하겠죠!?! 한번 확인해주시고 또 다른 예외상황이 있는지도 확인해주세요~!!!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵! 지금 뷰모델 분리하면서 조금 더 세분화 하고 있고, 예외의 경우도 공식문서에서는 유저가 임의로 로그인을 이탈하거나 취소하는 경우만 나와있어서 그 부분만 구현했는데, 또 다른 경우도 고려해보겠습니다!

Comment on lines +9 to +10
private val _kakaoLoginResult = MutableLiveData<Boolean>()
val kakaoLoginResult: LiveData<Boolean> get() = _kakaoLoginResult
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요 값이 왜 있는지 모르겠네욥?!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

뷰모델 분리하기 위해 세팅만 해두고 아직 코드가 완성되지 않아 올리지 못했습니다 ㅎㅎ.. kakaoLoginResult 라이브 데이터의 결과에 따라 로그인 액티비티에서 분기처리 진행할 예정입니다!

Comment on lines +10 to +38
class LoginViewPagerAdapter(private val imageList: List<DummyImage>) :
RecyclerView.Adapter<LoginViewPagerAdapter.PagerViewHolder>() {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PagerViewHolder {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_login_view_pager, parent, false)
return PagerViewHolder(ItemLoginViewPagerBinding.bind(view))
}

class PagerViewHolder(private val binding: ItemLoginViewPagerBinding) :
RecyclerView.ViewHolder(binding.root) {

fun onBindView(imageInfo: DummyImage) {
binding.run {
ivLoginViewPagerItem.load(imageInfo.Image) {
placeholder(R.drawable.login_sample_rectagle_viewpager)
error(R.drawable.login_sample_rectagle_viewpager)
}
}
}
}

override fun getItemCount(): Int = imageList.size

override fun onBindViewHolder(holder: PagerViewHolder, position: Int) {
val exploreImage = imageList[position]
holder.onBindView(exploreImage)
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요거 리스트 어댑터로 바꿔보시면 좋을 것 같습니다. diffUtil은 ItemDiffCallback 을 사용해주세요~!!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네! 바꾸도록 하겠습니다!

@kangyuri1114 kangyuri1114 merged commit 8fa5212 into develop Jan 4, 2024
1 check passed
@kangyuri1114 kangyuri1114 deleted the feat/kakao_login branch January 4, 2024 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐰유리 유리 작업 💻feat 새로운 기능 추가
Projects
Status: Done
3 participants