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

๐Ÿ”จ [FIX] ์ปค๋ฎค๋‹ˆํ‹ฐ ํ•™๊ณผ ํ•„ํ„ฐ ์„ค์ • ํ›„ ๋‹ค๋ฅธ ํƒญ์œผ๋กœ ์ด๋™ ํ›„ ๋‹ค์‹œ ๋Œ์•„์˜ค๋ฉด ํ•„ํ„ฐ ๊ธฐ๋Šฅ ํ’€๋ ค์žˆ๋Š” ์ด์Šˆ ๋Œ€์‘ #626

Merged
merged 3 commits into from
Oct 26, 2022
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class CommunityMainReactor: Reactor {
case setFilterBtnState(selected: Bool)
case setFilterMajorID(majorID: Int)
case setRefreshLoading(loading: Bool)
case setTapSegmentState(state: Bool)
case setAnimateToTopState(state: Bool)
case setAlertState(showState: Bool, message: String = AlertType.networkError.alertMessage)
case updateAccessToken(state: Bool, action: Action)
}
Expand All @@ -43,7 +43,7 @@ final class CommunityMainReactor: Reactor {
var majorList: [MajorInfoModel] = []
var filterBtnSelected: Bool = false
var filterMajorID: Int = MajorIDConstants.allMajorID
var toSetContentOffsetZero: Bool = true
var animateToTopState: Bool = true
var showAlert: Bool = false
var alertMessage: String = ""
var isUpdateAccessToken: Bool = false
Expand All @@ -65,6 +65,7 @@ extension CommunityMainReactor {
Observable.just(.setLoading(loading: true)),
Observable.just(.setFilterBtnState(selected: fill)),
Observable.just(.setFilterMajorID(majorID: majorID)),
Observable.just(.setAnimateToTopState(state: true)),
self.requestCommunityList(majorID: majorID, type: type, sort: "recent", search: "")
])
case .requestNewCommunityList(let majorID, let type, let sort, let search):
Expand All @@ -82,7 +83,7 @@ extension CommunityMainReactor {
case .tapSegmentedControl(let majorID, let type, let sort, let search):
return Observable.concat([
Observable.just(.setLoading(loading: true)),
Observable.just(.setTapSegmentState(state: true)),
Observable.just(.setAnimateToTopState(state: true)),
self.requestCommunityList(majorID: majorID, type: type, sort: sort, search: search)
])
}
Expand All @@ -105,8 +106,8 @@ extension CommunityMainReactor {
newState.refreshLoading = loading
case .setFilterMajorID(let majorID):
newState.filterMajorID = majorID
case .setTapSegmentState(let state):
newState.toSetContentOffsetZero = state
case .setAnimateToTopState(let state):
newState.animateToTopState = state
case .setAlertState(let showState, let message):
newState.showAlert = showState
newState.alertMessage = message
Expand All @@ -131,7 +132,7 @@ extension CommunityMainReactor {
observer.onNext(Mutation.requestCommunityList(communityList: data))
observer.onNext(Mutation.setRefreshLoading(loading: false))
observer.onNext(Mutation.setLoading(loading: false))
observer.onNext(Mutation.setTapSegmentState(state: false))
observer.onNext(Mutation.setAnimateToTopState(state: false))
observer.onCompleted()
}
case .requestErr(let res):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ final class CommunityMainVC: BaseVC, View {
}

override func viewWillAppear(_ animated: Bool) {
reactor?.action.onNext(.requestNewCommunityList(type: PostFilterType(rawValue: communitySegmentedControl.selectedSegmentIndex) ?? .community))
reactor?.action.onNext(.requestNewCommunityList(majorID: reactor?.currentState.filterMajorID, type: PostFilterType(rawValue: communitySegmentedControl.selectedSegmentIndex) ?? .community, sort: "recent", search: ""))
}

func bind(reactor: CommunityMainReactor) {
Expand Down Expand Up @@ -178,7 +178,7 @@ extension CommunityMainVC {
self?.setEmptyLabelIsHidden(isHidden: true)
} else {
self?.activityIndicator.stopAnimating()
if reactor.currentState.toSetContentOffsetZero {
if reactor.currentState.animateToTopState {
self?.communitySV.contentOffset.y = 0
}
self?.setEmptyLabelIsHidden(isHidden: reactor.currentState.communityList.isEmpty ? false : true)
Expand Down