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

Sort offline versions in descending chronological order #350

Merged
merged 1 commit into from
Feb 15, 2019
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Changes to the Mapbox Directions SDK for iOS

## v0.27.1
## master

* Fixed an issue where `Directions.downloadTiles(in:version:session:completionHandler:)` always failed with an error after passing in a `CoordinateBounds` created using the `CoordinateBounds(northWest:southEast:)` initializer. ([#349](https://github.com/mapbox/MapboxDirections.swift/pull/349))
* Added a `CoordinateBounds(southWest:northEast:)` initializer. ([#349](https://github.com/mapbox/MapboxDirections.swift/pull/349))
* The versions passed into the completion handler of `Directions.fetchAvailableOfflineVersions(completionHandler:)` are now sorted in reverse chronological order. ([#350](https://github.com/mapbox/MapboxDirections.swift/pull/350))

## v0.27.0

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