Files
sodalive-ios/docs/20260317_이미지등록크롭재구현.md

7.4 KiB

20260317 이미지 등록/크롭 재구현

구현 체크리스트

  • 공통 SwiftUI 이미지 선택/크롭 컴포넌트 구현
    • QA: 1:1 고정 모드와 자유 비율 모드에서 크롭 완료 시 UIImage 반환
  • 콘텐츠 업로드(ContentCreateView) 이미지 등록 플로우를 신규 컴포넌트로 전환
    • QA: 선택 후 1:1 크롭 결과가 썸네일에 반영되고 업로드 시 coverImage로 전송
  • 라이브 만들기(LiveRoomCreateView) 이미지 등록 플로우를 신규 컴포넌트로 전환
    • QA: 선택 후 자유 비율 크롭 결과가 썸네일에 반영되고 업로드 시 coverImage로 전송
  • 커뮤니티 게시글 등록(CreatorCommunityWriteView) 이미지 등록 플로우를 신규 컴포넌트로 전환
    • QA: 선택 후 자유 비율 크롭 결과가 미리보기에 반영되고 업로드 시 postImageData로 전송
  • 프로필 이미지 등록(ProfileUpdateView) 이미지 등록 플로우를 신규 컴포넌트로 전환
    • QA: 선택 후 1:1 크롭 결과가 반영되고 업로드 시 profileImage 업데이트 트리거
  • 이미지 업로드 지점 추가 전수 검색 및 결과 정리
    • QA: ImagePicker, PhotosPicker, MultipartFormData(name: "image"/"coverImage"/"postImage") 기반 검색 결과 보고
  • 정적 진단/빌드 검증 및 결과 기록
    • QA: 수정 파일 lsp_diagnostics 오류 0건, 빌드 명령 성공

검증 기록

  • 2026-03-17
    • 무엇/왜/어떻게: 4개 대상 화면의 이미지 선택을 PhotosPicker 기반으로 통일하고, 공통 ImageCropEditorViewImagePicker.swift에 추가해 1:1/자유 비율 크롭을 분기 적용했다. 커뮤니티 등록은 크롭 결과 UIImagejpegData로 변환해 기존 postImageData 업로드 체인과 호환시켰다.
    • 실행 명령: xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug build
    • 결과: 초기 2회는 iOS 16.6 타깃에서 onChange 시그니처 이슈로 실패했으며 수정 후 최종 ** BUILD SUCCEEDED ** 확인.
    • 실행 명령: xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" test
    • 결과: Scheme SodaLive is not currently configured for the test action.로 테스트 액션 미구성 확인.
    • 실행 명령: grep/ast-grep 전수 검색(ImagePicker(, PhotosPicker(, jpegData(compressionQuality: 0.8), name: "image|coverImage|postImage", MultipartFormData)
    • 결과: 추가 이미지 업로드 지점 3곳 확인
      • SodaLive/Sources/Live/Room/LiveRoomViewModel.swift (coverImage 업로드)
      • SodaLive/Sources/Content/Modify/ContentModifyViewModel.swift (coverImage 업로드)
      • SodaLive/Sources/Explorer/Profile/CreatorCommunity/Modify/CreatorCommunityModifyViewModel.swift (postImage 업로드)
  • 2026-03-17 (보강)
    • 무엇/왜/어떻게: Oracle 리뷰에서 지적된 안정성 항목을 반영해 커뮤니티 업로드 실패 시 로딩 고착을 해소하고, postImage의 MIME/확장자를 image/jpeg/.jpg로 명시했다. 또한 크롭 편집기에서 오프셋 스냅샷 동기화와 경계 좌표 보정을 추가하고, 4개 화면의 비동기 이미지 로딩 Task 취소 처리를 넣어 연속 선택 경쟁 상태를 줄였다.
    • 실행 명령: xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug build
    • 결과: ** BUILD SUCCEEDED **
    • 실행 명령: xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" test
    • 결과: Scheme SodaLive is not currently configured for the test action.
  • 2026-03-17 (크롭 표시 지연/미표시 수정)
    • 무엇/왜/어떻게: PhotosPicker 선택값이 nil로 바뀔 때도 기존 로딩 Task를 즉시 취소하던 흐름 때문에 크롭 표시 트리거가 유실될 수 있어, 4개 화면 모두 newItem != nil일 때만 로딩을 시작하도록 수정했다. 동시에 이미지 로드 중에는 반투명 오버레이 + ProgressView를 표시해 크롭 UI 전환 대기 시간을 자연스럽게 보이도록 적용했다.
    • 실행 명령: xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug build
    • 결과: ** BUILD SUCCEEDED **
    • 실행 명령: xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" test
    • 결과: Scheme SodaLive is not currently configured for the test action.
  • 2026-03-17 (iOS 16 Task/자유 크롭 멈춤 보강)
    • 무엇/왜/어떻게: iOS 16에서 Task 기반 이미지 로딩 경로가 불안정하다는 이슈에 따라 4개 화면의 이미지 선택 로직을 ImagePicker(UIImagePickerController) + 콜백 기반으로 전환하고 Task/PhotosPicker 의존을 제거했다. 선택 직후에는 백그라운드에서 normalizedForCrop()를 수행하며 로딩 오버레이를 보여주고, 완료 시 크롭 시트를 띄우도록 변경했다. 자유 크롭 멈춤 이슈는 크롭 오버레이 hit-test를 차단하고(이미지 제스처 통과), 부모/핸들 제스처 충돌을 줄이도록 제스처 부착 위치를 조정했으며 정규화 이미지를 캐시해 제스처 중 과도한 연산을 제거했다.
    • 실행 명령: grep 점검(Task|PhotosPicker|selectedPhotoItem|loadTransferable)
    • 결과: 대상 4개 화면에서 Task/PhotosPicker 경로 미검출 확인.
    • 실행 명령: xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug build
    • 결과: ** BUILD SUCCEEDED **
    • 실행 명령: xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" test
    • 결과: Scheme SodaLive is not currently configured for the test action.
  • 2026-03-17 (크롭 다이얼로그 사용성 보강)
    • 무엇/왜/어떻게: 확대 시 상단 버튼이 가려지던 문제를 막기 위해 크롭 캔버스를 clipped() 처리하고 상단 버튼 영역을 고정(zIndex + 배경)했다. 자유 크롭은 단일 우하단 원 대신 4개 모서리 핸들로 변경하고, 조작 안내 문구를 추가해 조절 방법을 즉시 인지할 수 있도록 개선했다.
    • 실행 명령: xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug build
    • 결과: ** BUILD SUCCEEDED **
    • 실행 명령: xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" test
    • 결과: Scheme SodaLive is not currently configured for the test action.
  • 2026-03-17 (크롭 결과 크기 제한/핸들 크기 조정)
    • 무엇/왜/어떻게: 크롭 결과 이미지의 가로/세로 중 큰 값을 기준으로 최대 800px을 넘지 않도록 resizedToMaxDimension(800) 축소 로직을 추가했다(비율 유지). 자유 크롭 핸들 원은 기존 대비 절반 크기(30 -> 15)로 조정했다.
    • 실행 명령: xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug build
    • 결과: ** BUILD SUCCEEDED **
    • 실행 명령: xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" test
    • 결과: Scheme SodaLive is not currently configured for the test action.
  • 2026-03-17 (핸들 크기 재조정)
    • 무엇/왜/어떻게: 요청에 맞춰 자유 크롭 핸들 원 크기를 24로 조정했다.
    • 실행 명령: xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug build
    • 결과: ** BUILD SUCCEEDED **
    • 실행 명령: xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" test
    • 결과: Scheme SodaLive is not currently configured for the test action.