Skip to content

Commit

Permalink
WIP - READ_MEDIA_VISUAL_USER_SELECTED
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshnsears committed Aug 31, 2023
1 parent bc037b3 commit 1a0d16e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
9 changes: 0 additions & 9 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<application
Expand Down
15 changes: 14 additions & 1 deletion module/permissions/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest/>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<!-- <uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />-->
<!-- <uses-permission-->
<!-- android:name="android.permission.READ_EXTERNAL_STORAGE"-->
<!-- android:maxSdkVersion="33" />-->
<uses-permission
android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED"/>

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.app.Activity
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.provider.Settings
import android.widget.Toast
import androidx.activity.compose.ManagedActivityResultLauncher
Expand Down Expand Up @@ -65,8 +66,13 @@ fun PermissionButtonStorage(viewModelPermission: ViewModelPermission) {

if (buttonEnabled.value) {
if (permissionPrompt.value == PermissionPrompt.PERMISSION_DIALOG) {
launcherRequestPermissionAccessPhotos
.launch(Manifest.permission.READ_EXTERNAL_STORAGE)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
launcherRequestPermissionAccessPhotos
.launch(Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED)
} else {
launcherRequestPermissionAccessPhotos
.launch(Manifest.permission.READ_EXTERNAL_STORAGE)
}
} else {
launcherAppInfoAccessPhotos
.launch(
Expand Down

0 comments on commit 1a0d16e

Please sign in to comment.