Skip to content
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

Republicize DirectionsOptions.urlQueryItems #461

Merged
merged 1 commit into from
Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Added the `Directions.refreshRoute(responseIdentifier:routeIndex:fromLegAtIndex:completionHandler:)` method for refreshing attributes along the legs of a route and the `Route.refreshLegAttributes(from:)` method for merging the refreshed attributes into an existing route. To enable route refreshing for the routes in a particular route response, set `RouteOptions.refreshingEnabled` to `true` before passing the `RouteOptions` object into `Directions.calculate(_:completionHandler:)`. ([#420](https://github.com/mapbox/mapbox-directions-swift/pull/420))
* Fixed a crash that could occur if the Mapbox Directions API includes unrecognized `RoadClasses` values in its response. ([#450](https://github.com/mapbox/mapbox-directions-swift/pull/450))
* Fixed malformed `RouteStep.shape` values that could occur when `RouteStep.maneuverType` is `ManeuverType.arrive`, `DirectionsOptions.shapeFormat` is `RouteShapeFormat.polyline6`, and the Mapbox Directions API returns certain encoded Polyline strings. ([#456](https://github.com/mapbox/mapbox-directions-swift/pull/456))
* Restored the `DirectionsOptions.urlQueryItems` property so that subclasses of `RouteOptions` and `MatchOptions` can add any additional URL query parameters that are supported by the Mapbox Directions and Map Matching APIs. ([#461](https://github.com/mapbox/mapbox-directions-swift/pull/461))

## v0.33.2

Expand Down
7 changes: 6 additions & 1 deletion Sources/MapboxDirections/DirectionsOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,12 @@ open class DirectionsOptions: Codable {
return "\(abridgedPath)/\(coordinates).json"
}

var urlQueryItems: [URLQueryItem] {
/**
An array of URL query items (parameters) to include in an HTTP request.

The query items are included in the URL of a GET request or the body of a POST request.
*/
open var urlQueryItems: [URLQueryItem] {
var queryItems: [URLQueryItem] = [
URLQueryItem(name: "geometries", value: shapeFormat.rawValue),
URLQueryItem(name: "overview", value: routeShapeResolution.rawValue),
Expand Down
5 changes: 1 addition & 4 deletions Sources/MapboxDirections/RouteOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,7 @@ open class RouteOptions: DirectionsOptions {

// MARK: Getting the Request URL

/**
An array of URL parameters to include in the request URL.
*/
override var urlQueryItems: [URLQueryItem] {
override open var urlQueryItems: [URLQueryItem] {
var params: [URLQueryItem] = [
URLQueryItem(name: "alternatives", value: String(includesAlternativeRoutes)),
URLQueryItem(name: "continue_straight", value: String(!allowsUTurnAtWaypoint)),
Expand Down