-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
class LoginViewModel : ViewModel(){ | ||
|
||
private val _kakaoLoginResult = MutableLiveData<Boolean>() | ||
val kakaoLoginResult: LiveData<Boolean> get() = _kakaoLoginResult |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
viewModel을 사용한 곳이 안보이는데, 외부 API에서 사용되는 건가요?? 궁금하네요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아직 뷰모델 코드가 반영이 안되어 있습니답 ㅎ,, 릴리즈 위해서 기능 구현 우선 했습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
강화유리 미쳤다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
코멘트 확인하시면 바로 머지 진행할게요 고생하셨습니당~!
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() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요기로직은 추후 관심사 분리가 필요하겠죠!?! 한번 확인해주시고 또 다른 예외상황이 있는지도 확인해주세요~!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵! 지금 뷰모델 분리하면서 조금 더 세분화 하고 있고, 예외의 경우도 공식문서에서는 유저가 임의로 로그인을 이탈하거나 취소하는 경우만 나와있어서 그 부분만 구현했는데, 또 다른 경우도 고려해보겠습니다!
private val _kakaoLoginResult = MutableLiveData<Boolean>() | ||
val kakaoLoginResult: LiveData<Boolean> get() = _kakaoLoginResult |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요 값이 왜 있는지 모르겠네욥?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
뷰모델 분리하기 위해 세팅만 해두고 아직 코드가 완성되지 않아 올리지 못했습니다 ㅎㅎ.. kakaoLoginResult 라이브 데이터의 결과에 따라 로그인 액티비티에서 분기처리 진행할 예정입니다!
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) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요거 리스트 어댑터로 바꿔보시면 좋을 것 같습니다. diffUtil은 ItemDiffCallback 을 사용해주세요~!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네! 바꾸도록 하겠습니다!
개요
작업 사항
변경 사항(optional)
스크린샷(optional)
_2024_01_03_18_13_35_557.mp4