daphtdazz / WebBLE

iOS WebBluetooth Polyfill
Other
113 stars 39 forks source link

Enable location services #38

Closed boehlerlukas closed 4 years ago

boehlerlukas commented 4 years ago

Enables geo-location services for the WebBLE webview.

Sponsored by Zemtu (https://www.zemtu.com/)

daphtdazz commented 4 years ago

@boehlerlukas many apologies for taking such a long time with this (we recently had a baby...). My main question is why are we adding this when the the web view already should natively support the geo-location APIs? I don't really want to add a custom implementation of it, because there is no doubt a lot of complexity regarding security and I'd rather just rely on Apple to have got it all right. My guess is maybe you did it this way so that you could avoid a lot of requests from iOS to the user to confirm they were happy to allow a site to use their location? If so, were there any other ways to improve that experience that you considered?

Gragamel commented 4 years ago

Hi,

I actually asked for this feature and with apple you need to confirm location access for every app individually in the iPhone settings. So even for Safari you need to enable this and you have a choice always and per request. In case you say no, no location requests will work.

Michel

daphtdazz commented 4 years ago

Hi @Gragamel , I don't quite understand. You're saying that each app on iOS has a setting for whether it's allowed to use location services, but this PR can't change that. So what difference exactly does this make to the user's experience?

boehlerlukas commented 4 years ago

Hey @daphtdazz , it's about how often a user gets asked. If we overwrite the GeoLocation APIs and perform them natively, it uses the permissions from the app which a user needs to allow only once. If you use the JS native implementation, the user needs to allow access to the location every time you reload the website.

daphtdazz commented 4 years ago

the user needs to allow access to the location every time you reload the website

But all they'd have to do is tap "yes", right? That doesn't seem that difficult... also that's consistent with Safari's behaviour. I don't really think that it's worth adding an entirely separate implementation of the API just for this.

(Also it seems to have been copy / pasted from stackoverflow, which I'm a bit concerned about – I have no idea whether this implementation is secure or not.)

I do appreciate the PRs of course, so I'm sorry to disappoint you by rejecting it. Are you maintaining / distributing your own app using WebBLE Core? Because obviously you can do whatever you like in that without this code needing to be in my master branch. Or were you hoping that this feature would make it into WebBLE because you want to use it there?

I am currently working to enable the default support for the geolocation APIs so that at least there is some support.

daphtdazz commented 4 years ago

Also I've enabled location services using the normal mechanism, and it doesn't seem to be prompting me very much for permission. E.g., I enabled it on a page, I went to a different page I navigated around and ended up on the previous page, and I didn't need to prompt again. I also force closed and reopened WebBLE, and it still didn't prompt me. So I really don't see the need for this.

Gragamel commented 4 years ago

Dear Dphdazz, perhaps we are talking about different things. Atached you find screen shots from my safari app where you have location in the setting and you can set after selecten location if it is working by defalut, not or on request. Not having this option will apple make your app does have access to the location service. afbeelding afbeelding

In WebGLE you do not have this and therefore all location API calls do not work. afbeelding

daphtdazz commented 4 years ago

Hi @Gragamel , today Apple approved v 1.3.1 of WebBLE and it now should support the geolocation APIs, just by enabling it in the Info.plist. Could you have a go with it and see if that's good enough for you?

Gragamel commented 4 years ago

Yes I allready did earlier today. Just updated the app and workes like a charm they say. It sounds perhaps strange to you but this opens up my location based webapp for laser tag withoud the need of a real app or external hardwrae translating BT to WiFi. 5 stars for your effort and all the luck with your family extension.