[#378] Github email을 받아오는 방법과 비공개 해놓았을 경우 얼럿에 해당 내용이 뜨도록 개선한다#380
Merged
[#378] Github email을 받아오는 방법과 비공개 해놓았을 경우 얼럿에 해당 내용이 뜨도록 개선한다#380
Conversation
Contributor
There was a problem hiding this comment.
Code Review
이번 풀 리퀘스트는 GitHub 로그인 시 이메일 정보를 안정적으로 확보하기 위해 클라이언트와 Firebase Function의 로직을 개선하고, 이메일 확인 불가 시의 에러 처리 및 알림 UI를 추가했습니다. 주요 피드백으로는 URL 생성 시 런타임 에러 방지를 위한 안전한 언래핑 사용, 클라이언트와 서버 간의 중복된 네트워크 요청 제거를 통한 효율성 제고, 그리고 코드 가독성을 위한 데이터 구조 정의 위치 조정이 포함되었습니다.
| } | ||
|
|
||
| func requestPrimaryVerifiedEmail(accessToken: String) async throws -> String? { | ||
| var request = URLRequest(url: URL(string: "https://api.github.com/user/emails")!) |
Contributor
There was a problem hiding this comment.
URL(string: "...")!를 사용하여 URL을 생성하고 있습니다. 만약 주어진 문자열로 URL을 생성하지 못할 경우, 이 코드는 런타임에 크래시를 발생시킬 수 있습니다. 문자열이 상수이고 올바른 형식이 보장되더라도, 안전한 코딩 관례를 위해 강제 언래핑(force unwrapping)은 피하는 것이 좋습니다.
guard let을 사용하여 URL을 안전하게 생성하고, 실패할 경우 적절한 에러를 던지도록 수정하는 것을 권장합니다.
Suggested change
| var request = URLRequest(url: URL(string: "https://api.github.com/user/emails")!) | |
| guard let url = URL(string: "https://api.github.com/user/emails") else { throw URLError(.badURL) } | |
| var request = URLRequest(url: url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 연관된 이슈
📝 작업 내용
📌 요약
🔍 상세