-
Notifications
You must be signed in to change notification settings - Fork 318
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 waypoint handling #270
Merged
Changes from 50 commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
92a1d30
Add waypoint handling
d009fff
more waypoints
c33b154
Use sections
c6dabb3
clear map
2c6524a
remove destination
382ede6
Updates
52b867d
remove
315a681
use name
cbe2ce1
return waypoint when arriving at each waypoint
988dfd0
Merge branch 'master' into waypoints
753814a
update
275b973
Merge branch 'master' into waypoints
13b4ad1
update example
ebfa33f
Merge branch 'master' into waypoints
204eeff
update
85684aa
remove arg
e88e2b1
localize
d7828aa
remove comma
9f10ad9
Merge branch 'master' into waypoints
082c44e
whitespace
40d58cd
fix
2c26fe9
whitespace
6340c58
Merge branch 'master' into waypoints
f052af0
Style, confirm next
0ab7e26
move
3e95e9c
remove unused
8eb79fa
Merge branch 'master' into waypoints
ee9df0f
Remove waypoint once done
bb73e66
Merge branch 'master' into waypoints
edd881b
add clear button
b0247d6
Merge branch 'master' into waypoints
4369010
Make waypoint customizable
3c568c4
fix
f0ab02f
Improve names
0c5ae6f
Add back
cfa67b6
add back
7144f59
move around
087de57
remove
7b15853
remove
ba54bd0
Merge branch 'master' into waypoints
4934ad0
move arrow
84c3c41
add back
2f5602f
Merge branch 'master' into waypoints
8b41be7
Change names
5907c9a
Add translation
3f0e8ca
Wow, rename
deda53a
Update
20bc71e
increment
3f8214f
False
4305493
Add translation, update
b2562d6
fix
cb66468
Merge branch 'master' into waypoints
a1d4cbe
Merge branch 'master' into waypoints
8e17b03
change api
771dbca
remove
5b66ffd
Merge branch 'master' into waypoints
5ebb998
document
e177cd2
Consistent
1ab08d5
Merge branch 'master' into waypoints
1286a2e
remove annotations
9b2f21b
Merge branch 'master' into waypoints
306e55a
Merge branch 'master' into waypoints
518d535
Merge branch 'master' into waypoints
8ef4112
Merge branch 'master' into waypoints
f0dc3d5
Merge branch 'master' into waypoints
e5eb660
Always update
b9b3555
Flip
84a1f34
Update
de69c03
Make bolder
5995b2f
darker gray
26fec4b
Update docs
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import UIKit | ||
|
||
protocol WaypointConfirmationViewControllerDelegate: NSObjectProtocol { | ||
func confirmationControllerDidConfirm(controller: WaypointConfirmationViewController) | ||
func confirmationControllerDidConfirm(_ controller: WaypointConfirmationViewController) | ||
} | ||
|
||
class WaypointConfirmationViewController: UIViewController { | ||
|
||
weak var delegate: WaypointConfirmationViewControllerDelegate? | ||
|
||
@IBAction func continueButtonPressed(_ sender: Any) { | ||
delegate?.confirmationControllerDidConfirm(controller: self) | ||
delegate?.confirmationControllerDidConfirm(self) | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,9 @@ public protocol RouteControllerDelegate: class { | |
@objc(routeController:shouldRerouteFromLocation:) | ||
optional func routeController(_ routeController: RouteController, shouldRerouteFrom location: CLLocation) -> Bool | ||
|
||
@objc(routeController:shouldIncrementLegWhenArrivingAtWaypoint:) | ||
optional func routeController(_ routeController: RouteController, shouldIncrementLegWhenArrivingAtWaypoint waypoint: Waypoint) -> Bool | ||
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. The Swift name should be |
||
|
||
/** | ||
Called immediately before the route controller calculates a new route. | ||
|
||
|
@@ -414,7 +417,8 @@ extension RouteController: CLLocationManagerDelegate { | |
let userSnapToStepDistanceFromManeuver = distance(along: routeProgress.currentLegProgress.currentStep.coordinates!, from: location.coordinate) | ||
let secondsToEndOfStep = userSnapToStepDistanceFromManeuver / location.speed | ||
|
||
guard routeProgress.currentLegProgress.alertUserLevel != .arrive else { | ||
guard routeProgress.currentLegProgress.alertUserLevel != .arrive, | ||
routeProgress.remainingWaypoints.count > 0 else { | ||
NotificationCenter.default.post(name: RouteControllerProgressDidChange, object: self, userInfo: [ | ||
RouteControllerProgressDidChangeNotificationProgressKey: routeProgress, | ||
RouteControllerProgressDidChangeNotificationLocationKey: location, | ||
|
@@ -532,6 +536,7 @@ extension RouteController: CLLocationManagerDelegate { | |
|
||
if routeProgress.currentLegProgress.alertUserLevel != newlyCalculatedAlertLevel || updateStepIndex { | ||
routeProgress.currentLegProgress.alertUserLevel = newlyCalculatedAlertLevel | ||
|
||
// Use fresh user location distance to end of step | ||
// since the step could of changed | ||
let userDistance = distance(along: routeProgress.currentLegProgress.currentStep.coordinates!, from: location.coordinate) | ||
|
@@ -540,6 +545,12 @@ extension RouteController: CLLocationManagerDelegate { | |
RouteControllerAlertLevelDidChangeNotificationRouteProgressKey: routeProgress, | ||
RouteControllerAlertLevelDidChangeNotificationDistanceToEndOfManeuverKey: userDistance | ||
]) | ||
|
||
if routeProgress.currentLegProgress.alertUserLevel == .arrive, | ||
routeProgress.remainingWaypoints.count > 1, | ||
(delegate?.routeController?(self, shouldIncrementLegWhenArrivingAtWaypoint: routeProgress.currentLeg.destination) ?? true) { | ||
routeProgress.legIndex += 1 | ||
} | ||
} | ||
} | ||
|
||
|
This file contains 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
Oops, something went wrong.
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.
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.
Nit: use
dropFirst()
.