Skip to content

Commit

Permalink
Enables passing negative values for heading and or heading accuracy f…
Browse files Browse the repository at this point in the history
…rom the plugin. (#1409)
  • Loading branch information
TimHoogstrate authored Jan 16, 2024
1 parent ba015e6 commit ff5be16
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
4 changes: 4 additions & 0 deletions geolocator_apple/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.3.5

* Previously the plugin filtered out negative values for heading and/or heading accuracy. Now the plugin is returning the heading and/or the heading accuracy even if the they have a negative value (invalid), so that the developer can use it and decide what to do with it.

## 2.3.4

* Allows the ARM64 architecture as a valid IPhone simulator architecture.
Expand Down
14 changes: 4 additions & 10 deletions geolocator_apple/ios/Classes/Utils/LocationMapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,10 @@ + (NSDictionary *) toDictionary:(CLLocation *)location {
// - https://developer.apple.com/documentation/corelocation/cllocation/1423832-course?language=objc
// - https://developer.apple.com/documentation/corelocation/cllocation/3524338-courseaccuracy?language=objc
double heading = location.course;
if (heading >= 0.0) {
if (@available(iOS 13.4, macOS 10.15.4, *)) {
double headingAccuracy = location.courseAccuracy;
if (headingAccuracy >= 0.0) {
[locationMap setObject:@(heading) forKey: @"heading"];
[locationMap setObject:@(headingAccuracy) forKey: @"heading_accuracy"];
}
} else {
[locationMap setObject:@(heading) forKey: @"heading"];
}
[locationMap setObject:@(heading) forKey: @"heading"];
if (@available(iOS 13.4, macOS 10.15.4, *)) {
double headingAccuracy = location.courseAccuracy;
[locationMap setObject:@(headingAccuracy) forKey: @"heading_accuracy"];
}

if(@available(iOS 15.0, macOS 12.0, *)) {
Expand Down
2 changes: 1 addition & 1 deletion geolocator_apple/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: geolocator_apple
description: Geolocation Apple plugin for Flutter. This plugin provides the Apple implementation for the geolocator.
repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_apple
issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen
version: 2.3.4
version: 2.3.5

environment:
sdk: ">=2.15.0 <4.0.0"
Expand Down

0 comments on commit ff5be16

Please sign in to comment.