Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions permission_handler/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 10.1.0

* Added support for the new Android 13 granular media permissions: READ_MEDIA_IMAGES, READ_MEDIA_VIDEO and READ_MEDIA_AUDIO.

## 10.0.0

* __BREAKING CHANGE__: Updated Android `compileSdkVersion` to `33` to handle the new `POST_NOTIFICATIONS` permission.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@
<!-- Permissions options for the `access notification policy` group -->
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>

<!-- Permissions options for the `notification` group -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<!-- Permissions options for the `photos` group -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />

<!-- Permissions options for the `videos` group -->
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />

<!-- Permissions options for the `audio` group -->
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />

<application
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
Expand Down
1 change: 0 additions & 1 deletion permission_handler/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class _PermissionHandlerWidgetState extends State<PermissionHandlerWidget> {
} else {
return permission != Permission.unknown &&
permission != Permission.mediaLibrary &&
permission != Permission.photos &&
permission != Permission.photosAddOnly &&
permission != Permission.reminders &&
permission != Permission.appTrackingTransparency &&
Expand Down
6 changes: 3 additions & 3 deletions permission_handler/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: permission_handler
description: Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
version: 10.0.0
version: 10.1.0
homepage: https://github.com/baseflow/flutter-permission-handler

environment:
Expand All @@ -21,10 +21,10 @@ dependencies:
flutter:
sdk: flutter
meta: ^1.7.0
permission_handler_android: ^10.0.0
permission_handler_android: ^10.1.0
permission_handler_apple: ^9.0.2
permission_handler_windows: ^0.1.0
permission_handler_platform_interface: ^3.7.0
permission_handler_platform_interface: ^3.8.0

dev_dependencies:
flutter_lints: ^1.0.4
Expand Down
4 changes: 4 additions & 0 deletions permission_handler_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 10.1.0

* Added support for the new Android 13 granular media permissions: READ_MEDIA_IMAGES, READ_MEDIA_VIDEO and READ_MEDIA_AUDIO.

## 10.0.0

* __BREAKING CHANGE__: Updated Android `compileSdkVersion` to `33` to handle the new `POST_NOTIFICATIONS` permission.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ final class PermissionConstants {
static final int PERMISSION_GROUP_BLUETOOTH_SCAN = 28;
static final int PERMISSION_GROUP_BLUETOOTH_ADVERTISE = 29;
static final int PERMISSION_GROUP_BLUETOOTH_CONNECT = 30;
static final int PERMISSION_GROUP_VIDEOS = 31;
static final int PERMISSION_GROUP_AUDIO = 32;


@Retention(RetentionPolicy.SOURCE)
Expand Down Expand Up @@ -77,7 +79,9 @@ final class PermissionConstants {
PERMISSION_GROUP_ACCESS_NOTIFICATION_POLICY,
PERMISSION_GROUP_BLUETOOTH_SCAN,
PERMISSION_GROUP_BLUETOOTH_ADVERTISE,
PERMISSION_GROUP_BLUETOOTH_CONNECT
PERMISSION_GROUP_BLUETOOTH_CONNECT,
PERMISSION_GROUP_VIDEOS,
PERMISSION_GROUP_AUDIO
})
@interface PermissionGroup {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ static int parseManifestName(String permission) {
return PermissionConstants.PERMISSION_GROUP_BLUETOOTH_CONNECT;
case Manifest.permission.POST_NOTIFICATIONS:
return PermissionConstants.PERMISSION_GROUP_NOTIFICATION;
case Manifest.permission.READ_MEDIA_IMAGES:
return PermissionConstants.PERMISSION_GROUP_PHOTOS;
case Manifest.permission.READ_MEDIA_VIDEO:
return PermissionConstants.PERMISSION_GROUP_VIDEOS;
case Manifest.permission.READ_MEDIA_AUDIO:
return PermissionConstants.PERMISSION_GROUP_AUDIO;
default:
return PermissionConstants.PERMISSION_GROUP_UNKNOWN;
}
Expand Down Expand Up @@ -295,8 +301,25 @@ static List<String> getManifestNames(Context context, @PermissionConstants.Permi
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.POST_NOTIFICATIONS ))
permissionNames.add(Manifest.permission.POST_NOTIFICATIONS);
break;
case PermissionConstants.PERMISSION_GROUP_MEDIA_LIBRARY:
case PermissionConstants.PERMISSION_GROUP_PHOTOS:
// The READ_MEDIA_IMAGES permission is introduced in Android 13, meaning we should
// not handle permissions on pre Android 13 devices.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.READ_MEDIA_IMAGES ))
permissionNames.add(Manifest.permission.READ_MEDIA_IMAGES);
break;
case PermissionConstants.PERMISSION_GROUP_VIDEOS:
// The READ_MEDIA_IMAGES permission is introduced in Android 13, meaning we should
// not handle permissions on pre Android 13 devices.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.READ_MEDIA_VIDEO ))
permissionNames.add(Manifest.permission.READ_MEDIA_VIDEO);
break;
case PermissionConstants.PERMISSION_GROUP_AUDIO:
// The READ_MEDIA_IMAGES permission is introduced in Android 13, meaning we should
// not handle permissions on pre Android 13 devices.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.READ_MEDIA_AUDIO ))
permissionNames.add(Manifest.permission.READ_MEDIA_AUDIO);
break;
case PermissionConstants.PERMISSION_GROUP_MEDIA_LIBRARY:
case PermissionConstants.PERMISSION_GROUP_REMINDERS:
case PermissionConstants.PERMISSION_GROUP_UNKNOWN:
return null;
Expand Down
4 changes: 2 additions & 2 deletions permission_handler_android/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: permission_handler_android
description: Permission plugin for Flutter. This plugin provides the Android API to request and check permissions.
version: 10.0.0
version: 10.1.0
homepage: https://github.com/baseflow/flutter-permission-handler

environment:
Expand All @@ -18,7 +18,7 @@ flutter:
dependencies:
flutter:
sdk: flutter
permission_handler_platform_interface: ^3.7.0
permission_handler_platform_interface: ^3.8.0

dev_dependencies:
flutter_lints: ^1.0.4
Expand Down
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 @@
## 3.8.0

* Added support for the new Android 13 granular media permissions: READ_MEDIA_IMAGES, READ_MEDIA_VIDEO and READ_MEDIA_AUDIO.

## 3.7.0

* Added support for the new Android 12 Bluetooth permissions: BLUETOOTH_SCAN, BLUETOOTH_ADVERTISE and BLUETOOTH_CONNECT.
Expand Down
17 changes: 16 additions & 1 deletion permission_handler_platform_interface/lib/src/permissions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class Permission {
/// iOS: Nothing
static const phone = PermissionWithService._(8);

/// Android: Nothing
/// When running on Android T and above: Photos
/// When running on Android < T: Nothing
/// iOS: Photos
/// iOS 14+ read & write access level
static const photos = Permission._(9);
Expand Down Expand Up @@ -176,6 +177,16 @@ class Permission {
///iOS: Nothing
static const bluetoothConnect = Permission._(30);

/// When running on Android T and above: Videos
/// When running on Android < T: Nothing
/// iOS: Nothing
static const videos = Permission._(31);

/// When running on Android T and above: Audio files
/// When running on Android < T: Nothing
/// iOS: Nothing
static const audio = Permission._(32);

/// Returns a list of all possible [PermissionGroup] values.
static const List<Permission> values = <Permission>[
calendar,
Expand Down Expand Up @@ -209,6 +220,8 @@ class Permission {
bluetoothScan,
bluetoothAdvertise,
bluetoothConnect,
videos,
audio,
];

static const List<String> _names = <String>[
Expand Down Expand Up @@ -243,6 +256,8 @@ class Permission {
'bluetoothScan',
'bluetoothAdvertise',
'bluetoothConnect',
'videos',
'audio',
];

@override
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: 3.7.0
version: 3.8.0

dependencies:
flutter:
Expand Down