Skip to content

Commit

Permalink
🐛 처음 시작 시, 자동 재생되지 않았던 오류 해결
Browse files Browse the repository at this point in the history
bind 하기 전에 timer을 실행시켜준 것이 문제였음
  • Loading branch information
mingun authored and mingun committed Dec 11, 2023
1 parent d686438 commit 5e3d4ac
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public final class RewindJourneyViewController: UIViewController {
private var presentingImageIndex: Int? {
didSet {
DispatchQueue.main.async { self.changeProgressViews() }
self.restartTimer()
}
}

Expand Down Expand Up @@ -89,9 +90,9 @@ public final class RewindJourneyViewController: UIViewController {

public override func viewDidLoad() {
super.viewDidLoad()
self.progressViewBinding()
self.timerBinding()
self.configure()
self.bind()
self.viewModel.trigger(.viewNeedsLoaded)
}

Expand All @@ -105,7 +106,7 @@ public final class RewindJourneyViewController: UIViewController {

// MARK: - Combine Binding

private func bind() {
private func progressViewBinding() {
self.viewModel.state.photoURLs
.sink { [weak self] urls in
self?.configureProgressViewsLayout(urls: urls)
Expand All @@ -124,8 +125,8 @@ public final class RewindJourneyViewController: UIViewController {
}

private func restartTimer() {
self.viewModel.trigger(.startAutoPlay)
self.viewModel.trigger(.stopAutoPlay)
self.viewModel.trigger(.startAutoPlay)
}

// MARK: - Configuration
Expand Down Expand Up @@ -279,7 +280,6 @@ public final class RewindJourneyViewController: UIViewController {
self.progressViews?[index].isLeftOfCurrentHighlighting = index < presentingIndex ? true : false
self.progressViews?[index].isHighlighted = index <= presentingIndex ? true : false
}
self.restartTimer()
}

// MARK: - Actions
Expand Down

0 comments on commit 5e3d4ac

Please sign in to comment.