[#284] 탭뷰에 있는 알림 이미지에 읽지 않은 푸시알림 데이터가 있을 경우 해당 데이터의 갯수를 배지로 보이도록 구현한다#290
[#284] 탭뷰에 있는 알림 이미지에 읽지 않은 푸시알림 데이터가 있을 경우 해당 데이터의 갯수를 배지로 보이도록 구현한다#290
Conversation
opficdev
commented
Mar 17, 2026
- closed 탭뷰에 있는 알림 이미지에 읽지 않은 푸시알림 데이터가 있을 경우 해당 데이터의 갯수를 배지로 보이도록 구현한다 #284
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
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
|
| init( | ||
| observeUnreadPushCountUseCase: ObserveUnreadPushCountUseCase | ||
| ) { | ||
| self.observeUnreadPushCountUseCase = observeUnreadPushCountUseCase | ||
| observeUnreadPushCount() | ||
| } |
| func updateBadgeCount(_ count: Int) { | ||
| UNUserNotificationCenter.current().setBadgeCount(count) { _ in } | ||
| } |
There was a problem hiding this comment.
setBadgeCount의 completion handler에서 오류가 발생할 경우를 대비하여 로깅을 추가하는 것이 좋습니다. 이전 AppDelegate 구현에서는 오류를 로깅했지만, 현재는 무시되고 있습니다. 디버깅을 위해 오류를 기록하는 것을 고려해보세요. MainViewModel에 Logger를 추가하고 다음과 같이 수정할 수 있습니다.
// In MainViewModel
private let logger = Logger(category: "MainViewModel")
// ...
func updateBadgeCount(_ count: Int) {
UNUserNotificationCenter.current().setBadgeCount(count) { [weak self] error in
if let error {
self?.logger.error("Failed to update badge count", error: error)
}
}
}There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7e472ed6db
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if signIn && !viewModel.state.isFirstLaunch { | ||
| MainView() | ||
| MainView(viewModel: MainViewModel( | ||
| observeUnreadPushCountUseCase: container.resolve(ObserveUnreadPushCountUseCase.self) | ||
| )) | ||
| } else { |
There was a problem hiding this comment.
Clear app badge when signed-out flow is shown
Badge updates now only happen through MainViewModel, which is instantiated only in the signed-in branch here; when a user signs out after having unread notifications, MainView is removed and no code path resets the app icon badge to 0. The previous AppDelegate auth-state handler used to clear badges on unauthenticated state, so this change can leave stale badge counts visible on the login screen (and to the next user on shared devices).
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38cd53fb2a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| MainView(viewModel: MainViewModel( | ||
| observeUnreadPushCountUseCase: container.resolve(ObserveUnreadPushCountUseCase.self) | ||
| )) |
There was a problem hiding this comment.
MainViewModel 생성을 body 재평가 경로에서 분리하세요
RootView의 body에서 MainViewModel(...)를 직접 만들면 RootViewModel 상태 변경(세션/테마/네트워크 등)마다 새 인스턴스가 계속 생성됩니다. MainViewModel.init이 즉시 observeUnreadPushCount()를 실행해 Firestore 구독을 시작하므로, 실제로는 MainView의 @State에 채택되지 않고 버려지는 인스턴스에서도 불필요한 리스너 등록/해제가 반복되어 성능과 네트워크 비용이 증가합니다.
Useful? React with 👍 / 👎.
|
❌ iOS CI build failed. Lines containing 'error:': |