Skip to content
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

[Feat] #300 - DetailSearchView 상세탐색 기능 2차 구현 #302

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

Guryss
Copy link
Contributor

@Guryss Guryss commented Oct 30, 2024

⭐️Issue

close #300

🌟Motivation

  • 상세탐색 기능 마무리 했습니다.

🌟Key Changes

📚 이전뷰에 따른 DetailSearchResultView 분기처리 로직

SearchView에서 넘어온것인지 DetailSearchResultView 내 서치바에서 넘어온 것인지의 여부에 따라 뷰 로직이 다릅니다.

  • SearchView: DetailSearch 에서 검색 -> DetailSearchModal dismiss & SearchView에서 DetailSearchResultView push
  • DetailSearchResultView 내 서치바: DetailSearch 에서 검색 -> DetailSearchModal dismiss & 기존 뷰에서 데이터 reload

init 즉 뷰모델을 초기화할 때 같이 매개변수로 뷰타입 열거형을 받을 수 있도록 구현했습니다.

enum PreviousViewType {
    case search
    case resultSearchBar
}

DetailSearchViewModel에서 이전뷰가 어떤 뷰인지에 따른 노티피케이션을 다르게 줄 수 있도록 구현했습니다.

 if owner.previousViewInfo == .search {
                    NotificationCenter.default.post(name: owner.pushToDetailSearchResultViewControllerNotificationName,
                                                    object: nil,
                                                    userInfo: userInfo)
                    owner.dismissModalViewController.accept(())
                } else {
                    NotificationCenter.default.post(name: owner.pushToUpdateDetailSearchResultViewControllerNotificationName,
                                                    object: nil,
                                                    userInfo: userInfo)
                    owner.dismissModalViewController.accept(())
                }

📚재검색 시 모달에 선택한 데이터 남아있도록 구현

DetailSearchResultView 에서 서치바를 클릭하여 검색을 다시 할 때 DetailSearchView에 선택한 데이터가 남아있어야 합니다.
넘겨주는 데이터를 구조체 SearchFilterQuery로 정의했습니다.

struct SearchFilterQuery {
    let keywords: [KeywordData]
    let genres: [NovelGenre]
    let isCompleted: Bool?
    let novelRating: Float?
}

DetailSearchViewModel에서 viewDidLoad 시점에 넘어온 데이터를 받아올 수 있도록 했습니다.

input.viewDidLoadEvent
            .subscribe(with: self, onNext: { owner, _ in
                owner.genreListData.accept(NovelGenre.allCases)
                owner.selectedGenreListData.accept(owner.selectedFilteredQuery.genres)
                owner.selectedKeywordListData.accept(owner.selectedFilteredQuery.keywords)
                owner.selectedCompletedStatus.accept(owner.selectedFilteredQuery.isCompleted.map { CompletedStatus(isCompleted: $0) })
                owner.selectedNovelRatingStatus.accept(owner.selectedFilteredQuery.novelRating.map { NovelRatingStatus(toFloat: $0) })
            })
            .disposed(by: disposeBag)

🌟Simulation

ScreenRecording_11-08-2024.2000-26-29_1.MP4

🌟To Reviewer

도움을 주신 여러분들에게 감사의 말씀을 드려봅니다 ♡

🌟Reference


@Guryss Guryss removed the reviewYet label Nov 7, 2024
@Guryss Guryss requested review from ena-isme, Naknakk and hyowon612 and removed request for ena-isme and Naknakk November 7, 2024 15:45
Copy link
Contributor

@hyowon612 hyowon612 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

복잡한 뷰인데 넘 고생 많았습니당 !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] 상세탐색뷰 기능 2차 구현
2 participants