-
Notifications
You must be signed in to change notification settings - Fork 0
[Refactor] 새로운 버전에 대한 선택적 업데이트 로직 수정 #265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- 새로운 버전의 patch가 달라졌을 때, 무조건 한 번 보여지도록 대응
|
""" Walkthrough선택적 업데이트 알림의 노출 여부를 버전별로 추적하도록 로직이 변경되었습니다. UserDefaults의 저장 방식이 불리언 플래그에서 마지막으로 본 버전 문자열로 대체되었으며, 관련 저장소 및 프로토콜, 목 구현, 그리고 유스케이스에서 모두 버전 정보를 인자로 받도록 메서드 시그니처가 수정되었습니다. Changes
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
Assessment against linked issues
Assessment against linked issues: Out-of-scope changes(해당 사항 없음) 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
📒 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를 반환하여 알림이 표시되도록 하는 로직이 적절합니다.
| func hasSeenOptionalAlert(for version: String) -> Bool | ||
| func markOptionalAlertShown(for version: String) |
There was a problem hiding this comment.
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 swiftLength 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" |
There was a problem hiding this comment.
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 swiftLength 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.
youz2me
left a comment
There was a problem hiding this 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 { | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
빈 줄 삭제해도 될 것 같아요!
[Refactor] 새로운 버전에 대한 선택적 업데이트 로직 수정
👻 PULL REQUEST
📄 작업 내용
✅ 이번 PR에서 이런 부분을 중점적으로 체크해주세요!
잠깐 확인하고 갈까요?
들여쓰기를 5번 이하로 준수했는지, 코드 가독성이 적절한지 확인해주세요.
한 줄당 120자 제한을 준수했는지 확인해주세요.
반복되는 상수 값이 있는지, 있다면 Constant enum으로 분리되어 있는지 확인해주세요.
삼항 연산자가 길어질 경우 적절히 개행되어 있는지 확인해주세요.
조건문에서 중괄호가 올바르게 사용되었는지 확인해주세요.
라이브러리 import가 퍼스트파티와 서드파티로 구분되고 알파벳순으로 정렬되었는지 확인해주세요.
용량이 큰 리소스나 호출되지 않을 가능성이 있는 프로퍼티에 lazy var가 적절히 사용되었는지 확인해주세요.
메모리 누수 방지를 위한 weak 참조가 필요한 곳에 적용되었는지 확인해주세요.
도메인 로직과 UI 로직이 적절히 분리되어 있는지 확인해주세요.
🔗 연결된 이슈
Summary by CodeRabbit
신규 기능
리팩터