Skip to content

Commit

Permalink
[#57]Feat: 타이머가 활성화 중인지 유무 확인 변수 output.isTimerActive 구독
Browse files Browse the repository at this point in the history
- output.isTimerActive가 true일 때 pause view를 hidden하고 false일 때 보여주기
  • Loading branch information
Minny27 committed Feb 1, 2024
1 parent 1912acf commit 85c5820
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class FallingUserCollectionViewCell: UserCardViewCollectionViewCell {
$0.height.equalTo(32)
}

self.showUserCardDimView()
self.showDimView()
}

override func prepareForReuse() {
Expand Down Expand Up @@ -66,13 +66,23 @@ final class FallingUserCollectionViewCell: UserCardViewCollectionViewCell {

output.timeStart
.drive(with: self, onNext: { owner, _ in
owner.hiddenUserCardDimView()
owner.hiddenDimView()
})
.disposed(by: disposeBag)

output.timeZero
.drive(scrollToNextObserver)
.disposed(by: disposeBag)

output.isTimerActive
.drive(with: self) { owner, value in
if value {
owner.hiddenPauseView()
} else {
owner.showPauseView()
}
}
.disposed(by: disposeBag)

profileCarouselView.infoButton.rx.tap.asDriver()
.scan(true) { lastValue, _ in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ final class FallinguserCollectionViewCellModel: ViewModelType {
let timeState: Driver<TimeState>
let timeStart: Driver<Void>
let timeZero: Driver<Void>
let isTimerActive: Driver<Bool>
}

func transform(input: Input) -> Output {
Expand Down Expand Up @@ -164,12 +165,14 @@ final class FallinguserCollectionViewCellModel: ViewModelType {
let timeState = timer.map { TimeState(rawValue: $0) }
let timeStart = timer.filter { $0 == 8.0 }.map { _ in }
let timeZero = timer.filter { $0 == 0 }.map { _ in }
let isTimerActive = timerActiveTrigger.asDriver(onErrorJustReturn: true)

return Output(
user: user,
timeState: timeState,
timeStart: timeStart,
timeZero: timeZero
timeZero: timeZero,
isTimerActive: isTimerActive
)
}
}

0 comments on commit 85c5820

Please sign in to comment.