Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for new Android media and alarm permissions #933

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions permission_handler_platform_interface/CHANGELOG.md
@@ -1,3 +1,7 @@
## 3.9.0

* Added support for the new Android 13 permissions: SCHEDULE_EXACT_ALARM, READ_MEDIA_IMAGES, READ_MEDIA_VIDEO and READ_MEDIA_AUDIO

## 3.8.0

* Added support for the new Android 13 permission: NEARBY_WIFI_DEVICES.
Expand Down
28 changes: 25 additions & 3 deletions permission_handler_platform_interface/lib/src/permissions.dart
Expand Up @@ -67,7 +67,8 @@ class Permission {
/// iOS: Nothing
static const phone = PermissionWithService._(8);

/// Android: Nothing
/// When running on Android T and above: Read image files from external storage
/// When running on Android < T: Nothing
/// iOS: Photos
/// iOS 14+ read & write access level
static const photos = Permission._(9);
Expand Down Expand Up @@ -180,6 +181,21 @@ class Permission {
///iOS: Nothing
static const nearbyWifiDevices = Permission._(31);

/// When running on Android T and above: Read video files from external storage
/// When running on Android < T: Nothing
/// iOS: Nothing
static const videos = Permission._(32);

/// When running on Android T and above: Read audio files from external storage
/// When running on Android < T: Nothing
/// iOS: Nothing
static const audio = Permission._(33);

/// When running on Android S and above: Allows exact alarm functionality
/// When running on Android < S: Nothing
///iOS: Nothing
static const scheduleExactAlarm = Permission._(34);

/// Returns a list of all possible [PermissionGroup] values.
static const List<Permission> values = <Permission>[
calendar,
Expand Down Expand Up @@ -213,7 +229,10 @@ class Permission {
bluetoothScan,
bluetoothAdvertise,
bluetoothConnect,
nearbyWifiDevices
nearbyWifiDevices,
videos,
audio,
scheduleExactAlarm
];

static const List<String> _names = <String>[
Expand Down Expand Up @@ -248,7 +267,10 @@ class Permission {
'bluetoothScan',
'bluetoothAdvertise',
'bluetoothConnect',
'nearbyWifiDevices'
'nearbyWifiDevices',
'videos',
'audio',
'scheduleExactAlarm'
];

@override
Expand Down
2 changes: 1 addition & 1 deletion permission_handler_platform_interface/pubspec.yaml
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.8.0
version: 3.9.0

dependencies:
flutter:
Expand Down
Expand Up @@ -6,7 +6,7 @@ void main() {
() {
const values = Permission.values;

expect(values.length, 32);
expect(values.length, 35);
});

test('check if byValue returns corresponding PermissionGroup value', () {
Expand Down