Skip to content
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

fix: heading speed w3c spec #270

Merged
merged 2 commits into from
Sep 15, 2023

Conversation

breautek
Copy link
Contributor

Platforms affected

ALl

Motivation and Context

Rebase of #77

Maintains the W3C spec by initializing speed and heading to null if the values are not found or not within the expected range. See https://w3c.github.io/geolocation-api/#constructing-a-geolocationposition for more details:

Initialize coord's speed attribute to a non-negative real number, or as null if the implementation cannot provide speed information.

Initialize coord's heading attribute in degrees, or null if the implementation cannot provide heading information.

Description

Asserts the values are in proper range

Testing

  • Ran paramedic tests on iOS 16.4
  • Ran paramedic tests on Android
  • Ran npm test

Note that test fails without manual interactions on the simulator due to the permission prompts.

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

Malte Legenhausen added 2 commits September 14, 2023 22:37
…tion.

Speed can have a negative value on iOS devices when the OS is not able to determine the current speed.
This is against the w3c specification. Which only allows null and a number value >= 0.

See the following links for further informations:

 * https://dev.w3.org/geo/api/spec-source.html#speed
 * https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocation_Class/#//apple_ref/occ/instp/CLLocation/speed
…cation.

Heading (course) can have a negative value on iOS devices when the OS is not able to determine the current heading.
This is against the w3c specification. Which only allows null and a number value >= 0 and <= 360.

See the following links for further informations:

 * https://dev.w3.org/geo/api/spec-source.html#heading
 * https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocation_Class/#//apple_ref/occ/instp/CLLocation/course
@breautek breautek added this to the 5.0.0 milestone Sep 15, 2023
@breautek breautek requested a review from erisu September 15, 2023 01:47
@breautek breautek changed the title Fix/heading speed w3c spec fix: heading speed w3c spec Sep 15, 2023
@breautek breautek merged commit 13f2a20 into apache:master Sep 15, 2023
6 of 11 checks passed
@breautek breautek deleted the fix/heading-speed-w3c-spec branch September 15, 2023 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants