Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Poppool/Poppool/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// rootViewController.reactor = LoginReactor()


let rootViewController = SearchMainController()
rootViewController.reactor = SearchMainReactor()
// let rootViewController = DetailController()
// rootViewController.reactor = DetailReactor(popUpID: 8)

// let rootViewController = SignUpMainController()
// rootViewController.reactor = SignUpMainReactor()
// let rootViewController = SearchMainController()
// rootViewController.reactor = SearchMainReactor()

// let navigationController = UINavigationController(rootViewController: rootViewController)
let navigationController = WaveTabBarController()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private extension HomeController {

view.addSubview(homeHeaderView)
homeHeaderView.snp.makeConstraints { make in
make.top.equalTo(view.safeAreaLayoutGuide).inset(14)
make.top.equalTo(view.safeAreaLayoutGuide).inset(7)
make.leading.trailing.equalToSuperview()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ extension SearchResultController {
super.viewDidLoad()
setUp()
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
tabBarController?.tabBar.isHidden = true
}
}

// MARK: - SetUp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ final class SearchResultReactor: Reactor {
case .cellTapped(let controller, let indexPath):
return Observable.just(.moveToDetailScene(controller: controller, indexPath: indexPath))
case .returnSearch(let text):
titleSection.inputDataList = [.init(title: "$\(text)$이/가 포함된 팝업")]
titleSection.inputDataList = [.init(title: "\(text)이/가 포함된 팝업")]
return popUpAPIUseCase.getSearchPopUpList(query: text)
.withUnretained(self)
.map { (owner, response) in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ final class SearchReactor: Reactor {
case resetCategory
case changePage
case bookmarkButtonTapped(indexPath: IndexPath)
case resetSearchKeyWord
}

enum Mutation {
Expand All @@ -35,6 +36,7 @@ final class SearchReactor: Reactor {
case moveToSortedScene(controller: BaseViewController)
case moveToDetailScene(controller: BaseViewController, indexPath: IndexPath)
case setSearchKeyWord(text: String?)
case resetSearchKeyWord
}

struct State {
Expand Down Expand Up @@ -96,6 +98,8 @@ final class SearchReactor: Reactor {
func mutate(action: Action) -> Observable<Mutation> {
let sort = sortedIndex == 0 ? "startDate,desc" : "viewCount,desc"
switch action {
case .resetSearchKeyWord:
return Observable.just(.resetSearchKeyWord)
case .changePage:
if isLoading {
return Observable.just(.loadView)
Expand Down Expand Up @@ -205,25 +209,42 @@ final class SearchReactor: Reactor {
controller.navigationController?.pushViewController(nextController, animated: true)
case .setSearchKeyWord(let text):
newState.searchKeyWord = text
case .resetSearchKeyWord:
newState.searchKeyWord = nil
newState.sections = getSection()
}
return newState
}

func getSection() -> [any Sectionable] {
return [
spacing24Section,
recentKeywordTitleSection,
spacing16Section,
recentKeywordSection,
spacing48Section,
searchTitleSection,
spacing16Section,
searchCategorySection,
spacing18Section,
searchSortedSection,
spacing16Section,
searchListSection
]
let searchList = userDefaultService.fetchArray(key: "searchList") ?? []
if searchList.isEmpty {
return [
spacing24Section,
searchTitleSection,
spacing16Section,
searchCategorySection,
spacing18Section,
searchSortedSection,
spacing16Section,
searchListSection
]
} else {
return [
spacing24Section,
recentKeywordTitleSection,
spacing16Section,
recentKeywordSection,
spacing48Section,
searchTitleSection,
spacing16Section,
searchCategorySection,
spacing18Section,
searchSortedSection,
spacing16Section,
searchListSection
]
}
}

func setSearchList() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private extension SearchCategoryView {
self.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.leading.equalToSuperview().inset(20)
make.top.equalToSuperview().inset(32)
make.top.equalToSuperview().inset(12)
}

self.addSubview(closeButton)
Expand All @@ -76,7 +76,7 @@ private extension SearchCategoryView {
self.addSubview(contentCollectionView)
contentCollectionView.snp.makeConstraints { make in
make.leading.trailing.equalToSuperview()
make.top.equalTo(titleLabel.snp.bottom).offset(24)
make.top.equalTo(titleLabel.snp.bottom).offset(10)
make.height.equalTo(195)
}
self.addSubview(buttonStackView)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ extension SearchMainController {
super.viewDidLoad()
setUp()
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
tabBarController?.tabBar.isHidden = true
}
}

// MARK: - SetUp
Expand All @@ -68,10 +73,11 @@ extension SearchMainController {
beforeController.reactor?.state
.withUnretained(self)
.subscribe(onNext: { (owner, state) in
owner.view.endEditing(true)
if let text = state.searchKeyWord {
owner.scrollToPage(.at(index: 1), animated: false)
if let index = owner.currentIndex {
if index == 0 {
if index == 0 {
owner.scrollToPage(.at(index: 1), animated: false)
reactor.action.onNext(.returnSearchKeyWord(text: text))
owner.mainView.searchTextField.text = state.searchKeyWord
}
Expand Down Expand Up @@ -113,9 +119,18 @@ extension SearchMainController {

mainView.cancelButton.rx.tap
.withUnretained(self)
.subscribe { (owner, _) in
owner.navigationController?.popViewController(animated: true)
.map { (owner, _) in
owner.view.endEditing(true)
if owner.currentIndex == 1 {
owner.mainView.searchTextField.text = nil
owner.beforeController.reactor?.action.onNext(.resetSearchKeyWord)
owner.scrollToPage(.at(index: 0), animated: false)
} else {
owner.navigationController?.popViewController(animated: true)
}
return Reactor.Action.returnSearchKeyWord(text: nil)
}
.bind(to: reactor.action)
.disposed(by: disposeBag)

mainView.clearButton.rx.tap
Expand All @@ -130,7 +145,6 @@ extension SearchMainController {
.withUnretained(self)
.subscribe { (owner, state) in
if let text = state.searchKeyword {
print(text)
owner.afterController.reactor?.action.onNext(.returnSearch(text: text))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class WaveTabBarController: UITabBarController, UITabBarControllerDelegate {
for (index, otherView) in tabBarItemViews.enumerated() {
if index != selectedIndex { otherView.transform = .identity }
}
selectedView.transform = CGAffineTransform(scaleX: 1.1, y: 1.1)
selectedView.transform = CGAffineTransform(scaleX: 1.05, y: 1.05)
}
)
}
Expand Down