-
Couldn't load subscription status.
- Fork 1
[#314] 백그라운드 상태에서 앱 재실행 시, 오늘 날짜로 변환안되는 버그 수정 #315
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
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.
Summary of Changes
Hello @Funital, 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은 앱이 백그라운드에서 포그라운드로 전환될 때 날짜 관련 UI 및 데이터가 올바르게 갱신되지 않던 문제를 해결합니다. 앱의 생명주기 내에서 날짜 갱신 로직의 호출 시점을 최적화하고, 해당 날짜에 맞는 데이터와 UI가 즉시 반영되도록 관련 컨트롤러의 동작을 개선하여 사용자 경험의 일관성을 확보했습니다.
Highlights
- 백그라운드 재실행 시 날짜 변환 버그 수정: 앱이 백그라운드 상태에서 재실행될 때 오늘 날짜로 올바르게 변환되지 않던 버그를 수정했습니다.
- checkAndNotifyNewDay() 호출 시점 변경: checkAndNotifyNewDay() 함수 호출 시점을 sceneWillEnterForeground(:)에서 sceneDidBecomeActive(:)로 변경하여, 앱이 완전히 포그라운드에 진입한 후 날짜 갱신 로직이 실행되도록 했습니다.
- CustomTimeTabController 날짜 및 데이터 갱신 로직 추가: CustomTimeTabController에 .didEnterNewDay 알림을 수신하는 옵저버를 추가하여, 새로운 날로 판단될 때 todayDate를 갱신하고, 해당 날짜의 데이터를 불러오며, 시간대별 탭 인덱스를 조정하도록 구현했습니다.
- .gitignore 업데이트: .gitignore 파일에 .idea/ 디렉토리를 추가하여 IntelliJ/Android Studio 관련 파일들이 Git에 추적되지 않도록 했습니다.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| 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 issue 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
-
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. ↩
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.
Code Review
안녕하세요. PR 잘 보았습니다. 백그라운드에서 앱을 다시 실행할 때 날짜가 갱신되지 않는 버그를 수정하신 것을 확인했습니다. SceneDelegate에서 checkAndNotifyNewDay 호출 시점을 sceneDidBecomeActive로 변경하고, CustomTimeTabController에서 didEnterNewDay 알림을 받아 UI와 데이터를 갱신하는 로직을 추가하여 문제를 해결하셨네요. 전반적으로 좋은 수정이라고 생각합니다. 한 가지, CustomTimeTabController의 알림 핸들러에서 중복되는 코드 호출이 있어 이 부분에 대한 개선 의견을 남겼습니다. 확인 부탁드립니다.
| self.pageViewController.setViewControllers([self.viewControllers[initialIndex]], direction: .forward, animated: false) | ||
| self.selectedIndex = initialIndex |
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.
현재 코드에서는 pageViewController.setViewControllers를 호출한 직후 selectedIndex를 설정하고 있습니다. selectedIndex의 didSet 블록에서도 setPage 함수를 통해 setViewControllers를 다시 호출하므로, 결과적으로 setViewControllers가 두 번 호출됩니다.\n\n이는 비효율적이며, didSet에서 처리하는 방향 계산 로직(selectedIndex > oldValue ? .forward : .reverse)을 무시하고 항상 .forward로 설정하는 문제가 있습니다.\n\nselectedIndex 설정만으로 페이지가 업데이트되도록 중복 호출을 제거하는 것이 좋습니다.\n\n만약 백그라운드 복귀 시 애니메이션 없는 전환을 원하신다면, setPage 함수가 animated 파라미터를 받도록 리팩토링하고 didSet 로직을 수정하는 것을 고려해볼 수 있습니다.
| self.pageViewController.setViewControllers([self.viewControllers[initialIndex]], direction: .forward, animated: false) | |
| self.selectedIndex = initialIndex | |
| self.selectedIndex = initialIndex |
|
커밋 컨벤션 안지킨 커밋 뭔가요!!! 🤣 |
astudio로 저도 모르게 실행시키다.. 쓸데없는 파일이 추가되어 당황한 바람에;;🥲 |
| override func viewDidLoad() { | ||
| super.viewDidLoad() | ||
| view.backgroundColor = EATSSUDesignAsset.Color.GrayScale.gray100.color | ||
|
|
||
| // 이미 등록된 옵저버가 있으면 먼저 제거 | ||
| NotificationCenter.default.removeObserver(self, name: .didEnterNewDay, object: nil) | ||
| NotificationCenter.default.addObserver( | ||
| self, | ||
| selector: #selector(handleNewDayNotification(_:)), | ||
| name: .didEnterNewDay, | ||
| object: nil | ||
| ) | ||
| } |
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.
혹시 옵저버 체크하는 로직을 별도의 메서드로 빼서 작성해주실 수 있을까요?
그리고 해당 체크를 옵저버로 관리하는 로직은 좋은 것 같은데 viewDidLoad에 작성하신 이유가 특별히 있을까요?
viewWillAppear에서 설정 메서드 실행
viewWillDisappear에서 제거 메서드 실행
은 어떠신가요!
viewDidLoad는 뭔가 타이밍 문제로 오류 재발 가능성이 있어보입니다!
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.
보이는 동안만 이벤트가 필요한 것이다 보니, 메서드를 분리해서 viewWillAppear/viewWillDisappear에 등록 및 해제하는 방식이 더 좋아보이네요! 이 방식으로 수정을 진행해보겠습니다!
|
메서드 분리 후, 리팩토링 하였습니다! |
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.
고생하셨습니다!
#️⃣ 관련 이슈
Resolved #314
💡작업 내용
checkAndNotifyNewDay()함수를 앱이 백그라운드 → 포그라운드로 들어오는 과정에서, 화면이 보이기 직전에 호출하도록 해주는sceneWillEnterForeground(_:)에서 호출하도록 수정하였습니다.💬리뷰 요구사항(선택)