-
Notifications
You must be signed in to change notification settings - Fork 0
컬렉션 API 연동 #270
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
컬렉션 API 연동 #270
Conversation
Summary of ChangesHello @pinocchio22, 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! 이 PR은 컬렉션 관리 기능을 백엔드 API와 연동하여 사용자가 컬렉션 목록을 조회하고 새로운 컬렉션을 생성할 수 있도록 합니다. 기존의 더미 데이터를 제거하고 실제 서버 데이터를 활용하도록 시스템을 확장하며, UI 컴포넌트가 이미지 URL을 기반으로 콘텐츠를 동적으로 로드할 수 있도록 개선합니다. Highlights
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. 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
컬렉션 조회 및 추가를 위한 API 연동 작업을 검토했습니다. 전반적으로 Clean Architecture에 따라 잘 구현되었지만, 몇 가지 개선점과 수정이 필요한 부분이 있습니다. 특히 CollectionListReactor에서 API 연동 후 발생한 버그는 앱 크래시를 유발할 수 있어 수정이 시급합니다. 또한, 코드에 남아있는 디버깅용 print 구문들을 제거하고, 도메in 모델의 날짜 타입을 표준 Date로 변경하여 코드의 안정성과 유지보수성을 높이는 것을 제안합니다.
| case .viewWillAppear: | ||
| return collectionListUseCase.execute().map { .setListData($0) } | ||
| case .itemTapped(let index): | ||
| return .just(.navigateTo(.detail(currentState.collections[index]))) |
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.
itemTapped 액션이 currentState.collections를 사용하여 상세 페이지로 이동하고 있습니다. 하지만 API 연동 후 실제 데이터는 collectionListData에 저장되므로, collections는 더미 데이터를 담고 있거나 collectionListData와 동기화되지 않은 상태일 수 있습니다. 이로 인해 잘못된 데이터로 상세 페이지가 열리거나, 인덱스가 맞지 않아 앱이 크래시될 수 있습니다. collectionListData의 데이터를 사용하도록 수정해야 합니다.
case .itemTapped(let index):
// FIXME: `collections`는 더미 데이터입니다. `collectionListData`를 사용해야 합니다.
// `collectionListData[index]`를 `BookmarkCollection`으로 변환하는 로직이 필요합니다.
return .just(.navigateTo(.detail(currentState.collections[index])))|
|
||
| public struct State { | ||
| @Pulse var route: Route | ||
| var collections: [BookmarkCollection] |
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.
| self.initialState = State(route: .none, collections: [ | ||
| BookmarkCollection(id: 1, title: "1번", items: [ | ||
| BookmarkCollection(id: 1, title: "1000번", items: [ | ||
| DictionaryItem(id: 1, type: .item, mainText: "1번 아이템", subText: "1번 설명", image: .add, isBookmarked: false), | ||
| DictionaryItem(id: 2, type: .item, mainText: "2번 아이템", subText: "2번 설명", image: .add, isBookmarked: false) | ||
| ]), | ||
| BookmarkCollection(id: 2, title: "2번", items: [ | ||
| BookmarkCollection(id: 2, title: "2000번", items: [ | ||
| DictionaryItem(id: 3, type: .item, mainText: "3번 아이템", subText: "3번 설명", image: .add, isBookmarked: false), | ||
| DictionaryItem(id: 4, type: .item, mainText: "4번 아이템", subText: "4번 설명", image: .add, isBookmarked: false) | ||
| ]) | ||
| ]) | ||
| ], collectionListData: []) |
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.
| public let recentBookmarks: [BookmarkDTO] | ||
|
|
||
| public func toDomain() -> CollectionListResponse { | ||
| return CollectionListResponse(collectionId: collectionId, name: name, createdAt: createdAt, recentBookmarks: recentBookmarks.toDomain()) |
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.
| public func createCollectionList(name: String) -> Completable { | ||
| let endPoint = CollectionEndPoint.createCollectionList(body: CreateCollectionRequestDTO(name: name)) | ||
| return provider.requestData(endPoint: endPoint, interceptor: tokenInterceptor) | ||
|
|
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.
| loadImages(from: input.images) { [weak self] images in | ||
| print("이미지:\(images)") | ||
| self?.cellView.setImages(images: images) | ||
| } |
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.
| private func loadImages(from urls: [String?], completion: @escaping ([UIImage?]) -> Void) { | ||
|
|
||
| var results = [UIImage?](repeating: nil, count: urls.count) | ||
| let dispatchGroup = DispatchGroup() | ||
|
|
||
| for (index, urlString) in urls.enumerated() { | ||
| dispatchGroup.enter() | ||
|
|
||
| ImageLoader.shared.loadImage(stringURL: urlString) { image in | ||
| results[index] = image | ||
| dispatchGroup.leave() | ||
| } | ||
| } | ||
|
|
||
| dispatchGroup.notify(queue: .main) { | ||
| completion(results) | ||
| } | ||
| } |
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 imageView = view.subviews.compactMap { $0 as? UIImageView }.first | ||
| print("이미지 뷰 설정") | ||
| imageView?.image = index < images.count ? images[index] : nil | ||
| } | ||
| } |
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.
| case .sort(let type): | ||
| print("sortsort실행~~~~~~~~~~~~~~~~~~~~~~~") | ||
| let viewController = owner.sortedFactory.make( |
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.
📌 이슈
✅ 작업 사항