Skip to content

Commit

Permalink
fix/#367 지각꾸물이 뷰 분기처리
Browse files Browse the repository at this point in the history
  • Loading branch information
youz2me committed Sep 10, 2024
1 parent b8215cb commit 59bb979
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ class TardyViewController: BaseViewController {
// MARK: - Setup

override func setupView() {
view.addSubviews(tardyView, arriveView)
view.addSubviews(arriveView, tardyView)

[tardyView, arriveView].forEach {
[arriveView, tardyView].forEach {
$0.snp.makeConstraints {
$0.edges.equalToSuperview()
}
Expand All @@ -66,8 +66,6 @@ private extension TardyViewController {
func setupBinding() {
/// 시간이 지나고 지각자가 없을 때 arriveView로 띄워짐
viewModel.isPastDue.bindOnMain(with: self) { owner, isPastDue in
owner.tardyView.tardyCollectionView.isHidden = !isPastDue
owner.tardyView.tardyEmptyView.isHidden = isPastDue
owner.tardyView.finishMeetingButton.isEnabled = (isPastDue && (owner.viewModel.promiseInfo.value?.isParticipant ?? false))
}

Expand All @@ -80,10 +78,13 @@ private extension TardyViewController {
}

viewModel.hasTardy.bindOnMain(with: self) { owner, hasTardy in
let flag = hasTardy && owner.viewModel.isPastDue.value

owner.arriveView.isHidden = !flag
owner.tardyView.isHidden = flag
let isPastDue = owner.viewModel.isPastDue.value
let arriveHideFlag = !(isPastDue && !hasTardy)

owner.arriveView.isHidden = arriveHideFlag
owner.tardyView.isHidden = !arriveHideFlag
owner.tardyView.tardyCollectionView.isHidden = !isPastDue
owner.tardyView.tardyEmptyView.isHidden = isPastDue
}

viewModel.comers.bind(with: self) { owner, comers in
Expand Down
2 changes: 1 addition & 1 deletion KkuMulKum/Source/Promise/ViewModel/PromiseViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ extension PromiseViewModel {
return
}

hasTardy.value = data.lateComers.isEmpty
hasTardy.value = !(data.lateComers.isEmpty)
isPastDue.value = data.isPastDue
penalty.value = data.penalty
comers.value = data.lateComers
Expand Down

0 comments on commit 59bb979

Please sign in to comment.