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 partial media permission to android #1347

Merged
merged 7 commits into from
Aug 5, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
## 12.0.8

* Added support for limited photo and video permission on Android.

## 12.0.7

* Removes additional Android v1 embedding class reference.
Expand Down
2 changes: 1 addition & 1 deletion permission_handler_android/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ android {
if (project.android.hasProperty("namespace")) {
namespace 'com.baseflow.permissionhandler'
}
compileSdk 33
compileSdk 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ final class PermissionConstants {
PERMISSION_GROUP_SCHEDULE_EXACT_ALARM,
PERMISSION_GROUP_CALENDAR_WRITE_ONLY,
PERMISSION_GROUP_CALENDAR_FULL_ACCESS,
PERMISSION_GROUP_ASSISTANT
PERMISSION_GROUP_ASSISTANT,
})
@interface PermissionGroup {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,18 @@ private int determinePermissionStatus(final @PermissionConstants.PermissionGroup
} else {
permissionStatuses.add(PermissionConstants.PERMISSION_STATUS_GRANTED);
}
} else {
} else if (permission == PermissionConstants.PERMISSION_GROUP_PHOTOS || permission == PermissionConstants.PERMISSION_GROUP_VIDEOS){
final int permissionStatusLimited = ContextCompat.checkSelfPermission(context, Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED);
final int permissionStatus = ContextCompat.checkSelfPermission(context, name);
if (permissionStatusLimited == PackageManager.PERMISSION_GRANTED){
permissionStatuses.add(PermissionConstants.PERMISSION_STATUS_LIMITED);
}
else{
if (permissionStatus != PackageManager.PERMISSION_GRANTED) {
permissionStatuses.add(PermissionUtils.determineDeniedVariant(activity, name));
}
}
}else {
final int permissionStatus = ContextCompat.checkSelfPermission(context, name);
if (permissionStatus != PackageManager.PERMISSION_GRANTED) {
permissionStatuses.add(PermissionUtils.determineDeniedVariant(activity, name));
Expand Down
4 changes: 2 additions & 2 deletions permission_handler_android/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
namespace 'com.baseflow.permissionhandler.example'
compileSdk 33
compileSdk 34

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.baseflow.permissionhandler.example"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED" />

<!-- Permissions options for the `camera` group -->
<uses-permission android:name="android.permission.CAMERA"/>
Expand Down
2 changes: 1 addition & 1 deletion permission_handler_android/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: permission_handler_android
description: Permission plugin for Flutter. This plugin provides the Android API to request and check permissions.
homepage: https://github.com/baseflow/flutter-permission-handler
version: 12.0.7
version: 12.0.8

environment:
sdk: ">=2.15.0 <4.0.0"
Expand Down
Loading