Skip to content

[Feat] - Apple Watch 건강 데이터 서버 API 연동#294

Open
thingineeer wants to merge 6 commits intoRunnect:developfrom
thingineeer:feature/v2.5.0-watch-health-data
Open

[Feat] - Apple Watch 건강 데이터 서버 API 연동#294
thingineeer wants to merge 6 commits intoRunnect:developfrom
thingineeer:feature/v2.5.0-watch-health-data

Conversation

@thingineeer
Copy link
Collaborator

@thingineeer thingineeer commented Feb 22, 2026

🌱 작업한 내용

Apple Watch에서 수집하는 건강 데이터(심박수, 칼로리, 심박수 Zone)를 iPhone으로 전달하고, 서버 Health Data API와 연동하여 2-step 저장 흐름을 구현했습니다.

Watch

  • WorkoutManager에 심박수 샘플 추적 및 Zone 분포 계산 로직 추가
  • WatchSessionManagertransferUserInfo 기반 건강 요약 데이터 전달 구현
  • 5초 간격 실시간 심박수/칼로리 iPhone 전송
  • 개별 심박수 샘플(elapsedSeconds, zone) 및 minHeartRate 포함

데이터 수신 및 UI

  • WatchSessionServicedidReceiveUserInfo 구현 (건강 요약 수신)
  • WatchSessionService에 실시간 심박수/칼로리 수신 및 Combine 바인딩
  • RunTrackingVC 러닝 중 실시간 심박수/칼로리 표시
  • RunningRecordVC 기록 저장 화면에 건강 데이터 요약 섹션 추가
  • HeartRateZoneBarView 신규 컴포넌트 (보라 계열 Zone 바 차트)

서버 API 연동

  • RecordRouter에 Health Data API 엔드포인트 4개 추가 (POST/GET/DELETE/GET summary)
  • POST /record 응답에서 data.record.id 파싱 → 2-step 저장 흐름
  • 409 Conflict 시 DELETE 후 재전송 retry 로직
  • ActivityRecordDetailVC에 과거 기록 건강 데이터 조회 및 표시
  • ActivityRecord에 optional healthData 필드 추가 (하위 호환)

신규 DTO

  • HealthDataSaveRequestDto — POST /record/{id}/health 요청 (flat zone 필드)
  • RecordResponseDto — POST /record 응답 recordId 파싱
  • HealthDataResponseDto — GET /record/{id}/health 응답 (nested zones)
  • HealthSummaryResponseDto — GET /health/summary 기간별 통계

Graceful Degradation

  • Watch 미연결 시 기존과 100% 동일하게 동작 (Step 2 스킵)
  • Health 저장 실패해도 러닝 기록은 정상 저장됨
  • 과거 기록 중 건강 데이터 없는 기록은 건강 섹션 숨김

🌱 PR Point

  • 기존 러닝 기록 기능에 영향 없음 (healthData가 optional)
  • 기존 브랜드 컬러(m1~m6)/폰트(Pretendard) 시스템 일관성 유지
  • 코드 변경: 12개 파일, +484줄 (신규 4개 파일 포함)
  • 서버 Health Data API 배포 완료 확인

📮 관련 이슈

  • Apple Watch 건강 데이터 서버 연동 (서버 API 설계서 별도 전달 완료)

- WorkoutManager에 심박수 샘플 추적 및 Zone 분포 계산 추가
- WatchSessionManager에 transferUserInfo 기반 건강 요약 전달 구현
- WatchSessionService에 didReceiveUserInfo 및 실시간 건강 데이터 수신 구현
- RunningModel에 healthSummary 필드 추가
- RunningRecordRequestDto에 HealthDataRequestDto 추가
- RunTrackingVC에 실시간 심박수/칼로리 표시 추가
- RunningRecordVC에 건강 데이터 요약 섹션 추가
- HeartRateZoneBarView 신규 컴포넌트 구현
- 기존 브랜드 컬러/폰트 시스템 일관성 유지
@thingineeer thingineeer added Feat 새로운 기능 구현 명진😼 labels Feb 22, 2026
@thingineeer thingineeer self-assigned this Feb 22, 2026
- RecordRouter에 건강 데이터 API 엔드포인트 4개 추가
- POST /record 응답에서 recordId 파싱하여 2-step 저장 흐름 구현
- 409 Conflict 시 DELETE 후 재전송 retry 로직 추가
- WatchHealthSummary에 minHeartRate, heartRateSamples, zoneDurations 보강
- WorkoutManager에 개별 심박수 샘플 및 최저 심박수 포함
- ActivityRecordDetailVC에 과거 기록 건강 데이터 조회 및 표시 추가
- ActivityRecord에 optional healthData 필드 추가 (하위 호환)
@thingineeer thingineeer changed the title [Feat] - Apple Watch 건강 데이터 연동 (심박수/칼로리) [Feat] - Apple Watch 건강 데이터 서버 API 연동 Feb 22, 2026
- maxHeartRateConfig 타입 Int → Double (서버가 190.0으로 반환)
- HealthSummaryResponseDto에 summary nested 구조 반영
@thingineeer thingineeer force-pushed the feature/v2.5.0-watch-health-data branch from 8c8c679 to 259ecf7 Compare February 23, 2026 12:32
- Created by Runnect → Created by 이명진 일괄 변경
- Watch App + iOS 공통 20개 파일
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feat 새로운 기능 구현 명진😼

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant