diff --git a/geolocator_apple/CHANGELOG.md b/geolocator_apple/CHANGELOG.md index 2d96f0f75..bc5dd5b57 100644 --- a/geolocator_apple/CHANGELOG.md +++ b/geolocator_apple/CHANGELOG.md @@ -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. diff --git a/geolocator_apple/ios/Classes/Utils/LocationMapper.m b/geolocator_apple/ios/Classes/Utils/LocationMapper.m index 1ca60c705..7395c586f 100644 --- a/geolocator_apple/ios/Classes/Utils/LocationMapper.m +++ b/geolocator_apple/ios/Classes/Utils/LocationMapper.m @@ -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, *)) { diff --git a/geolocator_apple/pubspec.yaml b/geolocator_apple/pubspec.yaml index c5f64677b..e79f868a5 100644 --- a/geolocator_apple/pubspec.yaml +++ b/geolocator_apple/pubspec.yaml @@ -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"