Skip to content

Commit

Permalink
Updates documentation for Permission.photos on Android (#1195)
Browse files Browse the repository at this point in the history
* updates documentation for Permission.photos on Android

* added style change

* update

* minor update
  • Loading branch information
TimHoogstrate authored Oct 18, 2023
1 parent d6a4a36 commit 7a0244d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
4 changes: 4 additions & 0 deletions permission_handler_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.0.1

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

## 4.0.0

* **BREAKING CHANGE**: Replaces `Permission.calendarReadOnly` with `Permission.calendarWriteOnly`.
Expand Down
24 changes: 19 additions & 5 deletions permission_handler_platform_interface/lib/src/permissions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,27 @@ class Permission {
/// Depending on the platform and version, the requirements are slightly
/// different:
///
/// **Android:**
/// - When running on Android 13 (API 33) and above: Read image files from
/// external storage
/// - When running below Android 13 (API 33): Nothing
///
/// **iOS:**
/// - When running Photos (iOS 14+ read & write access level)
///
/// **Android:**
/// - Devices running Android 12 (API level 32) or lower: use [Permissions.storage].
/// - Devices running Android 13 (API level 33) and above: Should use [Permissions.photos].
///
/// EXAMPLE: in Manifest:
/// <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
/// <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
///
/// In Flutter to check the status:
///
/// if (Platform.isAndroid) {
/// final androidInfo = await DeviceInfoPlugin().androidInfo;
/// if (androidInfo.version.sdkInt <= 32) {
/// use [Permissions.storage.status]
/// } else {
/// use [Permissions.photos.status]
/// }
/// }
static const photos = Permission._(9);

/// Permission for adding photos to the device's photo library (iOS only).
Expand Down
2 changes: 1 addition & 1 deletion permission_handler_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A common platform interface for the permission_handler plugin.
homepage: https://github.com/baseflow/flutter-permission-handler/tree/master/permission_handler_platform_interface
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 4.0.0
version: 4.0.1

dependencies:
flutter:
Expand Down

0 comments on commit 7a0244d

Please sign in to comment.