From 38b45baa49f8b59464566d6ba6b0b0f267e399f4 Mon Sep 17 00:00:00 2001 From: Alex Azarov Date: Wed, 27 Mar 2024 13:55:42 +0100 Subject: [PATCH] Fix SystemSpeechSynthesizer related main thread hang on NavigationViewController creation (#4617) * Don't check if AVSpeechSynthesizer.isSpeaking when unmuting it * add changelog entry --- CHANGELOG.md | 1 + Sources/MapboxNavigation/SystemSpeechSynthesizer.swift | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6c62a0d6e3..10b91bc5a7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ * Removed `NavigationEventsManager.init(activeNavigationDataSource:passiveNavigationDataSource:accessToken:mobileEventsManager:)` in favor of `NavigationEventsManager.init(activeNavigationDataSource:passiveNavigationDataSource:accessToken:)`. ([#4572](https://github.com/mapbox/mapbox-navigation-ios/pull/4572)) * Fixed a rare issue that could lead to memory corruption under specific conditions. This was resolved by replacing the internal image downloader with brand new actor-based implementation. ([#4588](https://github.com/mapbox/mapbox-navigation-ios/pull/4588)) * Fixed the possible situation when the upcoming route leg is rendered above the active route leg. ([#4588](https://github.com/mapbox/mapbox-navigation-ios/pull/4588)) +* Fixed a main thread hang on NavigationViewController creation. ([#4617](https://github.com/mapbox/mapbox-navigation-ios/pull/4617)) ## v2.17.0 diff --git a/Sources/MapboxNavigation/SystemSpeechSynthesizer.swift b/Sources/MapboxNavigation/SystemSpeechSynthesizer.swift index 42c17524d24..e716586bf58 100644 --- a/Sources/MapboxNavigation/SystemSpeechSynthesizer.swift +++ b/Sources/MapboxNavigation/SystemSpeechSynthesizer.swift @@ -13,7 +13,7 @@ open class SystemSpeechSynthesizer: NSObject, SpeechSynthesizing { public weak var delegate: SpeechSynthesizingDelegate? public var muted: Bool = false { didSet { - if isSpeaking { + if muted, isSpeaking { interruptSpeaking() } }