This repository has been archived by the owner on May 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 506
Permissions API's #18
Comments
I think we also need some helper properties/static readonly fields that return the correct string permission for a given platform: This is not how I'd want the actual implementation to be, but to illustrate the idea: public static class PermissionType
{
#if __ANDROID__
public static readonly Camera = "android.permission.CAMERA";
#elif __IOS__
public static readonly Camera = "Camera";
#elif __UWP__
public static readonly Camera = "Camera";
#endif
} So that the user can call the api's more sanely splat: await Permissions.RequestPermissionAsync(PermissionType.Camera); |
I may be changing my mind on this a bit now. Looking at iOS and UWP, they both have different code paths depending on which permission has been requested, unlike Android which is just a string to identify the permission. I'm starting to think an enum was already the best choice here. |
Redth
added a commit
that referenced
this issue
Mar 28, 2018
* Initial pass at permissions * Don’t need async on EnsureDeclared * Fix BOM that StyleCop was not happy about * Use correct support lib package * Added device tests for permissions * Track android permission requests This keeps a dictionary of permission requests so as to not duplicate existing requests for permissions, as well as to track their status when the results come in. * Pass permission results call to Caboodle * Check platform target, not runtime version * New tuples! * Add missing using * iOS: return granted for irrelevant permissions * Fix tests around LocationWhenInUse * Permissions Device Tests check throws on some * Get battery permission for android device tests * Android permission requests should be runtime only * Fix requestCode scope on android permissions * Use inner method instead of delegate * Refactor permission declaration check on iOS * Only check Info.plist permissions on iOS 8.0+ * Always be making stylecop happy * Permissions are internal only for v1
Redth
pushed a commit
that referenced
this issue
Jul 12, 2021
merge xamarin:main into dimonovdd:main
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Check and Request permissions.
Internally we need to ensure we have API’s for a couple of things:
internal bool EnsurePermissionDeclared (string permission)
checks if Info.plist on iOS, or AndroidManifest.xml, or x on UWP has the permission declared/defined and throws an exception with a meaningful error message including a link to documentation of how to ensure permissions are defined in the appropriate file for the given platform at runtime.Permissions
PermissionStatus (enum)
The text was updated successfully, but these errors were encountered: