[#245] 소셜 로그인을 취소했을 때 오류 얼럿이 뜨는 현상을 해결한다#248
Conversation
opficdev
commented
Mar 11, 2026
- closed 소셜 로그인을 취소했을때 오류 얼럿이 뜨는 현상을 해결한다 #245
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 사용자가 소셜 로그인을 취소했을 때 오류 얼럿이 잘못 표시되는 문제를 해결합니다. 오류 정의를 Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이 PR은 소셜 로그인 취소 시 불필요한 오류 얼럿이 표시되는 문제를 해결하고, 전반적인 코드 구조를 개선하는 좋은 변경사항을 담고 있습니다.
주요 변경 내용은 다음과 같습니다:
Error확장을 통해 소셜 로그인 취소 여부를 확인하는isSocialLoginCancelled프로퍼티를 추가하여, 사용자가 로그인을 취소했을 때 오류 얼럿이 뜨지 않도록LoginViewModel의 로직을 수정했습니다.- 각 레이어(Data, Infra)에 맞는 오류 타입을 별도 파일로 분리하고, 관련 없는 오류 타입들을 제거하여 코드 구조를 명확하게 개선했습니다.
GithubAuthenticationService에서 사용되던 제네릭한URLError를 더 구체적인SocialLoginError로 교체하여 오류 처리를 명확하게 했습니다.
전반적으로 코드의 안정성과 유지보수성을 높이는 훌륭한 리팩토링입니다. 한 가지 가독성 개선을 위한 제안 사항이 있습니다.
| var isSocialLoginCancelled: Bool { | ||
| // Apple 로그인 취소 | ||
| if let authorizationError = self as? ASAuthorizationError { | ||
| return authorizationError.code == .canceled | ||
| } | ||
|
|
||
| // Github 로그인 취소 | ||
| if let webAuthenticationSessionError = self as? ASWebAuthenticationSessionError { | ||
| return webAuthenticationSessionError.code == .canceledLogin | ||
| } | ||
|
|
||
| let error = self as NSError | ||
| // Google 로그인 취소 | ||
| return error.domain == kGIDSignInErrorDomain | ||
| && error.code == GIDSignInError.canceled.rawValue | ||
| } |
There was a problem hiding this comment.
isSocialLoginCancelled 프로퍼티의 가독성을 높이기 위해 switch 문을 사용하는 것을 제안합니다. 여러 if let을 사용하는 현재 구현도 올바르게 동작하지만, switch를 사용하면 다양한 오류 유형을 더 명확하게 구분하고 코드를 더 깔끔하게 만들 수 있습니다.
extension Error {
var isSocialLoginCancelled: Bool {
switch self {
case let authError as ASAuthorizationError:
return authError.code == .canceled
case let webAuthError as ASWebAuthenticationSessionError:
return webAuthError.code == .canceledLogin
default:
let nsError = self as NSError
return nsError.domain == kGIDSignInErrorDomain && nsError.code == GIDSignInError.canceled.rawValue
}
}
}이렇게 변경하면 각 소셜 로그인 서비스별 취소 오류를 명시적으로 처리하는 구조가 되어 향후 다른 소셜 로그인이 추가되더라도 확장하기 용이합니다.
var isSocialLoginCancelled: Bool {
switch self {
case let authError as ASAuthorizationError:
return authError.code == .canceled
case let webAuthError as ASWebAuthenticationSessionError:
return webAuthError.code == .canceledLogin
default:
let nsError = self as NSError
return nsError.domain == kGIDSignInErrorDomain && nsError.code == GIDSignInError.canceled.rawValue
}
}