Skip to content

Commit

Permalink
Merge branch 'release/5.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
malcommac committed Dec 24, 2020
2 parents bcbf8d1 + 6229013 commit 2a12635
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ public class GPSLocationOptions: CustomStringConvertible, Codable {

public var description: String {
switch self {
case .immediate(let t): return "immediate \(t)s"
case .delayed(let t): return "delayed \(t)s"
case .immediate(let t): return "immediate \(abs(t))s"
case .delayed(let t): return "delayed \(abs(t))s"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ public class GPSLocationRequest: RequestProtocol, Codable {
}

if let previousLocation = lastLocation {
// We have already received a previous valid location so we'll
// also check for distance and interval if required and eventually dispatch value.
if options.minDistance > kCLDistanceFilterNone,
previousLocation.distance(from: data) > options.minDistance {
return .notMinDistance // minimum distance since last location is not respected.
Expand All @@ -152,6 +154,9 @@ public class GPSLocationRequest: RequestProtocol, Codable {
}
}

// Store previous value because it was validated.
lastLocation = data

return nil
}

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 = "5.0.2"
s.version = "5.0.3"
s.summary = "Location Manager Made Easy"
s.description = <<-DESC
Efficient location tracking for iOS with support for oneshot/continuous/background tracking, reverse geocoding, autocomplete, geofencing, beacon monitoring & broadcasting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class GPSController: UIViewController, UITableViewDelegate, UITableViewDataSourc
case .subscription:
cell.valueLabel.text = serviceOptions.subscription.description
case .timeoutInterval:
cell.valueLabel.text = serviceOptions.minTimeInterval?.format() ?? NOT_SET
cell.valueLabel.text = serviceOptions.timeout?.description ?? NOT_SET
case .precise:
cell.valueLabel.text = serviceOptions.precise?.description ?? USER_SET
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,18 @@ class RequestListController: UIViewController, UITableViewDelegate, UITableViewD
}
}

func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
guard indexPath.section > 0 else {
return nil
}

return [
UITableViewRowAction(style: .destructive, title: "Stop Monitor", handler: { [weak self] (_, indexPath) in
DispatchQueue.main.async {
self?.cancelRequestAtIndexPath(indexPath)
}
})
]
let action = UIContextualAction(style: .destructive, title: "Stop Monitor") { [weak self] (action, view, completionHandler) in
self?.cancelRequestAtIndexPath(indexPath)

completionHandler(true)
}

return UISwipeActionsConfiguration(actions: [action])
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
Expand Down

0 comments on commit 2a12635

Please sign in to comment.