File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
library/multipicker/src/main/java/im/vector/lib/multipicker Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import androidx.activity.result.ActivityResultLauncher
17
17
import im.vector.lib.core.utils.compat.getParcelableArrayListExtraCompat
18
18
import im.vector.lib.core.utils.compat.getParcelableExtraCompat
19
19
import im.vector.lib.core.utils.compat.queryIntentActivitiesCompat
20
+ import timber.log.Timber
20
21
21
22
/* *
22
23
* Abstract class to provide all types of Pickers.
@@ -106,6 +107,14 @@ abstract class Picker<T> {
106
107
}
107
108
}
108
109
}
109
- return selectedUriList.onEach { context.grantUriPermission(context.applicationContext.packageName, it, Intent .FLAG_GRANT_READ_URI_PERMISSION ) }
110
+ selectedUriList.forEach { uri ->
111
+ try {
112
+ context.grantUriPermission(context.applicationContext.packageName, uri, Intent .FLAG_GRANT_READ_URI_PERMISSION )
113
+ } catch (e: SecurityException ) {
114
+ // Handle the exception, e.g., log it or notify the user
115
+ Timber .w(" Picker" , " Failed to grant URI permission for $uri : ${e.message} " )
116
+ }
117
+ }
118
+ return selectedUriList
110
119
}
111
120
}
You can’t perform that action at this time.
0 commit comments