Skip to content

[#398] 앱 전역 위젯 동기화 이벤트를 정리한다#403

Merged
opficdev merged 16 commits intodevelopfrom
refactor/#398-widget-event
Apr 30, 2026
Merged

[#398] 앱 전역 위젯 동기화 이벤트를 정리한다#403
opficdev merged 16 commits intodevelopfrom
refactor/#398-widget-event

Conversation

@opficdev
Copy link
Copy Markdown
Owner

🔗 연관된 이슈

📝 작업 내용

📌 요약

  • 위젯 동기화 트리거를 앱 백그라운드 전환 시점으로 단일화
  • ViewModel/Repository에 분산된 위젯 동기화 책임 제거
  • WidgetSyncEventBus, WidgetSyncEventHandler, WidgetSnapshotUpdater 기반 동기화 경계 구성

🔍 상세

  • scenePhase == .background에서 .syncRequested 이벤트 발행
  • WidgetSyncEventHandler에서 Today/Heatmap 위젯 스냅샷 갱신 처리
  • Todo/Preference 변경 경로의 위젯 이벤트 발행 의존성 제거
  • 기존 Today/Heatmap 위젯 SyncCoordinator 제거
  • 위젯 kind/snapshot key 공유 상수 정리
  • Calendar.startOfQuarter(for:) extension 추가 및 중복 계산 로직 제거
  • 위젯 스냅샷 저장/선호값 저장 경계 정리
  • 위젯 동기화 이벤트, 이벤트 버스, 핸들러, 스냅샷 갱신 테스트 추가 및 수정

📸 영상 / 이미지 (Optional)

@opficdev opficdev self-assigned this Apr 30, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

이번 PR은 WidgetSyncEventBusWidgetSyncEventHandler를 도입하여 위젯 동기화 로직을 이벤트 기반 구조로 리팩토링합니다. 기존 ViewModel에서 직접 수행하던 동기화 로직을 제거하고, 앱이 백그라운드로 진입할 때 이벤트를 발행하여 중앙에서 처리하도록 개선되었습니다. 또한 WidgetSnapshotPreferenceStore, WidgetSnapshotUpdater 등 위젯 데이터 관리를 위한 전용 클래스들을 추가하고 공유 상수를 정의했습니다. 리뷰에서는 WidgetSyncEventHandler의 테스트 용이성을 위해 Calendar와 현재 시간을 제공하는 클로저를 의존성으로 주입받도록 개선할 것을 제안했습니다.

Comment thread DevLog/Widget/Sync/WidgetSyncEventHandler.swift
@opficdev opficdev merged commit 6b37a8a into develop Apr 30, 2026
1 check passed
@opficdev opficdev deleted the refactor/#398-widget-event branch April 30, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

앱 전역 위젯 동기화 이벤트를 정리한다

1 participant