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 10, 2023
1 parent d4f6752 commit 86494ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 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 {
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
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ extension RewindJourneyViewModel {
private extension RewindJourneyViewModel {

func startTimer() {
self.timer = Timer.publish(every: self.timerTimeInterval, on: .main, in: .common)
self.timer = Timer.publish(every: self.timerTimeInterval, on: .current, in: .common)
.autoconnect()
.receive(on: DispatchQueue.global(qos: .background))
.sink { [weak self] _ in
Expand Down

0 comments on commit 86494ce

Please sign in to comment.