xamarin / Essentials

Xamarin.Essentials is no longer supported. Migrate your apps to .NET MAUI, which includes Maui.Essentials.
https://aka.ms/xamarin-upgrade
Other
1.52k stars 505 forks source link

Fix #1999 - checkasync should return restricted for locationinuse whe… #2005

Closed aritchie closed 2 years ago

aritchie commented 2 years ago

Description of Change

Ensuring Permissions.LocationWhenInUse.CheckAsync on Android returns Restricted if only coarse permission is granted

Bugs Fixed

API Changes

LocationWhenInUse & pulled out CheckSelfPermission out of the loop so it can be used for individual checks

Changed:

Since CheckSelfPermission was moved to DoCheck, BasePlatformPermission.CheckStatusAsync had it's loop code pointed at new method.

LocationWhenInUse overrides CheckAsync now

Behavioral Changes

If AccessFineLocation is denied, but AccessCoarseLocation is granted - PermissionStatus.Restricted is now returned

PR Checklist

Cheesebaron commented 2 years ago

Seems to work! Screenshot_1651830213 Screenshot_1651830216 Screenshot_1651830219

I made a small test project for this here: https://github.com/Cheesebaron/EssentialsLocationPermissionTest

jfversluis commented 2 years ago

Thanks so much @Cheesebaron @aritchie <3