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

Add location accuracy and bearing to geofence event data #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Buthrakaur
Copy link
Contributor

No description provided.

@@ -138,13 +138,19 @@ - (BOOL)_isRegionMonitoringPossible:(CLAuthorizationStatus)status {
);
}

- (void)_sendRegionChangeEventWithIdentifier:(NSString *)identifier didEnter:(BOOL)didEnter didExit:(BOOL)didExit {
- (void)_sendRegionChangeEventWithIdentifier:(NSString *)identifier didEnter:(BOOL)didEnter didExit:(BOOL)didExit locationManager:(CLLocationManager *)locationManager {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

locationManager is available as local property. Why do you want to pass it along?

Copy link
Contributor Author

@Buthrakaur Buthrakaur Aug 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right - I'm an iOS noob and wasn't sure if it's safe to use the local prop. I just propagated it from the caller method, where it's parameter too.

NSDictionary *body = @{
@"region": @{
@"identifier": identifier,
},
@"didEnter": @(didEnter),
@"didExit": @(didExit),
@"accuracy": @(locationManager.location != nil ? locationManager.location.horizontalAccuracy : 99999),
@"bearing": @(locationManager.location != nil ? locationManager.location.course : 0),
@"location": @{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the location is nil, what will the location be in JavaScript-land? I think it should be null instead of { latitude: 0, longitude: 0 }. Do you agree?

NSDictionary *body = @{
@"region": @{
@"identifier": identifier,
},
@"didEnter": @(didEnter),
@"didExit": @(didExit),
@"accuracy": @(locationManager.location != nil ? locationManager.location.horizontalAccuracy : 99999),
@"bearing": @(locationManager.location != nil ? locationManager.location.course : 0),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the comment about the location, what if location is nil? Course 0 means 0 degrees which is north. Seems to be invalid if we pass 0 if the location is nil.

Perhaps we can put the location properties, like accuracy and course or bearing, in the location property.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null-able location property sounds good - we just need to make the format same for both platforms.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I would prefer the iOS naming, but I guess you applied the Android naming. I think most important is that we keep the names the same on both platforms, like you mentioned.

I do wonder about horizontalAccuracy vs accuracy. On iOS there is also verticalAccuracy, so naming it accuracy may not be accurate (pun intended). Are there any equivalents in Android, or is there just one accuracy?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can find the iOS docs of the location object at https://developer.apple.com/documentation/corelocation/cllocation.

@Buthrakaur
Copy link
Contributor Author

@martijndeh should I fix the issues or will you do it?

@martijndeh
Copy link
Owner

If you have time please do. 👍

@martijndeh
Copy link
Owner

How is it going?

@Buthrakaur
Copy link
Contributor Author

@martijndeh sorry - didn't have time to clean this up yet, sorry ;(

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