Skip to content

Commit

Permalink
Merge branch 'release/4.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
malcommac committed May 12, 2019
2 parents 7d5d221 + 9550ad1 commit 2bfacd9
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Configs/SwiftLocation.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>4.0.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ You can also observe for changes in authorization status by subscribing auth cha

```swift
let observerID = LocationManager.shared.onAuthorizationChange.add { newState in
print("Authorization status changed to \(newStatus)")
print("Authorization status changed to \(newState)")
}
```

Expand Down Expand Up @@ -425,4 +425,4 @@ LocationManager.shared.autocomplete(partialMatch: .partialSearch("Piazza della R
SwiftLocation is currently owned and maintained by Daniele Margutti.
It's licensed under MIT License.

<div>Icons made by <a href="https://www.flaticon.com/<?=_('authors').'/'?>eucalyp" title="Eucalyp">Eucalyp</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div>
<div>Icons made by <a href="https://www.flaticon.com/<?=_('authors').'/'?>eucalyp" title="Eucalyp">Eucalyp</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div>
4 changes: 2 additions & 2 deletions Sources/Locating/LocationRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class LocationRequest: ServiceRequest, Hashable {
didSet {
// Also set the callback to receive timeout event; it will remove the request.
timeoutManager?.callback = { interval in
self.stop(reason: .timeout(interval), remove: true)
self.stop(reason: .requiredLocationNotFound(timeout: interval, last: self.lastAbsoluteLocation), remove: true)
}
}
}
Expand Down Expand Up @@ -142,7 +142,7 @@ public class LocationRequest: ServiceRequest, Hashable {

// MARK: - Internal Methods -

/// Stop a request with passed error reason and optionally remvoe it from queue.
/// Stop a request with passed error reason and optionally remove it from queue.
///
/// - Parameters:
/// - reason: reason of failure.
Expand Down
10 changes: 10 additions & 0 deletions Sources/LocationManager+Support.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ internal let CLLocationAccuracyAccuracyAny: CLLocationAccuracy = 6000 // 6km or

public extension LocationManager {

/// Errors of the location manager.
///
/// - cancelled: operation was cancelled by the user.
/// - timeout: timeout reached.
/// - invalidAuthStatus: invalid authorization status.
/// - generic: generic error.
/// - noData: no data received from service.
/// - missingAPIKey: missing required api key for service.
/// - requiredLocationNotFound: required accurated location were not found, last found reported.
enum ErrorReason: Error {
case cancelled
case timeout(TimeInterval)
case invalidAuthStatus(CLAuthorizationStatus)
case generic(String)
case noData(URL?)
case missingAPIKey
case requiredLocationNotFound(timeout: TimeInterval, last: CLLocation?)
}

enum State: CustomStringConvertible {
Expand Down
6 changes: 3 additions & 3 deletions Sources/LocationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -566,10 +566,10 @@ public class LocationManager: NSObject {
}
}

/// Complete all requests in list and remove them.
/// Complete all requests in list and remove them. Optionally you can also pass a reason.
///
/// - Parameter error: error used to complete each request.
private func completeAllLocationRequest(error: ErrorReason) {
/// - Parameter error: error used to complete each request. By default is `.cancelled`.
public func completeAllLocationRequest(error: ErrorReason = .cancelled) {
queueLocationRequests.forEach {
$0.stop(reason: error, remove: true)
updateLocationManagerSettings($0)
Expand Down
2 changes: 1 addition & 1 deletion SwiftLocation.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SwiftLocation"
s.version = "4.0.1"
s.version = "4.0.2"
s.summary = "Easy and Efficient Location Tracking for iOS"
s.description = <<-DESC
Efficient location tracking for iOS with support for oneshot/continuous/background tracking, reverse geocoding, autocomplete and more!
Expand Down

0 comments on commit 2bfacd9

Please sign in to comment.