Skip to content

Commit 93e678c

Browse files
authored
Merge pull request #576 from Baseflow/issue/562
Return the floor if available on iOS
2 parents 14718d8 + 4d238a0 commit 93e678c

File tree

7 files changed

+35
-18
lines changed

7 files changed

+35
-18
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ To use this plugin, add `geolocator` as a [dependency in your pubspec.yaml file]
2323

2424
```yaml
2525
dependencies:
26-
geolocator: ^6.1.2
26+
geolocator: ^6.1.4
2727
```
2828
2929
<details>

geolocator/CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
## 6.1.4
2+
3+
- When available return the floor on which the devices is located (see [#562](https://github.com/Baseflow/flutter-geolocator/issues/562));
4+
- When on iOS 10+ return information regarding the speed accuracy.
5+
16
## 6.1.3
27

3-
- Solves a bug causing less accurate location fixes (see [#531]((https://github.com/Baseflow/flutter-geolocator/issues/531))).
8+
- Solves a bug causing less accurate location fixes (see [#531](https://github.com/Baseflow/flutter-geolocator/issues/531)).
49

510
## 6.1.2
611

geolocator/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ To use this plugin, add `geolocator` as a [dependency in your pubspec.yaml file]
2323

2424
```yaml
2525
dependencies:
26-
geolocator: ^6.1.2
26+
geolocator: ^6.1.4
2727
```
2828
2929
<details>
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bc4128512a11f51e4d58af6ebd998d83
1+
da0244c85ad60d0a306fb416a443d50a

geolocator/ios/Classes/Utils/LocationMapper.m

+22-10
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,28 @@ + (NSDictionary *) toDictionary:(CLLocation *)location {
1313
return nil;
1414
}
1515

16-
return @{
17-
@"latitude": @(location.coordinate.latitude),
18-
@"longitude": @(location.coordinate.longitude),
19-
@"timestamp": @([LocationMapper currentTimeInMilliSeconds:location.timestamp]),
20-
@"altitude": @(location.altitude),
21-
@"accuracy": @(location.horizontalAccuracy),
22-
@"speed": @(location.speed),
23-
@"speed_accuracy": @0.0,
24-
@"heading": @(location.course),
25-
};
16+
double timestamp = [LocationMapper currentTimeInMilliSeconds:location.timestamp];
17+
double speedAccuracy = 0.0;
18+
19+
if (@available(iOS 10.0, *)) {
20+
speedAccuracy = location.speedAccuracy;
21+
}
22+
23+
NSMutableDictionary *locationMap = [[NSMutableDictionary alloc]initWithCapacity:9];
24+
[locationMap setObject:@(location.coordinate.latitude) forKey: @"latitude"];
25+
[locationMap setObject:@(location.coordinate.longitude) forKey: @"longitude"];
26+
[locationMap setObject:@(timestamp) forKey: @"timestamp"];
27+
[locationMap setObject:@(location.altitude) forKey: @"altitude"];
28+
[locationMap setObject:@(location.horizontalAccuracy) forKey: @"accuracy"];
29+
[locationMap setObject:@(location.speed) forKey: @"speed"];
30+
[locationMap setObject:@(speedAccuracy) forKey: @"speed_accuracy"];
31+
[locationMap setObject:@(location.course) forKey: @"heading"];
32+
33+
if(location.floor && location.floor.level) {
34+
[locationMap setObject:@(location.floor.level) forKey:@"floor"];
35+
}
36+
37+
return locationMap;
2638
}
2739

2840
+ (double)currentTimeInMilliSeconds:(NSDate *)dateToConvert {

geolocator/pubspec.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: geolocator
22
description: Geolocation plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API for generic location (GPS etc.) functions.
3-
version: 6.1.3
4-
homepage: https://github.com/baseflow/flutter-geolocator
3+
version: 6.1.4
4+
homepage: https://github.com/Baseflow/flutter-geolocator/tree/master/geolocator
55

66
environment:
77
sdk: ">=2.7.0 <3.0.0"
@@ -11,7 +11,7 @@ dependencies:
1111
flutter:
1212
sdk: flutter
1313

14-
geolocator_platform_interface: ^1.0.7
14+
geolocator_platform_interface: ^1.0.8
1515

1616
dev_dependencies:
1717
flutter_test:

geolocator_platform_interface/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ To use this plugin, add `geolocator` as a [dependency in your pubspec.yaml file]
2323

2424
```yaml
2525
dependencies:
26-
geolocator: ^6.1.2
26+
geolocator: ^6.1.4
2727
```
2828
2929
<details>

0 commit comments

Comments
 (0)