-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat] 룩북추가 바텀시트 추가, Home 2차 수정 #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @Funital, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 Pull Request는 Home 기능에 대한 대규모 개선과 리팩토링을 통해 애플리케이션의 핵심 기능을 강화합니다. 데이터 접근 방식의 모듈화, 도메인 모델의 확장, 그리고 의존성 관리의 효율성 증대에 중점을 두어, 코드의 가독성과 유지보수성을 크게 향상시켰습니다. 새로운 Use Case 패턴을 도입하여 각 기능의 책임이 명확해졌으며, 룩북 추가 바텀시트와 코디 완료 팝업 등 사용자 경험을 개선하는 UI 요소들이 추가되었습니다. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. 코드의 숲, 복잡한 길, Use Case로 나누어, 명료해진 길. 각자의 역할, 책임은 분명, 새로운 기능, 이제 꽃 피우네. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
이번 PR은 Home 기능에 대한 대규모 리팩토링으로, 하나의 큰 Use Case를 기능별로 분리하여 아키텍처를 크게 개선했습니다. DI 컨테이너를 통해 HomeViewModel을 싱글톤으로 관리하여 관련 뷰 간의 상태를 공유하는 방식도 좋은 접근입니다. 코드 구조가 잘 잡혀있고 관심사 분리가 명확하게 이루어졌습니다. 몇 가지 코드 일관성 개선 및 중복 제거를 위한 제안을 추가했습니다. 전반적으로 훌륭한 작업입니다.
| switch categoryId { | ||
| case 1: | ||
| mockResponse = [ | ||
| ClothListResponseDTO(clothId: 101, clothImageUrl: "https://images.unsplash.com/photo-1521572163474-6864f9cf17ab?w=800"), | ||
| ClothListResponseDTO(clothId: 102, clothImageUrl: "https://images.unsplash.com/photo-1596755389378-c31d21fd1273?w=800") | ||
| ] | ||
| case 2: | ||
| mockResponse = [ | ||
| ClothListResponseDTO(clothId: 201, clothImageUrl: "https://images.unsplash.com/photo-1541099649105-f69ad21f3246?w=800"), | ||
| ClothListResponseDTO(clothId: 202, clothImageUrl: "https://images.unsplash.com/photo-1594633312681-425c7b97ccd1?w=800") | ||
| ] | ||
| case 3: | ||
| mockResponse = [ | ||
| ClothListResponseDTO(clothId: 201, clothImageUrl: "https://images.unsplash.com/photo-1541099649105-f69ad21f3246?w=800"), | ||
| ClothListResponseDTO(clothId: 202, clothImageUrl: "https://images.unsplash.com/photo-1594633312681-425c7b97ccd1?w=800") | ||
| ] | ||
| case 4: | ||
| mockResponse = [ | ||
| ClothListResponseDTO(clothId: 201, clothImageUrl: "https://images.unsplash.com/photo-1541099649105-f69ad21f3246?w=800"), | ||
| ClothListResponseDTO(clothId: 202, clothImageUrl: "https://images.unsplash.com/photo-1594633312681-425c7b97ccd1?w=800") | ||
| ] | ||
| case 5: | ||
| mockResponse = [ | ||
| ClothListResponseDTO(clothId: 501, clothImageUrl: "https://images.unsplash.com/photo-1542291026-7eec264c27ff?w=800"), | ||
| ClothListResponseDTO(clothId: 502, clothImageUrl: "https://images.unsplash.com/photo-1549298916-b41d501d3772?w=800") | ||
| ] | ||
| case 6: | ||
| mockResponse = [ | ||
| ClothListResponseDTO(clothId: 201, clothImageUrl: "https://images.unsplash.com/photo-1541099649105-f69ad21f3246?w=800"), | ||
| ClothListResponseDTO(clothId: 202, clothImageUrl: "https://images.unsplash.com/photo-1594633312681-425c7b97ccd1?w=800") | ||
| ] | ||
| case 7: | ||
| mockResponse = [ | ||
| ClothListResponseDTO(clothId: 201, clothImageUrl: "https://images.unsplash.com/photo-1541099649105-f69ad21f3246?w=800"), | ||
| ClothListResponseDTO(clothId: 202, clothImageUrl: "https://images.unsplash.com/photo-1594633312681-425c7b97ccd1?w=800") | ||
| ] | ||
| default: | ||
| mockResponse = [] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch 문에서 case 2, 3, 4, 6, 7의 코드가 중복됩니다. 여러 case를 쉼표로 구분하여 함께 처리하면 코드를 더 간결하게 만들고 유지보수성을 높일 수 있습니다.
switch categoryId {
case 1:
mockResponse = [
ClothListResponseDTO(clothId: 101, clothImageUrl: "https://images.unsplash.com/photo-1521572163474-6864f9cf17ab?w=800"),
ClothListResponseDTO(clothId: 102, clothImageUrl: "https://images.unsplash.com/photo-1596755389378-c31d21fd1273?w=800")
]
case 2, 3, 4, 6, 7:
mockResponse = [
ClothListResponseDTO(clothId: 201, clothImageUrl: "https://images.unsplash.com/photo-1541099649105-f69ad21f3246?w=800"),
ClothListResponseDTO(clothId: 202, clothImageUrl: "https://images.unsplash.com/photo-1594633312681-425c7b97ccd1?w=800")
]
case 5:
mockResponse = [
ClothListResponseDTO(clothId: 501, clothImageUrl: "https://images.unsplash.com/photo-1542291026-7eec264c27ff?w=800"),
ClothListResponseDTO(clothId: 502, clothImageUrl: "https://images.unsplash.com/photo-1549298916-b41d501d3772?w=800")
]
default:
mockResponse = []
}| struct LookBookBottomSheetEntity: Identifiable, Codable { | ||
| var id = UUID() | ||
| let lookbookId: Int | ||
| let codiId: Int | ||
| let imageUrl: String | ||
| let title: String | ||
| let count: Int | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identifiable 프로토콜을 준수하기 위해 id를 UUID로 생성하고 있습니다. 하지만 서버에서 받은 lookbookId가 고유 식별자 역할을 한다면, 이를 id로 사용하는 것이 좋습니다. 이렇게 하면 데이터를 다시 불러올 때 SwiftUI가 뷰의 정체성을 안정적으로 유지하여 예기치 않은 UI 문제를 방지할 수 있습니다. id가 Codable의 일부가 아니므로 CodingKeys를 수동으로 구현해야 합니다.
struct LookBookBottomSheetEntity: Identifiable, Codable {
let lookbookId: Int
let codiId: Int
let imageUrl: String
let title: String
let count: Int
var id: Int { lookbookId }
private enum CodingKeys: String, CodingKey {
case lookbookId, codiId, imageUrl, title, count
}
}| let content: String | ||
| var locationX: CGFloat | ||
| var locationY: CGFloat | ||
| var isRightSide: Bool = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let locationX: Double | ||
| let locationY: Double | ||
| let ratio: Double | ||
| let degree: Int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // 이미지 위치에 따른 태그 방향 결정 (임계값 200) | ||
| let isImageOnRight = item.x > 200 | ||
| self.selectedItemTags = [ | ||
| ClothTagEntity( | ||
| title: item.brandName, | ||
| content: item.clothName, | ||
| locationX: 0.5, | ||
| locationY: 0.5, | ||
| isRightSide: !isImageOnRight | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isImageOnRight를 결정하기 위해 매직 넘버 200을 사용하고 있습니다. 이는 뷰의 크기가 변경될 때 깨지기 쉬운 구현입니다. 또한, 이 로직으로 설정된 ClothTagEntity의 isRightSide 속성은 HomeHasCodiView에서 실제 태그 위치를 계산할 때 사용되지 않고 있어 불필요합니다. 뷰에서 직접 위치를 계산하도록 하고, ViewModel과 Entity에서 관련 로직을 제거하는 것이 좋습니다.
self.selectedItemTags = [
ClothTagEntity(
title: item.brandName,
content: item.clothName,
locationX: 0.5,
locationY: 0.5
)
]
🔗 연결된 이슈
Resolved #43
✨ 주요 작업사항
이 Pull Request는 Home 기능에 대한 대규모 개선과 리팩토링을 도입하며,
데이터 접근의 모듈화, 도메인 모델 확장, 의존성 관리 개선에 중점을 둡니다.
이번 변경을 통해 새로운 Use Case가 추가되었고, Repository 및 Datasource 인터페이스가 확장되었으며,
카테고리 관리, 의류 아이템 조회, 코디 보드 작업, 룩북 연동 등 Home 화면의 추가 기능을 지원하기 위해 데이터 모델이 더욱 풍부해졌습니다.
Domain Model & DTO Extensions:
(HomeClothEntity, ClothListRequestDTO, ClothListResponseDTO,
CodiCoordinateRequestDTO, LookBookBottomSheetEntity), 또한 데이터 변환을 더 깔끔하게 처리하기 위해 매핑 확장(extension) 이 추가되었습니다.
Repository & Data Source Refactoring:
Dependency Injection & Use Case Layer:
UI Text Improvements:
더 명확한 메시지를 제공하고 Home 화면의 신규 기능을 지원합니다.
Code Organization & Comments:
데이터 접근과 도메인 로직의 관심사를 분리하여 코드 가독성과 유지보수성을 향상시켰습니다.
Most important changes:
1. Domain Model & DTO 확장
CodiCoordinateRequestDTO, LookBookBottomSheetEntity 등 새로운 Entity 및 DTO가 도입되었고,
Home 기능 확장을 지원하기 위한 매핑 extension이 추가되었습니다.
2. Repository & Data Source Refactoring
3. Dependency Injection & Use Case Layer
HomeViewModel을 싱글톤으로 관리하며,
ViewModel에 보다 세분화된 의존성 주입이 가능해졌습니다.
4. UI Text Improvements
5. Code Organization & Comments
전반적인 가독성과 유지보수성이 향상되었습니다.
📸 스크린샷 / 동영상
🔍 리뷰어에게 (선택)