-
Notifications
You must be signed in to change notification settings - Fork 324
Implement FixLocation.provider field based on CLLocationSourceInformation #3728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,7 +92,25 @@ class CLLocationTests: TestCase { | |
speedAccuracy: speedAccuracy, | ||
timestamp: timestamp) | ||
} | ||
|
||
#if compiler(>=5.5) | ||
if #available(iOS 15.0, *) { | ||
let sourceInfo = CLLocationSourceInformation( | ||
softwareSimulationState: true, | ||
andExternalAccessoryState: false | ||
) | ||
Comment on lines
+96
to
+100
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Despite this
|
||
location = CLLocation(coordinate: coordinate, | ||
altitude: altitude, | ||
horizontalAccuracy: horizontalAccuracy, | ||
verticalAccuracy: verticalAccuracy, | ||
course: bearing, | ||
courseAccuracy: bearingAccuracy, | ||
speed: speed, | ||
speedAccuracy: speedAccuracy, | ||
timestamp: timestamp, | ||
sourceInfo: sourceInfo) | ||
} | ||
#endif | ||
|
||
let fixLocation = FixLocation(location) | ||
|
||
XCTAssertEqual(fixLocation.coordinate.latitude, coordinate.latitude) | ||
|
@@ -108,6 +126,11 @@ class CLLocationTests: TestCase { | |
XCTAssertEqual(fixLocation.bearingAccuracy?.doubleValue, bearingAccuracy) | ||
XCTAssertEqual(fixLocation.speedAccuracy?.doubleValue, speedAccuracy) | ||
} | ||
#if compiler(>=5.5) | ||
if #available(iOS 15.0, *) { | ||
XCTAssertEqual(fixLocation.provider, "sim:1,acc:0") | ||
} | ||
#endif | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps MapboxNavigationNative could be modified to accept something more structured like a dictionary instead of a freeform, user agent–like string, so that it can format and compress it as appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we should add something iOS-specific - there is no analog of this structure on other platforms. Since this value will be used as kind of debug information I think it is okay to have it in this
provider
field in a free form. Btw initially I implemented it as a part ofFixLocation.extras
field, which allows to add any additional information to locations, but then decided thatprovider
is exactly that field that was supposed to use for such use case(i.e. point to the source of location). WDYT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant a JSON-like dictionary of strings, similar to that
extras
field. But if you’re sure we won’t ever need additional structure beyond this format, then we can go with this more opaque string.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we will need JSON here, I'd prefer to save bytes in history here rather than adding JSON overhead, because we likely need this data for debugging only.