Skip to content

Commit

Permalink
Add remainingWaypoints Convenience Accessor to TripState
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-burwood committed Jan 30, 2025
1 parent be820af commit 8a29a1e
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,15 @@ fun TripState.remainingSteps() =
is TripState.Complete,
TripState.Idle -> null
}

/**
* Get the remaining waypoints (starting at the *next* waypoint "goal") in the current trip.
*
* @return The list of remaining waypoints (if any).
*/
fun TripState.remainingWaypoints() =
when (this) {
is TripState.Navigating -> this.remainingWaypoints
is TripState.Complete,
TripState.Idle -> null
}

0 comments on commit 8a29a1e

Please sign in to comment.