pinballmap / pbm-react

PBM React Native: iOS & Android Apps
https://pinballmap.com/app
GNU General Public License v3.0
33 stars 9 forks source link

Better handling of users without location services turned on #524

Closed RyanTG closed 8 months ago

RyanTG commented 10 months ago

To start, some definitions:

Location Services: A phone-level setting for enabling/disabling whether the device can track your location. Shows up as a prompt when you first launch the app.

Location Permission: An app-level permission for granting permission for the app to use location (only available if Location Services is on). This also shows up as a prompt when you first launch the app, and you can reject, allow once, or allow when app is in use.

This issue is for when Location Services is turned OFF. This issue is not concerned with Location Permissions.

Currently, if Location Services are off:

When you launch the app you get a prompt reminding you to turn on Location Services (and once you do that, you get another prompt to grant the Location Permission, if it's not already granted). This Location Services prompt comes up every single time you launch the app. I assume this prompt is currently triggered because we are attempting to obtain user location on first launch.

Other apps, like Google Maps, do not prompt you for this on launch, and, even though they don't have your location, they load the map to where you were when you last used it. Apps like Google Maps prompt you for it if you do something like click "my location."

Suggested behavior:

If Location Services are turned off, do not prompt. Instead, store the user's last location or lat/lon query in async storage, so that when they open the app again we have some place to put them (default to portland if we don't have the last lat/lon).

RyanTG commented 8 months ago

https://docs.expo.dev/versions/latest/sdk/location/#locationhasservicesenabledasync

bpoore commented 8 months ago

Thank you for the well documented issue, this is great. Question- do we wan to go back to the user's last lat/lon only if Location Services are off or if Location Tracking is off too?

RyanTG commented 8 months ago

I guess both.

If we have Location Permission not set yet, then I think we should prompt for it. If Location Permission has been set to Never, then we shouldn't prompt unless My Location has been pressed (which is the same as what I suggested above for Location Services).

If either Location Permission or Location Services is not enabled, then we might want to show a different "my location" icon, such as https://icons.expo.fyi/Index/MaterialIcons/location-off for iOS and https://icons.expo.fyi/Index/MaterialIcons/location-disabled for Android.

That is what google maps does. Though they also make it so you can't even search, which is strange. That different icon helps communicate to the user that full functionality is not present.

bpoore commented 8 months ago

I have a branch if location tracking is off for any reason, the app will open where it was last at... it's pretty sweet, that was a great idea.

I can look more, but I haven't been finding anything specific about allowing the Location Services prompt to load once and then not again. If we don't want to repeatedly display this, we can hide the LocationPuck on the map if location permission has not been set. I considered an option where we use local storage or something to manage showing an alert ourselves, but it feels like it will be hard to necessarily get that right. My initial thought (assuming folks with location services turned off are well aware), is that we check if a device has location services turned off and if not, hide the LocationPuck so the system prompt doesn't come up at all. Then if the user presses the "my location" icon, they will get messaging (we can make it specific to services vs location permission in there if we want).

RyanTG commented 8 months ago

Makes sense to hide the puck.

bpoore commented 8 months ago

Needs more testing, but unless something comes up with additional testing on either of our parts branch with the icon updates / hiding the location puck if location services is disabled.

bpoore commented 8 months ago

Merged to master 🚀