Skip to content

Commit 384fc9e

Browse files
brampmvanbeusekom
andauthored
Update documentation in permission_status.dart (#1161)
* Update documentation in permission_status.dart Updated the documentation to be clearer when limited and provisional statuses may be returned. The docs are repeated ~3 times, so I made them consistent. * Updated the permanentlyDenied description per changes made in version 11.0.0 * Bumped the version in pubspec and CHANGELOG. --------- Co-authored-by: Maurits van Beusekom <maurits@vnbskm.nl>
1 parent d97a082 commit 384fc9e

File tree

3 files changed

+44
-18
lines changed

3 files changed

+44
-18
lines changed

permission_handler_platform_interface/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 4.0.2
2+
3+
* Improved the documentation around the `PermissionStatus`, `PermissionStatusGetters` and `FuturePermissionStatusGetters`.
4+
15
## 4.0.1
26

37
* Updates Android documentation on how to use `permission.photo` on Android 12 (API 32) and below and Android 13 (API 33) and above.

permission_handler_platform_interface/lib/src/permission_status.dart

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ part of permission_handler_platform_interface;
22

33
/// Defines the state of a [Permission].
44
enum PermissionStatus {
5-
/// The user denied access to the requested feature,
6-
/// permission needs to be asked first.
5+
/// The user denied access to the requested feature, permission needs to be
6+
/// asked first.
77
denied,
88

99
/// The user granted access to the requested feature.
@@ -12,19 +12,31 @@ enum PermissionStatus {
1212
/// The OS denied access to the requested feature. The user cannot change
1313
/// this app's status, possibly due to active restrictions such as parental
1414
/// controls being in place.
15+
///
1516
/// *Only supported on iOS.*
1617
restricted,
1718

18-
///User has authorized this application for limited access.
19+
/// The user has authorized this application for limited access. So far this
20+
/// is only relevant for the Photo Library picker.
21+
///
1922
/// *Only supported on iOS (iOS14+).*
2023
limited,
2124

2225
/// Permission to the requested feature is permanently denied, the permission
2326
/// dialog will not be shown when requesting this permission. The user may
2427
/// still change the permission status in the settings.
28+
///
29+
/// *On Android:*
30+
/// Android 11+ (API 30+): whether the user denied the permission for a second
31+
/// time.
32+
/// Below Android 11 (API 30): whether the user denied access to the requested
33+
/// feature and selected to never again show a request.
34+
///
35+
/// *On iOS:*
36+
/// If the user has denied access to the requested feature.
2537
permanentlyDenied,
2638

27-
/// The application is provisionally authorized to post noninterruptive user
39+
/// The application is provisionally authorized to post non-interruptive user
2840
/// notifications.
2941
///
3042
/// *Only supported on iOS (iOS12+).*
@@ -68,8 +80,7 @@ extension PermissionStatusValue on PermissionStatus {
6880

6981
/// Utility getter extensions for the [PermissionStatus] type.
7082
extension PermissionStatusGetters on PermissionStatus {
71-
/// If the user denied access to the requested feature,
72-
/// permission needs to be asked first.
83+
/// If the user denied access to the requested feature.
7384
bool get isDenied => this == PermissionStatus.denied;
7485

7586
/// If the user granted access to the requested feature.
@@ -78,9 +89,14 @@ extension PermissionStatusGetters on PermissionStatus {
7889
/// If the OS denied access to the requested feature. The user cannot change
7990
/// this app's status, possibly due to active restrictions such as parental
8091
/// controls being in place.
92+
///
8193
/// *Only supported on iOS.*
8294
bool get isRestricted => this == PermissionStatus.restricted;
8395

96+
/// If the permission to the requested feature is permanently denied, the
97+
/// permission dialog will not be shown when requesting this permission. The
98+
/// user may still change the permission status in the settings.
99+
///
84100
/// *On Android:*
85101
/// Android 11+ (API 30+): whether the user denied the permission for a second
86102
/// time.
@@ -90,17 +106,18 @@ extension PermissionStatusGetters on PermissionStatus {
90106
///
91107
/// *On iOS:*
92108
/// If the user has denied access to the requested feature.
93-
/// The user may still change the permission status in the settings
94-
///
95-
/// WARNING: This can only be determined AFTER requesting this permission.
96-
/// Therefore make a `request` call first.
97109
bool get isPermanentlyDenied => this == PermissionStatus.permanentlyDenied;
98110

99-
/// Indicates that permission for limited use of the resource is granted.
111+
/// If the user has authorized this application for limited access. So far
112+
/// this is only relevant for the Photo Library picker.
113+
///
114+
/// *Only supported on iOS (iOS14+).*
100115
bool get isLimited => this == PermissionStatus.limited;
101116

102-
/// If the application is provisionally authorized to post noninterruptive
117+
/// If the application is provisionally authorized to post non-interruptive
103118
/// user notifications.
119+
///
120+
/// *Only supported on iOS (iOS12+).*
104121
bool get isProvisional => this == PermissionStatus.provisional;
105122
}
106123

@@ -119,25 +136,30 @@ extension FuturePermissionStatusGetters on Future<PermissionStatus> {
119136
/// *Only supported on iOS.*
120137
Future<bool> get isRestricted async => (await this).isRestricted;
121138

139+
/// If the permission to the requested feature is permanently denied, the
140+
/// permission dialog will not be shown when requesting this permission. The
141+
/// user may still change the permission status in the settings.
142+
///
122143
/// *On Android:*
123144
/// Android 11+ (API 30+): whether the user denied the permission for a second
124145
/// time.
125146
/// Below Android 11 (API 30): whether the user denied access to the requested
126147
/// feature and selected to never again show a request.
127-
/// The user may still change the permission status in the settings.
128148
///
129149
/// *On iOS:*
130150
/// If the user has denied access to the requested feature.
131-
/// The user may still change the permission status in the settings
132151
Future<bool> get isPermanentlyDenied async =>
133152
(await this).isPermanentlyDenied;
134153

135-
/// Indicates that permission for limited use of the resource is granted.
154+
/// If the user has authorized this application for limited access. So far
155+
/// this is only relevant for the Photo Library picker.
156+
///
157+
/// *Only supported on iOS (iOS14+).*
136158
Future<bool> get isLimited async => (await this).isLimited;
137159

138-
/// If the application is provisionally authorized to post noninterruptive
160+
/// If the application is provisionally authorized to post non-interruptive
139161
/// user notifications.
140162
///
141-
/// *Only supported on iOS.*
163+
/// *Only supported on iOS (iOS12+).*
142164
Future<bool> get isProvisional async => (await this).isProvisional;
143165
}

permission_handler_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: A common platform interface for the permission_handler plugin.
33
homepage: https://github.com/baseflow/flutter-permission-handler/tree/master/permission_handler_platform_interface
44
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
55
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
6-
version: 4.0.1
6+
version: 4.0.2
77

88
dependencies:
99
flutter:

0 commit comments

Comments
 (0)