Skip to content

Conversation

@JinUng41
Copy link
Collaborator

@JinUng41 JinUng41 commented Jul 14, 2025

👻 PULL REQUEST

📄 작업 내용

  • 새로운 버전의 patch 숫자가 달라진 경우, 무조건 한 번 업데이트 안내가 보여지도록 수정하였습니다.

✅ 이번 PR에서 이런 부분을 중점적으로 체크해주세요!

  • MARK 주석이 정해진 순서와 형식에 맞게 작성되었는지 확인해주세요.
잠깐 확인하고 갈까요?
  • 들여쓰기를 5번 이하로 준수했는지, 코드 가독성이 적절한지 확인해주세요.

  • 한 줄당 120자 제한을 준수했는지 확인해주세요.

  • 반복되는 상수 값이 있는지, 있다면 Constant enum으로 분리되어 있는지 확인해주세요.

  • 삼항 연산자가 길어질 경우 적절히 개행되어 있는지 확인해주세요.

  • 조건문에서 중괄호가 올바르게 사용되었는지 확인해주세요.

  • 라이브러리 import가 퍼스트파티와 서드파티로 구분되고 알파벳순으로 정렬되었는지 확인해주세요.

  • 용량이 큰 리소스나 호출되지 않을 가능성이 있는 프로퍼티에 lazy var가 적절히 사용되었는지 확인해주세요.

  • 메모리 누수 방지를 위한 weak 참조가 필요한 곳에 적용되었는지 확인해주세요.

  • 도메인 로직과 UI 로직이 적절히 분리되어 있는지 확인해주세요.

🔗 연결된 이슈

Summary by CodeRabbit

  • 신규 기능

    • 선택적 업데이트 알림이 버전별로 표시 여부를 개별적으로 추적하도록 개선되었습니다.
  • 리팩터

    • 앱 버전 정보를 문자열로 표현하는 기능이 추가되었습니다.
    • 선택적 업데이트 알림 관련 메서드가 버전 정보를 매개변수로 받도록 변경되었습니다.

- 새로운 버전의 patch가 달라졌을 때, 무조건 한 번 보여지도록 대응
@JinUng41 JinUng41 requested a review from youz2me July 14, 2025 05:36
@JinUng41 JinUng41 self-assigned this Jul 14, 2025
@JinUng41 JinUng41 added the ♻️ refactor 기존 코드를 리팩토링하거나 수정하는 등 사용 (생산적인 경우) label Jul 14, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 14, 2025

"""

Walkthrough

선택적 업데이트 알림의 노출 여부를 버전별로 추적하도록 로직이 변경되었습니다. UserDefaults의 저장 방식이 불리언 플래그에서 마지막으로 본 버전 문자열로 대체되었으며, 관련 저장소 및 프로토콜, 목 구현, 그리고 유스케이스에서 모두 버전 정보를 인자로 받도록 메서드 시그니처가 수정되었습니다.

Changes

파일/경로 그룹 변경 요약
Wable-iOS/Data/RepositoryImpl/UpdateAlertPolicyRepositoryImpl.swift, Wable-iOS/Domain/RepositoryInterface/UpdateAlertPolicyRepository.swift, Wable-iOS/Domain/UseCase/AppVersion/CheckAppUpdateRequirementUseCase.swift 선택적 업데이트 알림 노출 여부 확인 및 기록 메서드가 버전 문자열을 인자로 받도록 시그니처 변경, UserDefaults 저장 키와 값 타입 변경, 관련 로직 수정
Wable-iOS/Domain/Entity/AppVersion.swift AppVersion 구조체가 CustomStringConvertible 프로토콜을 채택하고 description 프로퍼티 추가

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant UpdateAlertPolicyRepository

    User->>App: 앱 실행/업데이트 확인
    App->>UpdateAlertPolicyRepository: hasSeenOptionalAlert(for: version)
    UpdateAlertPolicyRepository-->>App: Boolean (해당 버전 알림 노출 여부)
    App->>User: 알림 표시 여부 결정
    alt 알림 표시 후
        App->>UpdateAlertPolicyRepository: markOptionalAlertShown(for: version)
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
선택적 업데이트에서 취소를 눌렀을 때의 로직에서 새로운 업데이트가 발생했을 때를 대응 (#264)

Assessment against linked issues: Out-of-scope changes

(해당 사항 없음)
"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d29aa2 and d55150d.

📒 Files selected for processing (1)
  • Wable-iOS/Data/RepositoryImpl/UpdateAlertPolicyRepositoryImpl.swift (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Wable-iOS/Data/RepositoryImpl/UpdateAlertPolicyRepositoryImpl.swift
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or `` to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8efb1e4 and 2d29aa2.

📒 Files selected for processing (4)
  • Wable-iOS/Data/RepositoryImpl/UpdateAlertPolicyRepositoryImpl.swift (1 hunks)
  • Wable-iOS/Domain/Entity/AppVersion.swift (1 hunks)
  • Wable-iOS/Domain/RepositoryInterface/UpdateAlertPolicyRepository.swift (1 hunks)
  • Wable-iOS/Domain/UseCase/AppVersion/CheckAppUpdateRequirementUseCase.swift (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
Wable-iOS/Domain/RepositoryInterface/UpdateAlertPolicyRepository.swift (1)
Wable-iOS/Data/RepositoryImpl/UpdateAlertPolicyRepositoryImpl.swift (4)
  • hasSeenOptionalAlert (20-22)
  • hasSeenOptionalAlert (32-34)
  • markOptionalAlertShown (24-26)
  • markOptionalAlertShown (36-36)
Wable-iOS/Domain/UseCase/AppVersion/CheckAppUpdateRequirementUseCase.swift (1)
Wable-iOS/Data/RepositoryImpl/UpdateAlertPolicyRepositoryImpl.swift (4)
  • hasSeenOptionalAlert (20-22)
  • hasSeenOptionalAlert (32-34)
  • markOptionalAlertShown (24-26)
  • markOptionalAlertShown (36-36)
🔇 Additional comments (7)
Wable-iOS/Domain/Entity/AppVersion.swift (2)

10-10: CustomStringConvertible 프로토콜 준수 추가 승인

버전별 업데이트 알림 추적을 위한 프로토콜 준수가 적절합니다.


15-17: 버전 문자열 형식 구현이 정확함

"major.minor.patch" 형식의 표준적인 버전 문자열을 반환하는 구현이 올바릅니다. 다른 파일들에서 사용되는 버전 추적 로직과 일치합니다.

Wable-iOS/Domain/UseCase/AppVersion/CheckAppUpdateRequirementUseCase.swift (2)

33-33: 버전별 알림 확인 로직 개선 승인

appStoreVersion.description을 사용한 버전별 추적이 올바르게 구현되었습니다. 이전의 전역 불리언 플래그에서 버전별 추적으로 개선되어 PR 목표에 부합합니다.


38-39: 버전별 알림 표시 마킹 로직 승인

선택적 업데이트가 필요하고 아직 해당 버전에 대해 알림을 보지 않은 경우에만 버전 정보를 저장하는 로직이 정확합니다.

Wable-iOS/Data/RepositoryImpl/UpdateAlertPolicyRepositoryImpl.swift (3)

20-21: 버전별 확인 로직 구현 승인

문자열 비교를 통한 버전별 알림 확인 로직이 정확합니다. userDefaults.string(forKey:) == version 비교가 안전하고 직관적입니다.


24-25: 버전 문자열 저장 로직 승인

선택적 알림이 표시된 버전을 문자열로 저장하는 로직이 올바릅니다. 이를 통해 패치 버전별 추적이 가능해집니다.


32-36: Mock 구현 업데이트 승인

Mock 구현이 새로운 메서드 시그니처에 맞게 일관되게 업데이트되었습니다. 테스트에서 항상 false를 반환하여 알림이 표시되도록 하는 로직이 적절합니다.

Comment on lines +11 to +12
func hasSeenOptionalAlert(for version: String) -> Bool
func markOptionalAlertShown(for version: String)
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

버전별 추적을 위한 메서드 시그니처 변경 승인

version 파라미터 추가로 패치 버전별 업데이트 알림 추적이 가능해졌습니다. 파라미터명 for가 Swift 네이밍 컨벤션에 적합합니다.

구현체와 사용처의 일관성을 확인하기 위해 다음 스크립트를 실행해보세요:


🏁 Script executed:

#!/bin/bash
# Description: 프로토콜 메서드 시그니처 변경이 모든 구현체와 사용처에 일관되게 적용되었는지 확인

# 이전 메서드 시그니처가 남아있는지 확인
rg -A 2 "hasSeenOptionalAlert\(\)" --type swift
rg -A 2 "markOptionalAlertShown\(\)" --type swift

# 새로운 메서드 시그니처 사용 확인
rg -A 2 "hasSeenOptionalAlert\(for" --type swift
rg -A 2 "markOptionalAlertShown\(for" --type swift

Length of output: 2674


메서드 시그니처 변경 검증 완료 및 중복 구현 제거 필요

새로운 시그니처(hasSeenOptionalAlert(for:), markOptionalAlertShown(for:))가 프로토콜, UseCase, 실제 구현체 전반에 일관되게 적용된 것이 확인되었습니다.
다만, UpdateAlertPolicyRepositoryImpl.swift에 동일 시그니처의 빈(stub) 구현이 중복으로 남아 있어 컴파일 충돌 또는 의도치 않은 동작을 일으킬 수 있습니다. 아래 중복 구현을 제거해주세요.

• Wable-iOS/Data/RepositoryImpl/UpdateAlertPolicyRepositoryImpl.swift

  • func hasSeenOptionalAlert(for version: String) -> Bool { return false }
  • func markOptionalAlertShown(for version: String) {}
🤖 Prompt for AI Agents
In Wable-iOS/Data/RepositoryImpl/UpdateAlertPolicyRepositoryImpl.swift around
lines where the methods hasSeenOptionalAlert(for:) and
markOptionalAlertShown(for:) are defined, remove the duplicate stub
implementations that return false or do nothing. These duplicate empty
implementations conflict with the updated method signatures and can cause
compile errors or unintended behavior. Ensure only the correct, updated
implementations remain in the file.

final class UpdateAlertPolicyRepositoryImpl: UpdateAlertPolicyRepository {

private static let key = "OptionalUpdateAlertShown"
private static let key = "lastSeenOptionalUpdateVersion"
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

UserDefaults 키 변경에 따른 데이터 마이그레이션 고려 필요

키 이름이 "OptionalUpdateAlertShown"에서 "lastSeenOptionalUpdateVersion"으로 변경되어 기존 사용자의 설정이 초기화됩니다. 이는 패치 버전 업데이트 시 한 번은 알림을 보여주는 PR 목표에는 부합하지만, 명시적인 마이그레이션 로직을 고려해볼 수 있습니다.

기존 키의 잔여 데이터를 확인하기 위해 다음 스크립트를 실행해보세요:


🏁 Script executed:

#!/bin/bash
# Description: 기존 UserDefaults 키 사용 여부 확인

# 이전 키 "OptionalUpdateAlertShown" 사용 확인
rg "OptionalUpdateAlertShown" --type swift

# 새로운 키 사용 확인
rg "lastSeenOptionalUpdateVersion" --type swift

Length of output: 219


기존 UserDefaults 데이터 마이그레이션 로직 추가 필요

현재 "OptionalUpdateAlertShown" 키로 저장된 불리언 값이 삭제되어, 업데이트 전 사용자 설정이 초기화됩니다. 다음과 같이 마이그레이션 로직을 추가해주세요.

  • Wable-iOS/Data/RepositoryImpl/UpdateAlertPolicyRepositoryImpl.swift
    • 12번 줄: private static let key = "lastSeenOptionalUpdateVersion" 바로 위에
    private static let oldKey = "OptionalUpdateAlertShown" 추가
    hasSeenOptionalAlert(version:) 또는 초기화 시점에 기존 키를 체크하여 새 키로 변환

예시 diff:

--- a/Data/RepositoryImpl/UpdateAlertPolicyRepositoryImpl.swift
+++ b/Data/RepositoryImpl/UpdateAlertPolicyRepositoryImpl.swift
@@ -11,6 +11,7 @@ class UpdateAlertPolicyRepositoryImpl: UpdateAlertPolicyRepository {
     private let userDefaults: UserDefaults
     
+    private static let oldKey = "OptionalUpdateAlertShown"
     private static let key = "lastSeenOptionalUpdateVersion"
     
     init(userDefaults: UserDefaults = .standard) {
@@ -18,6 +19,17 @@ class UpdateAlertPolicyRepositoryImpl: UpdateAlertPolicyRepository {
     }
     
     func hasSeenOptionalAlert(version: String) -> Bool {
+        // 마이그레이션: 이전 키에 true가 남아 있으면 현 버전으로 간주하고 새 키로 이관
+        if userDefaults.string(forKey: Self.key) == nil,
+           userDefaults.bool(forKey: Self.oldKey) {
+            userDefaults.set(version, forKey: Self.key)
+            return true
+        }
+
         return userDefaults.string(forKey: Self.key) == version
     }
     
+    // Optional: markOptionalAlertShown에서도 oldKey 제거 로직 추가 가능
     func markOptionalAlertShown(version: String) {
         userDefaults.set(version, forKey: Self.key)
     }

위와 같이 구현하면 기존 사용자 설정을 유지하면서 신규 로직으로 자연스럽게 이관됩니다.

🤖 Prompt for AI Agents
In Wable-iOS/Data/RepositoryImpl/UpdateAlertPolicyRepositoryImpl.swift at line
12, add a new static constant oldKey with the value "OptionalUpdateAlertShown"
just above the existing key declaration. Then, update the
hasSeenOptionalAlert(version:) method or the initialization logic to check if
the oldKey exists in UserDefaults; if it does, migrate its boolean value to the
new key format and remove the oldKey entry. This ensures existing user settings
are preserved and transitioned smoothly to the new key.

Copy link
Member

@youz2me youz2me left a comment

Choose a reason for hiding this comment

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

대면으로 여쭤볼 건 여쭤봐서 서면으로는 길게 남기지 않을게요 ㅎㅎ 고생하셨습니다 ~!!!

@@ -9,29 +9,29 @@ import Foundation

final class UpdateAlertPolicyRepositoryImpl: UpdateAlertPolicyRepository {

Copy link
Member

Choose a reason for hiding this comment

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

빈 줄 삭제해도 될 것 같아요!

@github-project-automation github-project-automation bot moved this to In Review in Wable-iOS Jul 14, 2025
@JinUng41 JinUng41 merged commit 4e4ff3f into develop Jul 14, 2025
1 check was pending
@JinUng41 JinUng41 deleted the refactor/#264-optional-update-alert branch July 14, 2025 06:35
@github-project-automation github-project-automation bot moved this from In Review to Done in Wable-iOS Jul 14, 2025
youz2me pushed a commit that referenced this pull request Oct 26, 2025
[Refactor] 새로운 버전에 대한 선택적 업데이트 로직 수정
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

♻️ refactor 기존 코드를 리팩토링하거나 수정하는 등 사용 (생산적인 경우)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Refactor] 선택적 업데이트 로직 수정

3 participants