Conversation
frederoni
reviewed
Oct 17, 2017
| } | ||
| } | ||
|
|
||
| public var spokenInstructionsForRoute: [String: Data] = [:] |
Contributor
There was a problem hiding this comment.
Can we move this to the PollyVoiceController?
Contributor
Author
There was a problem hiding this comment.
Yeah I guess it doesn’t need to be stored on routeprogress
696cf6c to
9521078
Compare
added 2 commits
October 18, 2017 14:44
Contributor
Author
|
@1ec5 @frederoni could I get another review? |
frederoni
reviewed
Oct 19, 2017
| for (stepIndex, step) in routeProgresss.currentLegProgress.leg.steps.suffix(from: routeProgresss.currentLegProgress.stepIndex).enumerated() { | ||
| let adjustedStepIndex = stepIndex + routeProgresss.currentLegProgress.stepIndex | ||
|
|
||
| guard adjustedStepIndex < routeProgresss.currentLegProgress.stepIndex + 3 else { continue } |
Contributor
There was a problem hiding this comment.
Should this be using the stepsAheadToCache instead of 3?
frederoni
reviewed
Oct 19, 2017
| } | ||
| } | ||
|
|
||
| func sayInStruction(for data: Data) { |
frederoni
approved these changes
Oct 19, 2017
1ec5
reviewed
Oct 25, 2017
| /** | ||
| Number of steps ahead of the current step to cache spoken instructions. | ||
| */ | ||
| public var stepsAheadToCache: Int = 3 |
Contributor
There was a problem hiding this comment.
- “Caching” implies reusing things after the first time they’re needed. A more appropriate word for this feature is “prefetching”.
- The name of this property talks about steps instead of spoken instructions – are we fetching individual steps from the Directions API and caching them now?
- By beginning a name with a plural noun, you’re implying a type of
Array.
How about countOfStepsForPrefetchingInstructions?
| var cacheURLSession: URLSession | ||
| var cachePollyTask: URLSessionDataTask? | ||
|
|
||
| var spokenInstructionsForRoute: [String: Data] = [:] |
| guard let instructions = step.instructionsSpokenAlongStep else { continue } | ||
|
|
||
| for instruction in instructions { | ||
| guard spokenInstructionsForRoute[instruction.ssmlText] == nil else { continue } |
Contributor
There was a problem hiding this comment.
This can be written more clearly as:
for instruction in instructions where spokenInstructionsForRoute[instruction.ssmlText] != nil { … }
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisite #614
It's relatively dumb right now, when we fire the notification to say something:
RouteProgress.spokenInstructionsForRouteand has data.RouteProgress.spokenInstructionsForRoute/cc @1ec5 @frederoni @ericrwolfe @JThramer