Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Make BasePermission.permission public #151

Open
cannorin opened this issue Aug 12, 2019 · 2 comments
Open

Make BasePermission.permission public #151

cannorin opened this issue Aug 12, 2019 · 2 comments

Comments

@cannorin
Copy link

Related: #148

When working with the new API in shared .NET standard projects, we often have to use ShouldShowRequestPermissionRationaleAsync which does not accept type parameters.

Since member BasePermission.permission : Permission is not public, we have to write a mapping from type to enum like below:

type Permission<'Permission when 'Permission :> BasePermission and 'Permission: (new: unit -> 'Permission)>() =
    static member val Value: Permission = Permission.Unknown with get, set
do
    Permission<CalendarPermission>.Value <- Permission.Calendar
    Permission<CameraPermission>.Value <- Permission.Camera
    Permission<ContactsPermission>.Value <- Permission.Contacts
    Permission<LocationPermission>.Value <- Permission.Location
    Permission<LocationAlwaysPermission>.Value <- Permission.LocationAlways
    Permission<LocationWhenInUsePermission>.Value <- Permission.LocationWhenInUse
    Permission<MediaLibraryPermission>.Value <- Permission.MediaLibrary
    Permission<MicrophonePermission>.Value <- Permission.Microphone
    Permission<PhonePermission>.Value <- Permission.Phone
    Permission<PhotosPermission>.Value <- Permission.Photos
    Permission<RemindersPermission>.Value <- Permission.Reminders
    Permission<SensorsPermission>.Value <- Permission.Sensors
    Permission<SmsPermission>.Value <- Permission.Sms
    Permission<SpeechPermission>.Value <- Permission.Speech
    Permission<StoragePermission>.Value <- Permission.Storage

If you could make it public, it will make ShouldShowRequestPermissionRationaleAsync a lot easier to use.

@jamesmontemagno
Copy link
Owner

My plan will be to remove all old methods and to move over the rationale to also use the new system.

@paul-kiar
Copy link

Please make this API consistent with the new system. I have the same issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants