Skip to content

Commit

Permalink
feat(ios): add several information to resolve Lyokone#552
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyokone committed Jun 5, 2021
1 parent 2a4e0df commit 6a705ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -432,7 +432,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -481,7 +481,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
24 changes: 13 additions & 11 deletions packages/location/ios/Classes/LocationPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,20 @@ -(void)locationManager:(CLLocationManager*)manager
didUpdateLocations:(NSArray<CLLocation*>*)locations {
CLLocation *location = locations.firstObject;
NSTimeInterval timeInSeconds = [location.timestamp timeIntervalSince1970];
BOOL superiorToIos10 = [UIDevice currentDevice].systemVersion.floatValue >= 10;
NSDictionary<NSString*,NSNumber*>* coordinatesDict =
@{
@"latitude": @(location.coordinate.latitude),
@"longitude": @(location.coordinate.longitude),
@"accuracy": @(location.horizontalAccuracy),
@"altitude": @(location.altitude),
@"speed": @(location.speed),
@"speed_accuracy": @0.0,
@"heading": @(location.course),
@"time": @(((double) timeInSeconds) * 1000.0) // in milliseconds since the epoch
};

@{
@"latitude": @(location.coordinate.latitude),
@"longitude": @(location.coordinate.longitude),
@"accuracy": @(location.horizontalAccuracy),
@"verticalAccuracy": @(location.verticalAccuracy),
@"altitude": @(location.altitude),
@"speed": @(location.speed),
@"speed_accuracy": superiorToIos10 ? @(location.speedAccuracy) : @0.0,
@"heading": @(location.course),
@"time": @(((double) timeInSeconds) * 1000.0) // in milliseconds since the epoch
};

if (self.locationWanted) {
self.locationWanted = NO;
self.flutterResult(coordinatesDict);
Expand Down

0 comments on commit 6a705ab

Please sign in to comment.