Skip to content

Commit

Permalink
Merge branch 'refactor/#388-promise' of https://github.com/OMZigak/iOS
Browse files Browse the repository at this point in the history
…into refactor/#388-promise
  • Loading branch information
hooni0918 committed Sep 20, 2024
2 parents 525c0d8 + 081b77c commit ecb4580
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
12 changes: 0 additions & 12 deletions KkuMulKum/Resource/ObservablePattern/ObservablePattern.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,13 @@ class ObservablePattern<T> {

func bind(_ listener: @escaping (T) -> Void) {
listeners.append(listener)

listener(value)
}

func bind<Object: AnyObject>(with object: Object, _ listener: @escaping (Object, T) -> Void) {
listeners.append { [weak object] value in
guard let object else { return }
listener(object, value)
}

listener(object, value)
}

func bindOnMain(_ listener: @escaping (T) -> Void) {
Expand All @@ -49,10 +45,6 @@ class ObservablePattern<T> {
listener(value)
}
}

DispatchQueue.main.async {
listener(self.value)
}
}

func bindOnMain<Object: AnyObject>(with object: Object, _ listener: @escaping (Object, T) -> Void) {
Expand All @@ -62,9 +54,5 @@ class ObservablePattern<T> {
listener(object, value)
}
}

DispatchQueue.main.async {
listener(object, self.value)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class ReadyStatusProgressView: BaseView {
}

arrivalCheckImageView.snp.makeConstraints {
$0.centerX.equalTo(arrivalTimeLabel)
$0.trailing.equalToSuperview().inset(53.5)
$0.centerY.equalTo(readyStartCheckImageView)
$0.height.equalTo(Screen.height(16))
$0.width.equalTo(arrivalCheckImageView.snp.height)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,14 @@ extension ReadyStatusViewController {
}

viewModel.myReadyInfo.bindOnMain(with: self) { owner, status in
let preparationStartAt = status?.preparationStartAt ?? " "
let departureAt = status?.departureAt ?? " "
let arrivalAt = status?.arrivalAt ?? " "

owner.rootView.do {
$0.myReadyStatusProgressView.readyStartTimeLabel.text = preparationStartAt
$0.myReadyStatusProgressView.moveStartTimeLabel.text = departureAt
$0.myReadyStatusProgressView.arrivalTimeLabel.text = arrivalAt
$0.enterReadyButtonView.isHidden = owner.viewModel.isReadyInfoEntered()
$0.readyPlanInfoView.isHidden = !$0.enterReadyButtonView.isHidden
}
Expand Down Expand Up @@ -181,9 +188,9 @@ extension ReadyStatusViewController {
$0.readyStartButton.isEnabled = false
$0.moveStartButton.isEnabled = false
$0.arrivalButton.isEnabled = false
$0.readyStartTitleLabel.isHidden = false
$0.moveStartTitleLabel.isHidden = false
$0.arrivalTitleLabel.isHidden = false
$0.readyStartTitleLabel.isHidden = true
$0.moveStartTitleLabel.isHidden = true
$0.arrivalTitleLabel.isHidden = true
$0.readyStartTimeLabel.isHidden = false
$0.moveStartTimeLabel.isHidden = false
$0.arrivalTimeLabel.isHidden = false
Expand Down

0 comments on commit ecb4580

Please sign in to comment.