From 5aab81a650eebe7bcfd1fae9a24fad018ecb5755 Mon Sep 17 00:00:00 2001 From: hwangJi-dev Date: Wed, 2 Nov 2022 23:10:48 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=C2=A0Chore:=20CommunityMain=20?= =?UTF-8?q?=EC=84=B1=EB=8A=A5=20=EA=B0=9C=EC=84=A0=EC=9D=84=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20=EC=9E=90=EC=9E=98=ED=95=9C=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#690)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screen/Community/VC/CommunityMainVC.swift | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/NadoSunbae-iOS/NadoSunbae-iOS/Screen/Community/VC/CommunityMainVC.swift b/NadoSunbae-iOS/NadoSunbae-iOS/Screen/Community/VC/CommunityMainVC.swift index 3117d664..2dc4f1ec 100644 --- a/NadoSunbae-iOS/NadoSunbae-iOS/Screen/Community/VC/CommunityMainVC.swift +++ b/NadoSunbae-iOS/NadoSunbae-iOS/Screen/Community/VC/CommunityMainVC.swift @@ -142,6 +142,7 @@ extension CommunityMainVC { private func bindState(_ reactor: CommunityMainReactor) { reactor.state .map { $0.communityList } + .distinctUntilChanged() .bind(to: communityTV.rx.items) { tableView, index, item in let indexPath = IndexPath(row: index, section: 0) @@ -175,6 +176,7 @@ extension CommunityMainVC { .subscribe(onNext: { [weak self] loading in DispatchQueue.main.async { self?.view.bringSubviewToFront(self?.activityIndicator ?? UIView()) + if loading { self?.activityIndicator.startAnimating() self?.setEmptyLabelIsHidden(isHidden: true) @@ -182,6 +184,7 @@ extension CommunityMainVC { self?.activityIndicator.stopAnimating() if reactor.currentState.animateToTopState { self?.communitySV.contentOffset.y = 0 + reactor.action.onNext(.changeAnimateState) } self?.setEmptyLabelIsHidden(isHidden: reactor.currentState.communityList.isEmpty ? false : true) } @@ -305,7 +308,7 @@ extension CommunityMainVC { $0.top.equalToSuperview() $0.leading.equalToSuperview().offset(16) $0.trailing.bottom.equalToSuperview().offset(-16) - $0.height.equalTo(0) + $0.height.equalTo(UIScreen.main.bounds.height) } } @@ -352,8 +355,8 @@ extension CommunityMainVC { self.present(slideVC, animated: true) } - private func sendFilterFilledAction(majorName: String, majorID: Int) { - self.reactor?.action.onNext(.filterFilled(fill: majorName == "" ? false : true, majorID: majorID, type: PostFilterType(rawValue: 0) ?? .community)) + private func sendFilterFilledAction(majorName: String, majorID: Int, selectedIndex: Int) { + self.reactor?.action.onNext(.filterFilled(fill: majorName == "" ? false : true, majorID: majorID, type: PostFilterType(rawValue: selectedIndex) ?? .community)) } } @@ -392,9 +395,10 @@ extension CommunityMainVC: SendPostTypeDelegate { // MARK: - SendCommunityInfoDelegate extension CommunityMainVC: SendCommunityInfoDelegate { func sendCommunityInfo(majorID: Int, majorName: String) { - self.activityIndicator.startAnimating() + let selectedIndex = communitySegmentedControl.selectedSegmentIndex DispatchQueue.global().async { - self.sendFilterFilledAction(majorName: majorName, majorID: majorID) + self.sendFilterFilledAction(majorName: majorName, majorID: majorID, selectedIndex: selectedIndex) } } + }