Skip to content

[#245] 소셜 로그인을 취소했을 때 오류 얼럿이 뜨는 현상을 해결한다#248

Merged
opficdev merged 4 commits intodevelopfrom
fix/#245-login-cancel
Mar 11, 2026
Merged

[#245] 소셜 로그인을 취소했을 때 오류 얼럿이 뜨는 현상을 해결한다#248
opficdev merged 4 commits intodevelopfrom
fix/#245-login-cancel

Conversation

@opficdev
Copy link
Owner

@opficdev opficdev self-assigned this Mar 11, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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은 사용자가 소셜 로그인을 취소했을 때 오류 얼럿이 잘못 표시되는 문제를 해결합니다. 오류 정의를 DataLayerErrorInfraLayerError로 분리하고, 소셜 로그인 취소 여부를 판단하는 로직을 추가하여 사용자 경험을 개선했습니다. 이제 사용자가 로그인을 취소하면 오류 메시지 대신 자연스럽게 이전 상태로 돌아가게 됩니다.

Highlights

  • 오류 처리 구조 개선: 오류 정의를 계층화하기 위해 DataLayerError.swiftInfraLayerError.swift를 도입하여 오류 처리 구조를 개선했습니다.
  • 소셜 로그인 취소 감지 로직 추가: Apple, Github, Google 소셜 로그인 취소 여부를 감지하는 isSocialLoginCancelled 확장 기능을 Error 프로토콜에 추가했습니다.
  • 소셜 로그인 취소 시 오류 얼럿 방지: LoginViewModel에서 사용자가 소셜 로그인을 취소했을 때 불필요한 오류 얼럿이 표시되지 않도록 예외 처리 로직을 수정했습니다.
  • Github 인증 서비스 오류 타입 업데이트: GithubAuthenticationService에서 OAuth 상태 불일치 및 웹 인증 세션 시작 실패 시 새로운 SocialLoginError 타입을 사용하도록 업데이트했습니다.
  • 공통 유틸리티 파일 재구성: Logger.swiftTopViewControllerProvider.swift 파일을 Util 디렉토리에서 Common 디렉토리로 이동하여 인프라 계층의 공통 유틸리티를 재구성했습니다.
Changelog
  • DevLog/Data/Common/DataLayerError.swift
    • Error+.swift 파일의 이름을 DataLayerError.swift로 변경했습니다.
    • FirestoreErrorUIError 열거형을 제거했습니다.
  • DevLog/Infra/Common/InfraLayerError.swift
    • 새로운 파일을 추가했습니다.
    • FirestoreError, UIError, EmailFetchError 열거형을 포함하도록 정의했습니다.
    • 새로운 SocialLoginError 열거형을 추가했습니다.
    • Error 프로토콜에 isSocialLoginCancelled 계산 속성을 추가하여 Apple, Github, Google 소셜 로그인 취소 여부를 확인할 수 있도록 했습니다.
  • DevLog/Infra/Common/Logger.swift
    • DevLog/Infra/Util/Logger.swift 파일의 이름을 DevLog/Infra/Common/Logger.swift로 변경했습니다.
  • DevLog/Infra/Common/TopViewControllerProvider.swift
    • DevLog/Infra/Util/TopViewControllerProvider.swift 파일의 이름을 DevLog/Infra/Common/TopViewControllerProvider.swift로 변경했습니다.
  • DevLog/Infra/Service/SocialLogin/EmailFetchError.swift
    • EmailFetchError.swift 파일을 제거했습니다. 해당 내용은 InfraLayerError.swift로 이동되었습니다.
  • DevLog/Infra/Service/SocialLogin/GithubAuthenticationService.swift
    • OAuth 상태 불일치 및 웹 인증 세션 시작 실패 시 URLError(.userCancelledAuthentication) 대신 SocialLoginError.invalidOAuthStateSocialLoginError.failedToStartWebAuthenticationSession를 사용하도록 수정했습니다.
  • DevLog/Presentation/ViewModel/LoginViewModel.swift
    • GoogleSignIn 임포트를 제거했습니다.
    • 소셜 로그인 실패 시 error.isSocialLoginCancelled를 확인하여 사용자가 로그인을 취소한 경우 오류 얼럿을 표시하지 않도록 로직을 추가했습니다.
Activity
  • 이 PR에 대한 특별한 활동 내역은 없습니다.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

이 PR은 소셜 로그인 취소 시 불필요한 오류 얼럿이 표시되는 문제를 해결하고, 전반적인 코드 구조를 개선하는 좋은 변경사항을 담고 있습니다.
주요 변경 내용은 다음과 같습니다:

  • Error 확장을 통해 소셜 로그인 취소 여부를 확인하는 isSocialLoginCancelled 프로퍼티를 추가하여, 사용자가 로그인을 취소했을 때 오류 얼럿이 뜨지 않도록 LoginViewModel의 로직을 수정했습니다.
  • 각 레이어(Data, Infra)에 맞는 오류 타입을 별도 파일로 분리하고, 관련 없는 오류 타입들을 제거하여 코드 구조를 명확하게 개선했습니다.
  • GithubAuthenticationService에서 사용되던 제네릭한 URLError를 더 구체적인 SocialLoginError로 교체하여 오류 처리를 명확하게 했습니다.

전반적으로 코드의 안정성과 유지보수성을 높이는 훌륭한 리팩토링입니다. 한 가지 가독성 개선을 위한 제안 사항이 있습니다.

Comment on lines +38 to +53
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
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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
        }
    }

@opficdev opficdev merged commit 061f365 into develop Mar 11, 2026
1 check passed
@opficdev opficdev deleted the fix/#245-login-cancel branch March 11, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

소셜 로그인을 취소했을때 오류 얼럿이 뜨는 현상을 해결한다

1 participant