Skip to content

[#158] 앱의 로그인이 풀릴 때마다 UserDefaults에 저장되어 있는 데이터를 모두 제거하도록 구현한다#171

Merged
opficdev merged 1 commit intodevelopfrom
feat/#158-UserDefaults
Mar 3, 2026
Merged

[#158] 앱의 로그인이 풀릴 때마다 UserDefaults에 저장되어 있는 데이터를 모두 제거하도록 구현한다#171
opficdev merged 1 commit intodevelopfrom
feat/#158-UserDefaults

Conversation

@opficdev
Copy link
Copy Markdown
Owner

@opficdev opficdev commented Mar 3, 2026

@opficdev opficdev self-assigned this Mar 3, 2026
@gemini-code-assist
Copy link
Copy Markdown
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은 사용자가 앱에서 로그아웃할 때 UserDefaults에 저장된 모든 사용자 관련 데이터를 자동으로 삭제하는 중요한 보안 기능을 구현합니다. 이는 세션 종료 후 민감한 정보가 기기에 남아있지 않도록 하여 데이터 프라이버시와 보안을 강화하는 데 목적이 있습니다.

Highlights

  • UserDefaults 데이터 제거 로직 추가: 사용자가 앱에서 로그아웃할 때 UserDefaults에 저장된 모든 데이터를 자동으로 제거하는 로직이 구현되었습니다.
  • UserDefaultsStore 의존성 주입: AuthSessionRepositoryImpl이 UserDefaultsStore에 접근할 수 있도록 의존성이 주입되었습니다.
  • UserDefaultsStore에 removeAll() 메서드 추가: UserDefaultsStore 클래스에 앱의 모든 UserDefaults 데이터를 지울 수 있는 removeAll() 메서드가 추가되었습니다.
Changelog
  • DevLog/App/Assembler/DataAssembler.swift
    • AuthSessionRepositoryImpl의 초기화 시 UserDefaultsStore 의존성을 추가했습니다.
  • DevLog/Data/Repository/AuthSessionRepositoryImpl.swift
    • UserDefaultsStore 의존성을 추가하고, 로그아웃 시 UserDefaults 데이터를 모두 제거하는 로직을 구현했습니다.
  • DevLog/Storage/Persistence/UserDefaultsStore.swift
    • UserDefaults에 저장된 모든 데이터를 제거하는 removeAll() 메서드를 추가했습니다.
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
Copy Markdown
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

로그아웃 시 UserDefaults에 저장된 모든 데이터를 제거하는 기능을 구현하셨네요. AuthSessionRepository에서 로그아웃 상태가 되면 UserDefaultsStoreremoveAll()을 호출하여 모든 데이터를 삭제하는 방식입니다. 구현 자체는 명확하고 요구사항을 잘 반영하고 있습니다. 다만, removePersistentDomain을 사용하여 UserDefaults의 모든 데이터를 삭제하는 것은 앱의 테마 설정이나 온보딩 확인 여부 등 사용자의 세션과 무관한 정보까지 모두 초기화시킬 수 있습니다. 이 동작이 의도된 것이 아니라면, 로그아웃 시 삭제가 필요한 데이터의 키(key)만 선별적으로 제거하는 방식을 고려해보는 것이 좋을 것 같습니다. 또한, removePersistentDomain 호출 후 변경사항을 즉시 반영하기 위해 synchronize()를 호출하는 것을 제안하는 리뷰 코멘트를 남겼습니다.


func removeAll() {
guard let bundleIdentifier = Bundle.main.bundleIdentifier else { return }
userDefaults.removePersistentDomain(forName: bundleIdentifier)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

removePersistentDomain(forName:) 메서드 호출 후에는 변경 사항이 즉시 반영되지 않을 수 있습니다. Apple의 removePersistentDomain(forName:) 공식 문서에서는 이 메서드 호출 후 synchronize()를 호출하여 변경 사항을 디스크에 동기화할 것을 권장하고 있습니다. 로그아웃 시 사용자 데이터가 즉시 확실하게 삭제되도록 보장하기 위해 synchronize() 호출을 추가하는 것이 더 안전합니다.

        userDefaults.removePersistentDomain(forName: bundleIdentifier)
        userDefaults.synchronize()

@opficdev opficdev merged commit 4a631f6 into develop Mar 3, 2026
1 check passed
@opficdev opficdev deleted the feat/#158-UserDefaults branch March 3, 2026 09:06
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.

FirebaseAuth의 currentUser가 nil로 될 때마다 UserDefaults에 저장되어 있는 데이터를 모두 제거하도록 구현한다

1 participant