From 69feeefe011aa26a979835dff998e099f575bffe Mon Sep 17 00:00:00 2001 From: mingun Date: Mon, 11 Dec 2023 11:41:23 +0900 Subject: [PATCH 1/5] =?UTF-8?q?:bug:=20=F0=9F=90=9B=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=20=ED=99=94=EB=A9=B4=EC=97=90=20=ED=91=9C=EC=8B=9C=EB=90=9C=20?= =?UTF-8?q?=EB=A7=88=EC=BB=A4=EA=B0=80=20=EC=A7=80=EB=8F=84=EC=97=90=20?= =?UTF-8?q?=ED=8F=AC=ED=95=A8=EB=90=9C=EC=B1=84=EB=A1=9C=20=E2=80=9C?= =?UTF-8?q?=EC=97=AC=EA=B8=B0=EC=84=9C=20=EB=8B=A4=EC=8B=9C=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=E2=80=9D=20=EB=B2=84=ED=8A=BC=EC=9D=84=20=EB=88=84?= =?UTF-8?q?=EB=A5=B4=EB=A9=B4=20=ED=81=B4=EB=9F=AC=EC=8A=A4=ED=84=B0=20?= =?UTF-8?q?=EA=B0=9C=EC=88=98=EA=B0=80=20=EC=A4=91=EB=B3=B5=EC=A0=81?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=A6=9D=EA=B0=80=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=ED=98=84=EC=83=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NavigateMap/Presentation/Common/MapViewController.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/iOS/Features/Home/Sources/NavigateMap/Presentation/Common/MapViewController.swift b/iOS/Features/Home/Sources/NavigateMap/Presentation/Common/MapViewController.swift index ccdb759..2e01824 100644 --- a/iOS/Features/Home/Sources/NavigateMap/Presentation/Common/MapViewController.swift +++ b/iOS/Features/Home/Sources/NavigateMap/Presentation/Common/MapViewController.swift @@ -146,6 +146,7 @@ public final class MapViewController: UIViewController { viewModel.state.visibleJourneys .receive(on: DispatchQueue.main) .sink { [weak self] journeys in + self?.clearAnnotations() self?.addAnnotations(with: journeys) self?.drawPolyLinesToMap(with: journeys) } From b2e252edfc6eb9bec952818cecbc12e5a1b76583 Mon Sep 17 00:00:00 2001 From: mingun Date: Mon, 11 Dec 2023 11:44:12 +0900 Subject: [PATCH 2/5] =?UTF-8?q?:bug:=20Background=20thread=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=ED=83=80=EC=9D=B4=EB=A8=B8=EB=A5=BC=20=EB=8F=8C?= =?UTF-8?q?=EB=A6=B4=20=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/RewindJourney/Presentation/MSProgressView.swift | 2 +- .../RewindJourney/Presentation/MSProgressViewModel.swift | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/MSProgressView.swift b/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/MSProgressView.swift index c70e685..7b76111 100644 --- a/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/MSProgressView.swift +++ b/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/MSProgressView.swift @@ -58,7 +58,7 @@ public final class MSProgressView: UIProgressView { // MARK: - Functions: change progress private func syncProgress(percentage: Float) { - self.progress = percentage + DispatchQueue.main.async { self.progress = percentage } } // MARK: - Timer diff --git a/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/MSProgressViewModel.swift b/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/MSProgressViewModel.swift index 89af68e..665d1b4 100644 --- a/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/MSProgressViewModel.swift +++ b/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/MSProgressViewModel.swift @@ -30,8 +30,9 @@ final class MSProgressViewModel { // MARK: - Functions: Timers internal 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 guard let remainingTime = self?.remainingTime, let timerDuration = self?.timerDuration, From dcf3a659dd7b445a81e13082738262be4f7aa681 Mon Sep 17 00:00:00 2001 From: mingun Date: Mon, 11 Dec 2023 11:45:50 +0900 Subject: [PATCH 3/5] =?UTF-8?q?:bug:=20Progressbar=EA=B0=80=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RewindJourney/Presentation/RewindJourneyViewController.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewController.swift b/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewController.swift index f9d720d..09d062d 100644 --- a/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewController.swift +++ b/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewController.swift @@ -183,6 +183,7 @@ public final class RewindJourneyViewController: UIViewController { urls.forEach { _ in let progressView = MSProgressView() self.progressStackView.addArrangedSubview(progressView) + if self.progressViews == nil { self.progressViews = [] } self.progressViews?.append(progressView) } } From d68643886bf366b778800f2697e92e75288dccb9 Mon Sep 17 00:00:00 2001 From: mingun Date: Mon, 11 Dec 2023 11:48:55 +0900 Subject: [PATCH 4/5] =?UTF-8?q?:art:=20Timer=20background=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=8F=8C=EB=A6=B4=20=EC=88=98=20=EC=9E=88=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/RewindJourneyViewController.swift | 4 +++- .../RewindJourney/Presentation/RewindJourneyViewModel.swift | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewController.swift b/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewController.swift index 09d062d..0a5526f 100644 --- a/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewController.swift +++ b/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewController.swift @@ -49,7 +49,9 @@ public final class RewindJourneyViewController: UIViewController { private var cancellables: Set = [] private var presentingImageIndex: Int? { - didSet { self.changeProgressViews() } + didSet { + DispatchQueue.main.async { self.changeProgressViews() } + } } // MARK: - Properties: Timer diff --git a/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewModel.swift b/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewModel.swift index 18447aa..0c5b41e 100644 --- a/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewModel.swift +++ b/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewModel.swift @@ -85,6 +85,7 @@ private extension RewindJourneyViewModel { func startTimer() { self.timer = Timer.publish(every: self.timerTimeInterval, on: .main, in: .common) .autoconnect() + .receive(on: DispatchQueue.global(qos: .background)) .sink { [weak self] _ in self?.state.timerPublisher.send() } From 5e3d4acdb12686728b05118541e1d1fba2aba880 Mon Sep 17 00:00:00 2001 From: mingun Date: Mon, 11 Dec 2023 11:52:26 +0900 Subject: [PATCH 5/5] =?UTF-8?q?:bug:=20=20=EC=B2=98=EC=9D=8C=20=EC=8B=9C?= =?UTF-8?q?=EC=9E=91=20=EC=8B=9C,=20=EC=9E=90=EB=8F=99=20=EC=9E=AC?= =?UTF-8?q?=EC=83=9D=EB=90=98=EC=A7=80=20=EC=95=8A=EC=95=98=EB=8D=98=20?= =?UTF-8?q?=EC=98=A4=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 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewController.swift b/iOS/Features/RewindJourney/Sources/RewindJourney/Presentation/RewindJourneyViewController.swift index 0a5526f..ec7c7a2 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 { DispatchQueue.main.async { 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