Skip to content

Commit

Permalink
Sort offline versions in descending chronological order
Browse files Browse the repository at this point in the history
  • Loading branch information
1ec5 committed Feb 15, 2019
1 parent 2a5181b commit 7cee5a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes to the Mapbox Directions SDK for iOS

## master

* The versions passed into the completion handler of `Directions.fetchAvailableOfflineVersions(completionHandler:)` are now sorted in descending chronological order. ([#350](https://github.com/mapbox/MapboxDirections.swift/pull/350))

## v0.27.0

* If a `RouteOptions` object has exceptionally many waypoints or if many of the waypoint have very long names, `Directions.calculate(_:completionHandler:)` sends a POST request to the Mapbox Directions API instead of sending a GET request that returns an error. ([#341](https://github.com/mapbox/MapboxDirections.swift/pull/341))
Expand Down
5 changes: 3 additions & 2 deletions MapboxDirections/OfflineDirections.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extension Directions: OfflineDirectionsProtocol {
}

/**
Fetch the available versions. A version is represented as a String (yyyy-MM-dd or yyyy-MM-dd-x).
Fetch the available versions in descending chronological order. A version is represented as a String (yyyy-MM-dd or yyyy-MM-dd-x).

- parameter completionHandler: The closure to call with the results
- returns: A `URLSessionDataTask`
Expand All @@ -73,7 +73,8 @@ extension Directions: OfflineDirectionsProtocol {

do {
let versionResponse = try JSONDecoder().decode(AvailableVersionsResponse.self, from: data)
completionHandler(versionResponse.availableVersions, error)
let availableVersions = versionResponse.availableVersions.sorted(by: >)
completionHandler(availableVersions, error)
} catch {
completionHandler(nil, error)
}
Expand Down

0 comments on commit 7cee5a7

Please sign in to comment.