Skip to content

Move text instruction creation to core - #385

Merged
bsudekum merged 4 commits into
masterfrom
voice-to-core
Jul 14, 2017
Merged

bsudekum merged 4 commits into
masterfrom
voice-to-core

Conversation

@bsudekum

Copy link
Copy Markdown
Contributor

Closes: #367

Moves text instruction creation to core and makes the functions createSpeakText and speak public.

/cc @frederoni @1ec5 @ericrwolfe

@bsudekum
bsudekum requested review from 1ec5 and frederoni July 13, 2017 21:18
Comment thread MapboxNavigation.podspec
s.dependency "MapboxCoreNavigation", "#{s.version.to_s}"
s.dependency "MapboxDirections.swift", "~> 0.10.0"
s.dependency "Mapbox-iOS-SDK", "~> 3.5"
s.dependency "OSRMTextInstructions", "~> 0.2.0"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty certain since these are in core, we don't need to import these packages.

35C6EDB21EBB286500A27EF8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = "<group>"; };
35C9973E1E732C1B00544D1C /* RouteVoiceController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RouteVoiceController.swift; sourceTree = "<group>"; };
35C997401E732C5400544D1C /* RouteStepFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RouteStepFormatter.swift; sourceTree = "<group>"; };
35C9973E1E732C1B00544D1C /* RouteVoiceController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RouteVoiceController.swift; path = ../MapboxNavigation/RouteVoiceController.swift; sourceTree = "<group>"; };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move RouteVoiceController.swift to the MapboxCoreNavigation folder.

Comment thread MapboxNavigation.podspec
s.dependency "MapboxCoreNavigation", "#{s.version.to_s}"
s.dependency "MapboxDirections.swift", "~> 0.10.0"
s.dependency "Mapbox-iOS-SDK", "~> 3.5"
s.dependency "OSRMTextInstructions", "~> 0.2.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this change to MapboxNavigation-Documentation.podspec as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like we require MapboxCoreNavigation in this podspec though. I think we can add it as a dep or leave as is.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see, that’s because MapboxNavigation-Documentation.podspec produces a single combined framework.


override func speak(_ text: String, error: String?) {
assert(!text.isEmpty)
override public func speak(instruction: String, error: String?) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s fine to use _ instruction here, because instruction is precisely what’s being spoken.

}

guard let userDistance = notification.userInfo![RouteControllerAlertLevelDidChangeNotificationDistanceToEndOfManeuverKey] as? CLLocationDistance else {
assert(false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of guarding, only to fail hard if the condition evaluates to false, it would be clearer to force-unwrap the userInfo entry using as!.

/**
Creates an audio instruction from a `RouteProgress`, the users distance from the maneuver. Optional `markUpWithSSML` will apply `SSML` to the string. This is useful when using AWS's Polly speech synthesizer.
*/
public func createSpeakText(from routeProgress: RouteProgress, at userDistance: CLLocationDistance, markUpWithSSML: Bool = false) -> String {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createSpeakText is ungrammatical; a better method name would be speechString(describing:at:markUpWithSSML:).

@bsudekum

Copy link
Copy Markdown
Contributor Author

This is ready.

@bsudekum
bsudekum merged commit f72996b into master Jul 14, 2017
@bsudekum
bsudekum deleted the voice-to-core branch July 14, 2017 19:08
bsudekum pushed a commit that referenced this pull request Jul 14, 2017
bsudekum pushed a commit that referenced this pull request Jul 14, 2017
bsudekum pushed a commit that referenced this pull request Jul 14, 2017
mappy-mobile pushed a commit to Mappy/mapbox-navigation-ios that referenced this pull request Sep 17, 2020
Keep access token out this repository
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants