You've already forked element-android
mirror of
https://github.com/vector-im/element-android.git
synced 2025-07-29 19:41:14 +03:00
Merge pull request #8908 from toshanmugaraj/FileAtachmentCrash
Fix file attachment crash
This commit is contained in:
@ -17,6 +17,7 @@ import androidx.activity.result.ActivityResultLauncher
|
||||
import im.vector.lib.core.utils.compat.getParcelableArrayListExtraCompat
|
||||
import im.vector.lib.core.utils.compat.getParcelableExtraCompat
|
||||
import im.vector.lib.core.utils.compat.queryIntentActivitiesCompat
|
||||
import timber.log.Timber
|
||||
|
||||
/**
|
||||
* Abstract class to provide all types of Pickers.
|
||||
@ -106,6 +107,14 @@ abstract class Picker<T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
return selectedUriList.onEach { context.grantUriPermission(context.applicationContext.packageName, it, Intent.FLAG_GRANT_READ_URI_PERMISSION) }
|
||||
selectedUriList.forEach { uri ->
|
||||
try {
|
||||
context.grantUriPermission(context.applicationContext.packageName, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
} catch (e: SecurityException) {
|
||||
// Handle the exception, e.g., log it or notify the user
|
||||
Timber.w("Picker", "Failed to grant URI permission for $uri: ${e.message}")
|
||||
}
|
||||
}
|
||||
return selectedUriList
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user