Permissions\Permissions.ios.cs (64)
17 internal static PermissionStatus CheckPermissionsStatus(AVAuthorizationMediaType mediaType)
22 AVAuthorizationStatus.Authorized => PermissionStatus.Granted,
23 AVAuthorizationStatus.Denied => PermissionStatus.Denied,
24 AVAuthorizationStatus.Restricted => PermissionStatus.Restricted,
25 _ => PermissionStatus.Unknown,
29 internal static async Task<PermissionStatus> RequestPermissionAsync(AVAuthorizationMediaType mediaType)
34 return auth ? PermissionStatus.Granted : PermissionStatus.Denied;
39 return PermissionStatus.Unknown;
52 public override Task<PermissionStatus> CheckStatusAsync()
60 public override async Task<PermissionStatus> RequestAsync()
64 var status = AVPermissions.CheckPermissionsStatus(AVAuthorizationMediaType.Video);
65 if (status == PermissionStatus.Granted)
81 public override Task<PermissionStatus> CheckStatusAsync()
89 public override Task<PermissionStatus> RequestAsync()
93 var status = GetAddressBookPermissionStatus();
94 if (status == PermissionStatus.Granted)
102 internal static PermissionStatus GetAddressBookPermissionStatus()
107 global::Contacts.CNAuthorizationStatus.Authorized => PermissionStatus.Granted,
108 global::Contacts.CNAuthorizationStatus.Denied => PermissionStatus.Denied,
109 global::Contacts.CNAuthorizationStatus.Restricted => PermissionStatus.Restricted,
110 _ => PermissionStatus.Unknown,
114 internal static async Task<PermissionStatus> RequestAddressBookPermission()
120 return PermissionStatus.Denied;
122 return result.Item1 ? PermissionStatus.Granted : PermissionStatus.Denied;
133 public override Task<PermissionStatus> CheckStatusAsync()
141 public override Task<PermissionStatus> RequestAsync()
145 var status = ContactsRead.GetAddressBookPermissionStatus();
146 if (status == PermissionStatus.Granted)
162 public override Task<PermissionStatus> CheckStatusAsync()
170 public override Task<PermissionStatus> RequestAsync()
174 var status = GetMediaPermissionStatus();
175 if (status == PermissionStatus.Granted)
183 internal static PermissionStatus GetMediaPermissionStatus()
188 MPMediaLibraryAuthorizationStatus.Authorized => PermissionStatus.Granted,
189 MPMediaLibraryAuthorizationStatus.Denied => PermissionStatus.Denied,
190 MPMediaLibraryAuthorizationStatus.Restricted => PermissionStatus.Restricted,
191 _ => PermissionStatus.Unknown,
195 internal static Task<PermissionStatus> RequestMediaPermission()
197 var tcs = new TaskCompletionSource<PermissionStatus>();
204 tcs.TrySetResult(PermissionStatus.Granted);
207 tcs.TrySetResult(PermissionStatus.Denied);
210 tcs.TrySetResult(PermissionStatus.Restricted);
213 tcs.TrySetResult(PermissionStatus.Unknown);
229 public override Task<PermissionStatus> CheckStatusAsync()
237 public override Task<PermissionStatus> RequestAsync()
241 var status = AVPermissions.CheckPermissionsStatus(AVAuthorizationMediaType.Audio);
242 if (status == PermissionStatus.Granted)
258 public override Task<PermissionStatus> CheckStatusAsync()
266 public override Task<PermissionStatus> RequestAsync()
270 var status = GetSpeechPermissionStatus();
271 if (status == PermissionStatus.Granted)
280 internal static PermissionStatus GetSpeechPermissionStatus()
285 SFSpeechRecognizerAuthorizationStatus.Authorized => PermissionStatus.Granted,
286 SFSpeechRecognizerAuthorizationStatus.Denied => PermissionStatus.Denied,
287 SFSpeechRecognizerAuthorizationStatus.Restricted => PermissionStatus.Restricted,
288 _ => PermissionStatus.Unknown,
292 internal static Task<PermissionStatus> RequestSpeechPermission()
294 var tcs = new TaskCompletionSource<PermissionStatus>();
301 tcs.TrySetResult(PermissionStatus.Granted);
304 tcs.TrySetResult(PermissionStatus.Denied);
307 tcs.TrySetResult(PermissionStatus.Restricted);
310 tcs.TrySetResult(PermissionStatus.Unknown);