diff --git a/PPAK_CVS/Sources/Scenes/Bookmark/BookmarkVC.swift b/PPAK_CVS/Sources/Scenes/Bookmark/BookmarkVC.swift index b872bf42..9813a287 100644 --- a/PPAK_CVS/Sources/Scenes/Bookmark/BookmarkVC.swift +++ b/PPAK_CVS/Sources/Scenes/Bookmark/BookmarkVC.swift @@ -130,8 +130,6 @@ final class BookmarkViewController: BaseViewController, View { make.width.equalTo(165) make.height.equalTo(107) } - - self.animationContainerView.isHidden = true } // MARK: - Bind @@ -168,13 +166,18 @@ final class BookmarkViewController: BaseViewController, View { .disposed(by: disposeBag) // 서치바 텍스트 반응 - header.searchBar.textField.rx.controlEvent(.editingDidEndOnExit) - .withUnretained(self) - .compactMap { $0.0.header.searchBar.textField.text } + header.searchBar.textField.rx.text + .orEmpty .map { BookmarkViewReactor.Action.didChangeSearchBarText($0) } .bind(to: reactor.action) .disposed(by: disposeBag) + // 검색버튼 클릭 + header.searchBar.textField.rx.controlEvent(.editingDidEndOnExit) + .map { BookmarkViewReactor.Action.didTapSearchButton } + .bind(to: reactor.action) + .disposed(by: disposeBag) + // 찜 정보 터치 /* header.infoTouchView.rx.tapGesture() @@ -269,7 +272,6 @@ final class BookmarkViewController: BaseViewController, View { reactor.state .map { $0.currentProducts } .distinctUntilChanged() - .debug() .withUnretained(self) .bind { $0.0.collectionView.reloadData() } .disposed(by: disposeBag) @@ -277,7 +279,6 @@ final class BookmarkViewController: BaseViewController, View { // 서치바 텍스트 reactor.state .map { $0.currentTarget } - .distinctUntilChanged() .bind(to: header.searchBar.textField.rx.text) .disposed(by: disposeBag) diff --git a/PPAK_CVS/Sources/Scenes/Bookmark/BookmarkViewReactor.swift b/PPAK_CVS/Sources/Scenes/Bookmark/BookmarkViewReactor.swift index 37c66947..190198bd 100644 --- a/PPAK_CVS/Sources/Scenes/Bookmark/BookmarkViewReactor.swift +++ b/PPAK_CVS/Sources/Scenes/Bookmark/BookmarkViewReactor.swift @@ -14,6 +14,7 @@ final class BookmarkViewReactor: Reactor { case didTapDropdownCVS(CVSDropdownCase) case didTapDropdownSort(SortType) case didChangeSearchBarText(String) + case didTapSearchButton case didTapProduct(Int) } @@ -133,16 +134,17 @@ final class BookmarkViewReactor: Reactor { } case .didChangeSearchBarText(let target): + return .just(.setTarget(target)) + case .didTapSearchButton: let updatedProducts = ProductStorage.shared.retrieve( cvs: currentState.currentCVS, event: currentState.currentEvent, sort: currentState.currentSort, - target: target + target: currentState.currentTarget ) return .concat([ - .just(.setTarget(target)), .just(.hideDropdown), .just(.setProducts(updatedProducts)) ]) diff --git a/PPAK_CVS/Sources/Scenes/Home/HomeVC.swift b/PPAK_CVS/Sources/Scenes/Home/HomeVC.swift index 6f0108ce..337725b9 100644 --- a/PPAK_CVS/Sources/Scenes/Home/HomeVC.swift +++ b/PPAK_CVS/Sources/Scenes/Home/HomeVC.swift @@ -135,13 +135,18 @@ final class HomeViewController: BaseViewController, View { .disposed(by: disposeBag) // 서치바 텍스트 반응 - header.searchBar.textField.rx.controlEvent(.editingDidEndOnExit) - .withUnretained(self) - .compactMap { $0.0.header.searchBar.textField.text } + header.searchBar.textField.rx.text + .orEmpty .map { HomeViewReactor.Action.didChangeSearchBarText($0) } .bind(to: reactor.action) .disposed(by: disposeBag) + // 검색 버튼 반응 + header.searchBar.textField.rx.controlEvent(.editingDidEndOnExit) + .map { HomeViewReactor.Action.didTapSearchButton } + .bind(to: reactor.action) + .disposed(by: disposeBag) + // CVSStorage 편의점 변경 감지 CVSStorage.shared.didChangeCVS .distinctUntilChanged() @@ -214,6 +219,7 @@ final class HomeViewController: BaseViewController, View { // 새로운 상품 목록들로 업데이트 reactor.state .map { $0.products } + .distinctUntilChanged() .map { _ in Void() } .withUnretained(self) .map { $0.0 } diff --git a/PPAK_CVS/Sources/Scenes/Home/HomeViewReactor.swift b/PPAK_CVS/Sources/Scenes/Home/HomeViewReactor.swift index 1dd4f8a7..c44260dc 100644 --- a/PPAK_CVS/Sources/Scenes/Home/HomeViewReactor.swift +++ b/PPAK_CVS/Sources/Scenes/Home/HomeViewReactor.swift @@ -14,6 +14,7 @@ final class HomeViewReactor: Reactor { case didTapDropdownCVS(CVSDropdownCase) case didTapDropdownSort(SortType) case didChangeSearchBarText(String) + case didTapSearchButton case didSelectItemAt(ProductModel) case fetchMoreData } @@ -107,7 +108,6 @@ final class HomeViewReactor: Reactor { ]) case .didTapBookmarkButton: -// guard currentState.showsBookmarkVC == false else { return .empty() } return .concat([ .just(.hideDropdown), .just(.setBookmarkVC(true)), @@ -171,17 +171,19 @@ final class HomeViewReactor: Reactor { ]) case .didChangeSearchBarText(let target): + return .just(.setTarget(target)) + + case .didTapSearchButton: return .concat([ .just(.setLoading(true)), .just(.resetProducts), .just(.resetOffset), - .just(.setTarget(target)), .just(.hideDropdown), requestProducts( cvs: currentState.currentCVSType, event: currentState.currentEventType, sort: currentState.currentSortType, - name: target + name: currentState.currentTarget ) ]) diff --git a/PPAK_CVS/Sources/Scenes/Setting/SettingConfig.swift b/PPAK_CVS/Sources/Scenes/Setting/SettingConfig.swift index 95a96e97..b8f8647d 100644 --- a/PPAK_CVS/Sources/Scenes/Setting/SettingConfig.swift +++ b/PPAK_CVS/Sources/Scenes/Setting/SettingConfig.swift @@ -8,17 +8,17 @@ import Foundation enum Message { - + static let sendMailFail = "메일을 보낼 수 없습니다." static let retry = "메일을 보내려면 'Mail' 앱이 필요합니다.\nApp Store에서 해당 앱을 복원하거나 이메일 설정을 확인하고 다시 시도해주세요." static let email = "whitehyun@icloud.com" - + static let cancel = "취소" static let moveAppStore = "App Store로 이동" } struct Configs { - + static let appID = "id1665633509" static let appStoreMailURL = "https://apps.apple.com/kr/app/mail/id1108187098" }