Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changes to the Mapbox Navigation SDK for iOS

## v2.20.4

### Other changes

* Reroute notification sound now plays only after a new route is successfully retrieved.

## v2.20.3

### Routing
Expand Down
7 changes: 1 addition & 6 deletions Sources/MapboxNavigation/RouteVoiceController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,12 @@ open class RouteVoiceController: NSObject, AVSpeechSynthesizerDelegate {

func observeNotifications(by service: NavigationService) {
NotificationCenter.default.addObserver(self, selector: #selector(didPassSpokenInstructionPoint(notification:)), name: .routeControllerDidPassSpokenInstructionPoint, object: service.router)
NotificationCenter.default.addObserver(self, selector: #selector(pauseSpeechAndPlayReroutingDing(notification:)), name: .routeControllerWillReroute, object: service.router)
NotificationCenter.default.addObserver(self, selector: #selector(didReroute(notification:)), name: .routeControllerDidReroute, object: service.router)
NotificationCenter.default.addObserver(self, selector: #selector(didUpdateSettings(notification:)), name: .navigationSettingsDidChange, object: nil)
}

func suspendNotifications() {
NotificationCenter.default.removeObserver(self, name: .routeControllerDidPassSpokenInstructionPoint, object: nil)
NotificationCenter.default.removeObserver(self, name: .routeControllerWillReroute, object: nil)
NotificationCenter.default.removeObserver(self, name: .routeControllerDidReroute, object: nil)
NotificationCenter.default.removeObserver(self, name: .navigationSettingsDidChange, object: nil)
}
Expand Down Expand Up @@ -188,10 +186,7 @@ open class RouteVoiceController: NSObject, AVSpeechSynthesizerDelegate {
public var rerouteSoundPlayer: AVAudioPlayer

@objc func didReroute(notification: NSNotification) {
// Play reroute sound when a faster route is found
if notification.userInfo?[RouteController.NotificationUserInfoKey.isProactiveKey] as! Bool {
pauseSpeechAndPlayReroutingDing(notification: notification)
}
pauseSpeechAndPlayReroutingDing(notification: notification)
}
}

Expand Down