From 083683238130a738cfeff0da1b176d631fa677db Mon Sep 17 00:00:00 2001 From: youz2me Date: Tue, 10 Sep 2024 02:09:36 +0900 Subject: [PATCH] =?UTF-8?q?fix/#367=20=EC=A7=80=EA=B0=81=20=EA=BE=B8?= =?UTF-8?q?=EB=AC=BC=EC=9D=B4=20=EB=B7=B0=20=EB=B6=84=EA=B8=B0=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=8B=9C=20=EC=95=B1=20=EC=B6=A9=EB=8F=8C=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReadyStatusViewController.swift | 5 +++- .../ViewController/TardyViewController.swift | 25 +++++++++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/KkuMulKum/Source/Promise/ReadyStatus/ViewController/ReadyStatusViewController.swift b/KkuMulKum/Source/Promise/ReadyStatus/ViewController/ReadyStatusViewController.swift index d24094cb..74c1b750 100644 --- a/KkuMulKum/Source/Promise/ReadyStatus/ViewController/ReadyStatusViewController.swift +++ b/KkuMulKum/Source/Promise/ReadyStatus/ViewController/ReadyStatusViewController.swift @@ -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) { diff --git a/KkuMulKum/Source/Promise/Tardy/ViewController/TardyViewController.swift b/KkuMulKum/Source/Promise/Tardy/ViewController/TardyViewController.swift index dba12081..43ff1f2d 100644 --- a/KkuMulKum/Source/Promise/Tardy/ViewController/TardyViewController.swift +++ b/KkuMulKum/Source/Promise/Tardy/ViewController/TardyViewController.swift @@ -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() @@ -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 } @@ -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