-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add spoken locale #235
Add spoken locale #235
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,8 @@ open class Route: NSObject, NSSecureCoding { | |
routeOptions = options | ||
|
||
routeIdentifier = decoder.decodeObject(of: NSString.self, forKey: "routeIdentifier") as String? | ||
|
||
spokenLocale = decoder.decodeObject(of: NSLocale.self, forKey: "spokenLocale") as Locale? | ||
} | ||
|
||
open static var supportsSecureCoding = true | ||
|
@@ -86,6 +88,7 @@ open class Route: NSObject, NSSecureCoding { | |
coder.encode(expectedTravelTime, forKey: "expectedTravelTime") | ||
coder.encode(routeOptions, forKey: "routeOptions") | ||
coder.encode(routeIdentifier, forKey: "routeIdentifier") | ||
coder.encode(spokenLocale, forKey: "spokenLocale") | ||
} | ||
|
||
// MARK: Getting the Route Geometry | ||
|
@@ -194,6 +197,11 @@ open class Route: NSObject, NSSecureCoding { | |
Each route produced by a single call to `Directions.calculate(_:completionHandler:)` has the same route identifier. | ||
*/ | ||
@objc open var routeIdentifier: String? | ||
|
||
/** | ||
The locale to use for spoken instructions. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explain that this locale is specifically meant for use with the Mapbox Voice API. Add a note about what |
||
*/ | ||
@objc open var spokenLocale: Locale? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename this property to |
||
} | ||
|
||
// MARK: Support for Directions API v4 | ||
|
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,7 @@ class V5Tests: XCTestCase { | |
XCTAssertEqual(route!.accessToken, BogusToken) | ||
XCTAssertEqual(route!.apiEndpoint, URL(string: "https://api.mapbox.com")) | ||
XCTAssertEqual(route!.routeIdentifier, "cj725hpi30yp2ztm2ehbcipmh") | ||
XCTAssertEqual(route!.spokenLocale!.description, "en-US") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
|
||
// confirming actual decoded values is important because the Directions API | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about also copying this locale into each SpokenInstruction, so that the navigation SDK’s voice controller classes only need to work with individual SpokenInstruction objects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that works