bmoren / p5.geolocation

a geolocation and geofencing library for p5.js
GNU Lesser General Public License v2.1
90 stars 27 forks source link

ios 9 silently fails if location services turned off #5

Open tstefanich opened 8 years ago

tstefanich commented 8 years ago

When testing on ios 9 and if the users Settings -> Privacy -> Location services -> Safari are set to "Never" the webpage will not prompt for permission. There should maybe be a more explicit alert that notifies vs a console log. Will look into testing to see if we can do something more direct for ios / mobile.

bmoren commented 8 years ago

Perhaps we can add an attribute to turn on a visual warning / error message that can be toggled on or off with a attribute to geoCheck().

geoCheck(true) //display custom browser based comparability messages

bmoren commented 8 years ago

Or we could make a more universal geoError() which could be hooked into everything that has a visual message. I might make the argument for letting the user handle the visual side of things in case they want something more custom than what we would provide. Thoughts?

mediaupstream commented 8 years ago

+1 for letting the user decide how to display errors. I would probably remove all console.log() calls and either return the error to an error callback function or throw a proper error like p5.js core does, example: https://github.com/processing/p5.js/blob/master/src/color/p5.Color.js#L594

tstefanich commented 8 years ago

I mean I figured it out pretty easily.... but I feel like someone with less web experience, especially with mobile, or a semi beginner programmer could use a more explicit message...

It just seems like overkill to set up remote console logging, which is not that hard but I haven't needed to do this myself very often in work that I have done, to get a console message from the device that is "Check and make sure location services are turned at in Settings->Safari->Location Services ect ect"

So I guess its a question for a novice web developer what should we do to make this more clear if anything? A few thoughts below

  1. is to make a note in the readme about location services needing to be on if you are testing on the specific device because even though safari is getting asked to allow for your location it doesn't show up at all if Location Services are turned off.
  2. Would to make a section or note about remote debugging for mobile devices and link to a tutorial maybe like this one https://blog.idrsolutions.com/2015/02/remote-debugging-ios-safari-on-os-x-windows-and-linux/
  3. would maybe be adding some parameter to allow to alert errors for mobile devices or something to avoid having to do the remote debugging. This is maybe alittle bit more complicated because it would be nice to conceptually fit with how p5 does error handling but also this library is a little different then other libraries because its most likely mobile device focused where as the others are more general purpose.

Thoughts??

On Sun, Jun 26, 2016 at 2:41 PM, Ben Moren notifications@github.com wrote:

Or we could make a more universal geoError() which could be hooked into everything that has a visual message. I might make the argument for letting the user handle the visual side of things in case they want something more custom than what we would provide. Thoughts?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bmoren/p5.geolocation/issues/5#issuecomment-228624674, or mute the thread https://github.com/notifications/unsubscribe/AAxe5yOw--bT0q50BwBetilxFWz61Xbhks5qPvHxgaJpZM4I-nzs .

Tyler Stefanich http://www.tylerstefanich.com

bmoren commented 8 years ago

I agree that remote logging is a huge pain. Anything we can do to get around that would be ideal. To your thoughts, yes, lets do all 3. I think this is the simplest way around for novice developers. We can make a catchall error function which throws a visible alert which can be toggled on/off which is enabled by default. If on, visible alert is shown in addition to a p5 style error thrown, if off, the error as derek pointed out above is thrown only.