-
Notifications
You must be signed in to change notification settings - Fork 1
[soonny/week6] 7주차 과제 #26
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
base: soonny/main
Are you sure you want to change the base?
Conversation
jayn2u
left a comment
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.
네트워크는 많이 사면 많이 할수록 많이 배우는 것 같아요!
|
|
||
| let loginView = LoginView() | ||
|
|
||
| let loginViewModel = LoginViewModel() // 뷰모델 인스턴스 생성 |
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.
MVC 아키텍처에서는 ViewModel이라는 키워드를 사용하지 않아요! 만약 MVVM에서 말하는 ViewModel이 아니라면 다르게 이름을 바꾸는 것을 추천합니다.
| @objc func handleKakaoLoginButtonTapped() { | ||
| // 카카오톡 설치 여부에 따라 로그인 진행 방식 결정 | ||
| if UserApi.isKakaoTalkLoginAvailable() { | ||
| UserApi.shared.loginWithKakaoTalk { (oauthToken, error) in | ||
| if let error = error { | ||
| print("카카오톡 로그인 에러: \(error.localizedDescription)") | ||
| self.showAlert(title: "로그인 오류", message: "카카오톡 로그인 중 오류가 발생했습니다.") | ||
| } else { | ||
| print("카카오톡 로그인 성공") | ||
| if let token = oauthToken?.accessToken { | ||
| self.saveTokenToKeychain(token: token) | ||
| } | ||
| self.fetchUserNickname() | ||
| self.navigateToMainTabBarController() | ||
| } | ||
| } | ||
| } else { | ||
| UserApi.shared.loginWithKakaoAccount { (oauthToken, error) in | ||
| if let error = error { | ||
| print("카카오 계정 로그인 에러: \(error.localizedDescription)") | ||
| self.showAlert(title: "로그인 오류", message: "카카오 계정 로그인 중 오류가 발생했습니다.") | ||
| } else { | ||
| print("카카오 계정 로그인 성공") | ||
| if let token = oauthToken?.accessToken { | ||
| self.saveTokenToKeychain(token: token) | ||
| } | ||
| self.fetchUserNickname() | ||
| self.navigateToMainTabBarController() | ||
| } | ||
| } | ||
| } | ||
| } |
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.
좋습니다. 네트워크 통신에 있어서 해당 코드가 가장 핵심이에요. 스터디 때 다른 사람들을 위해서 공유해주었으면 좋겠어요!
jayn2u
left a comment
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.
API KEY는 민감한 정보라서 절대 공유하면 안돼요.
|
|
||
|
|
||
| // Kakao SDK 초기화 | ||
| KakaoSDK.initSDK(appKey: "2c8ab94e144d90c1bb9598fb2443dea1") |
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.
API KEY를 퍼블릭 레포지토리로 공유하는 건 절대 하면 안돼요!
iOS Pull Request
주차별 학습내용 기록
궁금한 점 & 스터디원들과 의논해보고 싶은 점
체크리스트
main브랜치로 병합하는 것을 확인했습니까?시연영상