Skip to content

Commit

Permalink
fix/#367 지각 꾸물이 뷰 분기 처리 시 앱 충돌하는 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
youz2me committed Sep 9, 2024
1 parent 1feac5a commit 0836832
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ class ReadyStatusViewController: BaseViewController {
extension ReadyStatusViewController {
func setupBinding() {
viewModel.promiseInfo.bindOnMain(with: self) { owner, model in
owner.rootView.myReadyStatusProgressView.isUserInteractionEnabled = (model?.isParticipant ?? false)
if let isParticipant = model?.isParticipant {
owner.rootView.myReadyStatusProgressView.isUserInteractionEnabled = isParticipant
owner.rootView.enterReadyButtonView.isUserInteractionEnabled = isParticipant
}
}

viewModel.myReadyStatus.bind(with: self) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ class TardyViewController: BaseViewController {
fatalError("init(coder:) has not been implemented")
}

override func loadView() {
view = viewModel.isPastDue.value ? arriveView : tardyView
}

override func viewDidLoad() {
super.viewDidLoad()

Expand All @@ -41,11 +37,23 @@ class TardyViewController: BaseViewController {

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

viewModel.fetchTardyInfo()
}


// MARK: - Setup

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

[tardyView, arriveView].forEach {
$0.snp.makeConstraints {
$0.edges.equalToSuperview()
}
}
}

override func setupDelegate() {
tardyView.tardyCollectionView.dataSource = self
}
Expand All @@ -71,10 +79,11 @@ private extension TardyViewController {
)
}

viewModel.hasTardy.bind(with: self) { owner, hasTardy in
DispatchQueue.main.async {
owner.view = hasTardy && owner.viewModel.isPastDue.value ? owner.arriveView : owner.tardyView
}
viewModel.hasTardy.bindOnMain(with: self) { owner, hasTardy in
let flag = hasTardy && owner.viewModel.isPastDue.value

owner.arriveView.isHidden = !flag
owner.tardyView.isHidden = flag
}

viewModel.comers.bind(with: self) { owner, comers in
Expand Down

0 comments on commit 0836832

Please sign in to comment.