153 references to PermissionStatus
Microsoft.Maui.Essentials (153)
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);
Permissions\Permissions.ios.tvos.macos.cs (17)
22 public override Task<PermissionStatus> CheckStatusAsync() 30 public override async Task<PermissionStatus> RequestAsync() 34 var status = GetPhotoPermissionStatus(PHAccessLevel.ReadWrite); 35 if (status == PermissionStatus.Granted) 39 else if (OperatingSystem.IsIOSVersionAtLeast(14) && status == PermissionStatus.Limited) 63 public override Task<PermissionStatus> CheckStatusAsync() 71 public override async Task<PermissionStatus> RequestAsync() 75 var status = GetPhotoPermissionStatus(PHAccessLevel.AddOnly); 76 if (status == PermissionStatus.Granted) 85 static PermissionStatus GetPhotoPermissionStatus(PHAccessLevel level) 90 static async Task<PermissionStatus> RequestPhotoPermissionStatus(PHAccessLevel level) 95 static PermissionStatus Convert(PHAuthorizationStatus status) 98 PHAuthorizationStatus.Authorized => PermissionStatus.Granted, 100 PHAuthorizationStatus.Limited => PermissionStatus.Limited, 102 PHAuthorizationStatus.Denied => PermissionStatus.Denied, 103 PHAuthorizationStatus.Restricted => PermissionStatus.Restricted, 104 _ => PermissionStatus.Unknown,
Permissions\Permissions.ios.tvos.watchos.cs (20)
37 public override Task<PermissionStatus> CheckStatusAsync() => 38 Task.FromResult(PermissionStatus.Granted); 41 public override Task<PermissionStatus> RequestAsync() => 42 Task.FromResult(PermissionStatus.Granted); 122 public override Task<PermissionStatus> CheckStatusAsync() 130 public override async Task<PermissionStatus> RequestAsync() 134 var status = GetLocationStatus(true); 135 if (status == PermissionStatus.Granted || status == PermissionStatus.Disabled) 147 internal static PermissionStatus GetLocationStatus(bool whenInUse) 150 return PermissionStatus.Disabled; 160 CLAuthorizationStatus.AuthorizedAlways => PermissionStatus.Granted, 161 CLAuthorizationStatus.AuthorizedWhenInUse => whenInUse ? PermissionStatus.Granted : PermissionStatus.Denied, 162 CLAuthorizationStatus.Denied => PermissionStatus.Denied, 163 CLAuthorizationStatus.Restricted => PermissionStatus.Restricted, 164 _ => PermissionStatus.Unknown, 170 internal static Task<PermissionStatus> RequestLocationAsync(bool whenInUse, Action<CLLocationManager> invokeRequest) 173 return Task.FromResult(PermissionStatus.Disabled); 178 var tcs = new TaskCompletionSource<PermissionStatus>(locationManager);
Permissions\Permissions.ios.watchos.cs (39)
15 internal static PermissionStatus CheckPermissionStatus(EKEntityType entityType) 20 EKAuthorizationStatus.Authorized => PermissionStatus.Granted, 21 EKAuthorizationStatus.Denied => PermissionStatus.Denied, 22 EKAuthorizationStatus.Restricted => PermissionStatus.Restricted, 23 _ => PermissionStatus.Unknown, 27 internal static async Task<PermissionStatus> RequestPermissionAsync(EKEntityType entityType) 45 return results.Item1 ? PermissionStatus.Granted : PermissionStatus.Denied; 68 public override Task<PermissionStatus> CheckStatusAsync() 76 public override Task<PermissionStatus> RequestAsync() 80 var status = EventPermission.CheckPermissionStatus(EKEntityType.Event); 81 if (status == PermissionStatus.Granted) 107 public override Task<PermissionStatus> CheckStatusAsync() 115 public override Task<PermissionStatus> RequestAsync() 119 var status = EventPermission.CheckPermissionStatus(EKEntityType.Event); 120 if (status == PermissionStatus.Granted) 146 public override Task<PermissionStatus> CheckStatusAsync() 154 public override Task<PermissionStatus> RequestAsync() 158 var status = EventPermission.CheckPermissionStatus(EKEntityType.Reminder); 159 if (status == PermissionStatus.Granted) 173 public override Task<PermissionStatus> CheckStatusAsync() 181 public override Task<PermissionStatus> RequestAsync() 185 var status = GetSensorPermissionStatus(); 186 if (status == PermissionStatus.Granted) 194 internal static PermissionStatus GetSensorPermissionStatus() 198 return PermissionStatus.Disabled; 206 return PermissionStatus.Granted; 208 return PermissionStatus.Denied; 210 return PermissionStatus.Unknown; 212 return PermissionStatus.Restricted; 217 return PermissionStatus.Unknown; 220 internal static async Task<PermissionStatus> RequestSensorPermission() 228 return PermissionStatus.Granted; 233 return PermissionStatus.Denied; 236 return PermissionStatus.Unknown; 251 public override Task<PermissionStatus> CheckStatusAsync() 259 public override async Task<PermissionStatus> RequestAsync() 263 var status = LocationWhenInUse.GetLocationStatus(false); 264 if (status == PermissionStatus.Granted)
Permissions\Permissions.shared.cs (13)
19 /// <returns>A <see cref="PermissionStatus"/> value indicating the current status of the permission.</returns> 20 public static Task<PermissionStatus> CheckStatusAsync<TPermission>() 33 /// <returns>A <see cref="PermissionStatus"/> value indicating the result of this permission request.</returns> 34 public static Task<PermissionStatus> RequestAsync<TPermission>() 55 var status = await RequestAsync<TPermission>(); 57 if (status != PermissionStatus.Granted) 64 var status = await RequestAsync<TPermission>(); 66 if (status != PermissionStatus.Granted && status != PermissionStatus.Restricted) 90 /// <returns>A <see cref="PermissionStatus"/> value indicating the current status of this permission.</returns> 91 public abstract Task<PermissionStatus> CheckStatusAsync(); 101 /// <returns>A <see cref="PermissionStatus"/> value indicating the result of this permission request.</returns> 102 public abstract Task<PermissionStatus> RequestAsync();