♻️ [Refactor] Watch 앱이 ActivityDomain 출석 UseCase 사용 — 일정 모델 공용 위치 확정 (#1212) - #1279
Open
JEONG-J wants to merge 1 commit into
Open
♻️ [Refactor] Watch 앱이 ActivityDomain 출석 UseCase 사용 — 일정 모델 공용 위치 확정 (#1212)#1279JEONG-J wants to merge 1 commit into
JEONG-J wants to merge 1 commit into
Conversation
- 일정 모델을 옮기지 않고 HomeDomain·NoticeDomain·CoreDomain 의 Domain 타겟을 [.iPhone, .appleWatch] 로 개방 — #981 의 "Home* 단일 소유자" 경계 유지 - ActivityDomain 의 HomeDomain·CoreDomain 조건부 의존(.when([.ios])) 제거로 watchOS 링크 실패(unable to resolve module dependency) 해소 - AttendanceTimeWindow 시간대 판정을 순수 이니셜라이저로 추출하고 ChallengerAttendanceUseCase 가 위임 — 판정 규칙 단일 소스화(동작 불변) - UMCWatchApp 이 ActivityDomain·HomeDomain 을 링크하고 출석 목록 화면에서 AttendanceTimeWindow(schedule:now:) 를 직접 호출 - 판정 로직 테스트 15종 추가 · 경계/플랫폼 정책을 build-and-modules.md 에 반영
6 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🔗 관련 이슈
Closes #1212
✨ PR 유형
♻️ Refactor — 모듈 경계/의존성 정리 (기능 동작 변경 없음, watchOS 지원 축 확장)
📷 스크린샷 or 영상(UI 변경 시)
해당 없음 — 워치 출석 목록 화면이 추가되었지만 디자인 토큰(
CoreDesignSystem)이 iOS 전용이라 SwiftUI 기본 스타일로만 뼈대를 세운 상태입니다. 워치 전용 토큰·비주얼은 #1205 에서 확정되며, 그때 스크린샷을 붙일 수 있습니다.🛠️ 작업내용
1. 결론 — 일정 모델은 옮기지 않는다 (플랫폼 축만 넓힌다)
이슈의 핵심 질문은 "출석 UseCase 와 일정 모델의 공용 위치를 어디로 확정할 것인가" 였습니다. 세 가지 안을 검토한 뒤 (A) 모델을 옮기지 않고 Domain 타겟의 지원 플랫폼만 넓히는 안을 택했습니다.
HomeDomain·NoticeDomain·CoreDomain의 Domain 타겟만[.iPhone, .appleWatch]로 개방CoreDomain으로 승격import HomeDomain66개 파일 연쇄 수정 + "Home* 단일 소유자" 경계 파괴CoreScheduleDomain신설근거는 실측입니다. 세 모듈의 Domain 소스는
Foundation/UMCFoundation/NoticeDomain/SwiftData만 import 하고 있어(UIKit·MapKit·StoreKit·Moya0건) watchOS 제약이 없었고,UMCFoundation은 이미 멀티플랫폼으로 watchOS 빌드가 통과하는 상태였습니다.Data·Presentation타겟은 Moya·MapKit 의존이 있으므로 iOS 전용 그대로 둡니다.2. 잠복해 있던 watchOS 링크 실패 해소
ActivityDomain은 destinations 에.appleWatch를 선언해 두고도HomeDomain·CoreDomain을condition: .when([.ios])로만 의존하고 있었습니다. 정작 소스 7개 파일이import HomeDomain을#if os(iOS)가드 없이 사용해서, 워치 타겟이 링크하는 순간 깨지는 상태였습니다. 변경 전 실제로 재현했습니다.domainExtraDependencies/domainTestDependencies의.when([.ios])조건 4곳을 제거해 해소했습니다.3. 출석 시간대 판정을 순수 함수로 추출 — 워치가 같은 규칙을 실행
ChallengerAttendanceUseCase.isWithinAttendanceTime안에만 있던 판정 로직을AttendanceTimeWindow의 이니셜라이저 3종으로 꺼냈습니다.init(startsAt:endsAt:isAllDay:now:)— 클라이언트 상수(AttendancePolicy) 폴백 규칙. 기존 UseCase 본문과 분기까지 동일합니다.init(policy:startsAt:endsAt:isAllDay:now:)— 서버 정책(checkInStartAt/onTimeEndAt/lateEndAt) 우선,nil이면 위로 폴백init(schedule:now:)—ScheduleDetailData편의 진입점UseCase 는 이제 이 이니셜라이저에 위임만 합니다. 동작은 그대로이고, 판정 규칙의 소스가 하나로 모였습니다.
이 구조 덕분에 워치는 Repository·네트워크 스택(iOS 전용
ActivityData)을 조립하지 않고도 iOS 와 문자 그대로 같은 도메인 규칙을 실행합니다.4. 워치 출석 화면이 실제로 ActivityDomain 을 호출
UMCWatchApp이ActivityDomain·HomeDomain을 링크하고,WatchAttendanceViewModel.timeWindow(for:now:)가AttendanceTimeWindow(schedule:now:)를 직접 호출합니다. 스텁이 아니라 실제 도메인 호출이며,apply(schedules:)가 #1210/#1207 의 WatchConnectivity 수신부가 그대로 꽂히는 이음매입니다.ContentView는 이 화면을 띄우도록 바꿨습니다.5. 검증
tuist generate --no-openActivityDomain@ watchOS Sim 빌드UMCWatchApp@ watchOS Sim 빌드UMCApp@ iPhone 17 Pro 빌드cd UMCApp && make testActivityDomain233 tests / 43 suites 포함)판정 로직 테스트 15종(경계값·종일 일정·정책
nil폴백 동치성·위임 경로)을 새로 추가했습니다.6. 문서
docs/claude/build-and-modules.md의 "경계 정책 — 일정(Schedule)" 을(#981 확정 · #1212 갱신)으로 넓히고, 어떤 타겟이 왜 watchOS 로 열렸는지 표로 정리한 플랫폼(destination) 정책 절을 새로 넣었습니다.📋 추후 진행 상황
이 PR 은 경계 확정과 재사용 경로 확보까지입니다. 다음은 형제 이슈가 이어받습니다.
Core/WatchConnectivity를 의도적으로 건드리지 않았습니다. ♻️ Refactor: WatchConnectivity 도메인 페이로드 계약 정의 + 양방향 수신 경로 구현 #1210(PR ♻️ [Refactor] WatchConnectivity 도메인 페이로드 계약 정의 · 양방향 수신 경로 구현 (#1210) #1274, 미머지)이WatchMessenger를 삭제하고 교체하는 중이라, 그 API 에 올라타면 곧바로 지워질 코드가 되기 때문입니다. 실제 일정 전송은 ♻️ Refactor: WatchConnectivity 도메인 페이로드 계약 정의 + 양방향 수신 경로 구현 #1210 머지 후apply(schedules:)에 연결하면 됩니다.CoreDesignSystem이 iOS 전용이라 지금은 SwiftUI 기본 스타일입니다.사람만 할 수 있는 잔여 작업(서명·디자인 승인 등)은 없습니다.
📌 리뷰 포인트
Domain타겟만 열고Data·Presentation은 iOS 로 두는 선이 적절한지.Notice는HomeDomain이NoticeDomain에 의존해서 딸려 열렸습니다.ChallengerAttendanceUseCase의 기존 본문과init(startsAt:endsAt:isAllDay:now:)가isAllDay분기까지 동일한지 대조 부탁드립니다.ChallengerAttendanceViewModel은 호출 횟수를 검증하는 기존 테스트가 있어 의도적으로 손대지 않았습니다.Core/WatchConnectivity무수정 방침이 맞는지.✅ Checklist
PR이 다음 요구 사항을 충족하는지 확인해주세요!!!