-
Notifications
You must be signed in to change notification settings - Fork 0
[#204] 업데이트 된 FCM 토큰이 Firestore에 남아있는 이슈를 해결한다 #305
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // | ||
| // AppLayerAssembler.swift | ||
| // DevLog | ||
| // | ||
| // Created by opfic on 3/19/26. | ||
| // | ||
|
|
||
| final class AppLayerAssembler: Assembler { | ||
| func assemble(_ container: any DIContainer) { | ||
| container.register(FCMTokenSyncHandler.self) { | ||
| FCMTokenSyncHandler( | ||
| repository: container.resolve(UserDataRepository.self) | ||
| ) | ||
| } | ||
| container.register(UserTimeZoneSyncHandler.self) { | ||
| UserTimeZoneSyncHandler( | ||
| repository: container.resolve(UserDataRepository.self) | ||
| ) | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // | ||
| // FCMTokenSyncHandler.swift | ||
| // DevLog | ||
| // | ||
| // Created by opfic on 3/19/26. | ||
| // | ||
|
|
||
| import Combine | ||
| import Foundation | ||
|
|
||
| final class FCMTokenSyncHandler { | ||
| private let repository: UserDataRepository | ||
| private let logger = Logger(category: "FCMTokenSyncHandler") | ||
| private var cancellables = Set<AnyCancellable>() | ||
|
|
||
| init( | ||
| repository: UserDataRepository, | ||
| notificationCenter: NotificationCenter = .default | ||
| ) { | ||
| self.repository = repository | ||
|
|
||
| notificationCenter.publisher(for: .didRefreshFCMToken) | ||
| .compactMap { $0.userInfo?["fcmToken"] as? String } | ||
| .sink { [weak self] fcmToken in | ||
| Task { | ||
| do { | ||
| try await self?.repository.updateFCMToken(fcmToken) | ||
| } catch { | ||
| self?.logger.error("Failed to sync refreshed FCM token", error: error) | ||
| } | ||
| } | ||
| } | ||
| .store(in: &cancellables) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // | ||
| // UserTimeZoneSyncHandler.swift | ||
| // DevLog | ||
| // | ||
| // Created by opfic on 3/19/26. | ||
| // | ||
|
|
||
| import Combine | ||
| import Foundation | ||
|
|
||
| final class UserTimeZoneSyncHandler { | ||
| private let repository: UserDataRepository | ||
| private let logger = Logger(category: "UserTimeZoneSyncHandler") | ||
| private var cancellables = Set<AnyCancellable>() | ||
|
|
||
| init( | ||
| repository: UserDataRepository, | ||
| notificationCenter: NotificationCenter = .default | ||
| ) { | ||
| self.repository = repository | ||
|
|
||
| notificationCenter.publisher(for: .didRequestUserTimeZoneSync) | ||
| .sink { [weak self] _ in | ||
| Task { | ||
| do { | ||
| try await self?.repository.updateUserTimeZone() | ||
| } catch { | ||
| self?.logger.error("Failed to sync user timeZone", error: error) | ||
| } | ||
| } | ||
| } | ||
| .store(in: &cancellables) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // | ||
| // NotificationName+.swift | ||
| // DevLog | ||
| // | ||
| // Created by opfic on 3/19/26. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| extension Notification.Name { | ||
| static let didRefreshFCMToken = Notification.Name("didRefreshFCMToken") | ||
| static let didRequestUserTimeZoneSync = Notification.Name("didRequestUserTimeZoneSync") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
AppDelegate의 주석(// 앱이 온그라운드로 되었을 때...)을 보면, 앱이 포그라운드로 전환될 때마다 타임존을 동기화하려는 의도가 있었던 것으로 보입니다. 현재 구현은 앱이 처음 시작될 때만 동기화를 요청하고 있어, 이 의도를 완전히 반영하지 못하고 있습니다.사용자가 앱을 백그라운드로 전환한 후 기기의 시간대를 변경하고 다시 앱으로 돌아오는 경우, 변경된 타임존이 즉시 반영되지 않는 문제가 발생할 수 있습니다.
UIApplication.willEnterForegroundNotification알림을 추가로 수신하여, 앱이 포그라운드로 진입할 때마다 타임존을 동기화하도록 개선하는 것을 제안합니다. 이렇게 하면 앱의 동작이 주석의 의도와 일치하게 되고, 사용자 경험도 향상될 것입니다.