12 KiB
12 KiB
20260326 회원정보 응답 확장 및 콘텐츠 보기 설정 연동
개요
/member/info응답 확장 필드(countryCode,isAdultContentVisible,contentType)를 앱 상태에 반영한다.- 설정 화면의
콘텐츠 보기 설정메뉴 노출 조건을 기존인증 사용자기준에서인증 사용자 또는 비한국 국가 코드까지 확장한다. - 콘텐츠 보기 설정 변경 시
/member/content-preference(PATCH)를 호출해 서버와 클라이언트 값을 동기화한다. - 설정값 연타 시
debounce로 마지막 변경값만 서버에 전송하고, 전송 중에는 로딩 다이얼로그를 노출한다.
요구사항 요약
GET /member/info- 추가 응답 필드
countryCode: String(접속 국가 코드)isAdultContentVisible: BooleancontentType: ContentType
- 추가 응답 필드
- 메뉴 노출 규칙
- 현재 유지:
UserDefaults.bool(forKey: .auth) == true이면 노출 - 추가:
countryCode != "KR"인 경우에도 노출
- 현재 유지:
PATCH /member/content-preference- 콘텐츠 보기 설정 변경 시 호출
- 응답 필드
isAdultContentVisible: BooleancontentType: ContentType
- UX
- API 호출 시 Loading Dialog 표시
- 연속 입력 시 마지막 값만 서버 전송
완료 기준 (Acceptance Criteria)
- AC1:
GetMemberInfoResponse가countryCode,isAdultContentVisible,contentType를 디코딩한다. - AC2:
HomeViewModel.getMemberInfo,AppViewModel.getMemberInfo에서 신규 필드가UserDefaults에 저장된다. - AC3:
SettingsView의콘텐츠 보기 설정메뉴가auth == true || normalizedCountryCode != "KR"조건에서 노출된다. - AC4:
ContentSettingsView내 토글/라디오 변경 시/member/content-preferencePATCH가 호출된다. - AC5: 콘텐츠 설정 API 호출 중
LoadingView가 표시되고, 완료/실패 시 정상 해제된다. - AC6: 짧은 시간 내 연타(토글/라디오 연속 변경) 시 마지막 상태 1건만 전송된다.
- AC7: 서버 응답 성공 시 로컬(
UserDefaults) 상태가 최종값과 일치한다.
구현 체크리스트
1) 회원정보 응답 모델/저장 키 확장
SodaLive/Sources/Settings/Notification/GetMemberInfoResponse.swiftcountryCode,isAdultContentVisible,contentType필드 추가- 기존 디코딩 영향(옵셔널/기본값 정책) 점검
SodaLive/Sources/Extensions/UserDefaultsExtension.swiftUserDefaultsKey에 국가 코드 저장 키 추가(예:countryCode)
2) /member/info 수신 데이터 저장 경로 확장
SodaLive/Sources/Main/Home/HomeViewModel.swiftgetMemberInfo()성공 시 신규 3개 필드 저장 로직 추가
SodaLive/Sources/App/AppViewModel.swiftgetMemberInfo()성공 시 신규 3개 필드 저장 로직 추가
- 저장 정책 정리
- 국가 코드는 대문자 정규화(
uppercased) 후 저장 contentType는 서버값 우선 저장, 미존재/비정상 값은ALLfallback 검토
- 국가 코드는 대문자 정규화(
3) 설정 메뉴 노출 조건 확장
SodaLive/Sources/Settings/SettingsView.swift- 기존
if UserDefaults.bool(forKey: .auth)조건을if isAuth || isNonKoreanCountry형태로 확장 isNonKoreanCountry계산 시 공백/소문자 입력 대비 정규화 처리
- 기존
4) 콘텐츠 설정 PATCH API 추가
SodaLive/Sources/User/UserApi.swiftcase updateContentPreference(request: UpdateContentPreferenceRequest)추가path:/member/content-preferencemethod:.patchtask:.requestJSONEncodable(request)
SodaLive/Sources/User/UserRepository.swiftupdateContentPreference(...)메서드 추가
- 신규 DTO 추가
SodaLive/Sources/Settings/Content/UpdateContentPreferenceRequest.swiftSodaLive/Sources/Settings/Content/UpdateContentPreferenceResponse.swift
5) 콘텐츠 설정 화면 상태/전송 로직 보강
SodaLive/Sources/Settings/Content/ContentSettingsViewModel.swift@Published isLoading,errorMessage,isShowPopup추가- 토글/라디오 변경 이벤트를
Subject로 수집 debounce+removeDuplicates로 마지막 값만 전송- API 성공 시 응답값 기준으로 로컬 상태 최종 확정
- API 실패 시 에러 토스트 노출 및 로딩 해제
SodaLive/Sources/Settings/Content/ContentSettingsView.swiftBaseView(isLoading: $viewModel.isLoading)적용으로 Loading Dialog 표시.sodaToast(...)연결로 실패 메시지 표시
6) 회귀 영향 점검
UserDefaults.isAdultContentVisible()및 기존 콘텐츠 조회 API 파라미터 경로(HomeTabRepository,ContentRepository,SearchRepository등)에서 신규 저장값 반영 여부 점검- 앱 재시작 플래그(
AppState.shared.isRestartApp)와 서버 동기화 타이밍 충돌 여부 점검
7) 검증 계획
- 정적 진단: 수정 파일
lsp_diagnostics확인 - 빌드:
xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug build - 빌드(개발):
xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive-dev" -configuration Debug build - 테스트 시도:
xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" test/SodaLive-dev test - 수동 QA
- 한국 계정(
countryCode == KR, 미인증): 메뉴 비노출 - 비한국 계정(
countryCode != KR, 미인증): 메뉴 노출 - 인증 계정(
isAuth == true): 국가코드 무관 메뉴 노출 - 토글/라디오 연타 시 마지막 선택값만 서버 반영
- API 호출 중 로딩 다이얼로그 표시 및 완료 후 해제
- 한국 계정(
8) 국가 기반 성인 접근 분기 및 18+ 확인 팝업
SodaLive/Sources/Main/Home/HomeView.swift- 성인 라이브 진입 시 국가코드 분기 적용
KR(또는 빈값)+ 미인증: 기존 본인인증 팝업 유지non-KR+ 민감 콘텐츠 OFF:contentViewSettings이동 + 안내 팝업 노출
SodaLive/Sources/Live/Now/All/LiveNowAllView.swiftHomeView와 동일한 국가 분기/가드 정책 반영
SodaLive/Sources/Settings/Content/ContentSettingsViewModel.swift- 민감 콘텐츠 ON 전 18+ 확인 상태 추가
handleAdultContentToggleTap,confirmAdultContentAgeCheck,cancelAdultContentAgeCheck구현
SodaLive/Sources/Settings/Content/ContentSettingsView.swift- 스위치 탭 동작을 뷰모델 핸들러로 연결
SodaDialog로아니오/예처리 연결(예: ON + API 흐름, 아니오: OFF 유지)
SodaLive/Sources/I18n/I18n.swiftadultContentAgeCheckTitle,adultContentAgeCheckDesc,adultContentEnableGuide국제화 문자열 추가
SodaLive/Sources/Live/Room/LiveRoomViewModel.swiftrequiresAdultAuthenticationByCountry()도입- 성인 방 진입 시 인증 요구 조건을 KR 기반으로 일관화
영향 파일(예상)
SodaLive/Sources/Settings/Notification/GetMemberInfoResponse.swiftSodaLive/Sources/Extensions/UserDefaultsExtension.swiftSodaLive/Sources/Main/Home/HomeViewModel.swiftSodaLive/Sources/App/AppViewModel.swiftSodaLive/Sources/Settings/SettingsView.swiftSodaLive/Sources/User/UserApi.swiftSodaLive/Sources/User/UserRepository.swiftSodaLive/Sources/Settings/Content/ContentSettingsView.swiftSodaLive/Sources/Settings/Content/ContentSettingsViewModel.swiftSodaLive/Sources/Settings/Content/UpdateContentPreferenceRequest.swift(신규)SodaLive/Sources/Settings/Content/UpdateContentPreferenceResponse.swift(신규)
리스크 및 의존성
- 백엔드가
contentType문자열을ALL/MALE/FEMALE외 값으로 내려주면 디코딩 실패 가능성이 있어 방어 로직이 필요하다. /member/content-preference응답/에러 정책이 미정이면 실패 시 롤백 기준(로컬 유지/복구) 정의가 필요하다.countryCode미수신 시 기본 노출 정책(비노출 권장)을 명확히 정해야 메뉴 오노출을 방지할 수 있다.
검증 기록
-
일시: 2026-03-26
- 무엇: 회원정보 응답 확장/콘텐츠 설정 서버 동기화 작업을 위한 구현 계획 문서 작성
- 왜: 요청 범위(응답 필드 확장, 메뉴 노출 조건 변경, PATCH 연동, 로딩/디바운스)를 코드 경로 기준으로 실행 가능한 체크리스트로 정리하기 위함
- 어떻게: 기존 구현 파일(
UserApi,UserRepository,GetMemberInfoResponse,SettingsView,ContentSettingsViewModel)과 기존 계획 문서 포맷을 조사해 항목화 - 실행 명령/도구:
read(docs/*),grep("/member/info|getMemberInfo|isAdultContentVisible|contentType|debounce"),read(UserApi.swift, UserRepository.swift, SettingsView.swift, ContentSettingsViewModel.swift 등) - 결과: 구현 전용 체크리스트/완료 기준/검증 계획/리스크가 포함된 계획 문서 초안 작성 완료
-
일시: 2026-03-26
- 무엇: 회원정보 응답 확장 및 콘텐츠 보기 설정 서버 동기화 구현 완료
- 왜:
/member/info확장 필드 반영, 설정 메뉴 노출 조건 확장,/member/content-preferencePATCH 연동, debounce/로딩 UX 요구사항을 충족하기 위함 - 어떻게:
GetMemberInfoResponse/UserDefaultsKey확장,HomeViewModel/AppViewModel저장 로직 보강,SettingsView노출 조건 변경,UserApi/UserRepositoryPATCH 추가,ContentSettingsViewModelSubject+debounce 동기화 및ContentSettingsView로딩/토스트 연결 - 실행 명령/도구:
xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug buildxcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive-dev" -configuration Debug buildxcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" testxcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive-dev" testlsp_diagnostics(수정 파일)
- 결과:
- 두 스킴 Debug 빌드 모두
BUILD SUCCEEDED - 테스트 명령은 두 스킴 모두
Scheme ... is not currently configured for the test action으로 실행 불가(테스트 타깃 미구성) lsp_diagnostics는 SourceKit 해석 범위 한계로 다수의 모듈 미해결 오류를 반환했으나, 실제 Xcode 빌드는 통과하여 컴파일 정상 확인- 수동 QA는 현재 CLI 환경 한계로 미실행(체크리스트 유지)
- 두 스킴 Debug 빌드 모두
-
일시: 2026-03-27
- 무엇: 국가 기반 성인 접근 분기 및 민감 콘텐츠 ON 18+ 확인 팝업 구현 검증
- 왜: 한국/비한국 정책 분기와 민감 콘텐츠 ON 보호 UX(국제화 포함) 요구사항을 반영하고, 실제 빌드 기준으로 회귀 여부를 확인하기 위함
- 어떻게:
HomeView,LiveNowAllView성인 진입 가드에 국가코드 분기 추가ContentSettingsViewModel/ContentSettingsView에 18+ 확인 다이얼로그 플로우 추가I18n.Settings에 신규 문구 추가 및LiveRoomViewModel성인 인증 조건을 KR 기반으로 정렬
- 실행 명령/도구:
xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug buildxcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive-dev" -configuration Debug buildxcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" testxcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive-dev" testlsp_diagnostics(I18n.swift, ContentSettingsViewModel.swift, ContentSettingsView.swift, HomeView.swift, LiveNowAllView.swift, LiveRoomViewModel.swift)
- 결과:
SodaLive빌드는 최초 병렬 실행 시build.dblock으로 실패했으나, 단독 재실행에서BUILD SUCCEEDEDSodaLive-dev빌드는BUILD SUCCEEDED- 테스트는 두 스킴 모두
Scheme ... is not currently configured for the test action으로 실행 불가(테스트 액션 미구성) lsp_diagnostics는 SourceKit 모듈 해석 제약으로 다수 에러를 보고했으나, 실제xcodebuild통과로 컴파일 정상 확인- 수동 QA는 CLI 환경 한계로 미실행(체크리스트 유지)