From 86494cefcfd0fdc858943c2735b681ed1624451e Mon Sep 17 00:00:00 2001 From: mingun Date: Mon, 11 Dec 2023 06:57:19 +0900 Subject: [PATCH] =?UTF-8?q?:bug:=20=EC=B2=98=EC=9D=8C=20=EC=8B=9C=EC=9E=91?= =?UTF-8?q?=20=EC=8B=9C,=20=EC=9E=90=EB=8F=99=20=EC=9E=AC=EC=83=9D?= =?UTF-8?q?=EB=90=98=EC=A7=80=20=EC=95=8A=EC=95=98=EB=8D=98=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bind 하기 전에 timer을 실행시켜준 것이 문제였음 --- .../Presentation/RewindJourneyViewController.swift | 8 ++++---- .../Presentation/RewindJourneyViewModel.swift | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewController.swift b/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewController.swift index 93f9add..5bac5db 100644 --- a/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewController.swift +++ b/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewController.swift @@ -51,6 +51,7 @@ public final class RewindJourneyViewController: UIViewController { private var presentingImageIndex: Int? { didSet { self.changeProgressViews() + self.restartTimer() } } @@ -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) } @@ -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) @@ -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 @@ -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 diff --git a/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewModel.swift b/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewModel.swift index 0c5b41e..4ff7cd1 100644 --- a/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewModel.swift +++ b/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewModel.swift @@ -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