mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
No need for WRITE_EXTERNAL permission to send attachment to the app (anymore?)
This commit is contained in:
parent
5541c2e190
commit
38843f74ab
2 changed files with 1 additions and 24 deletions
|
@ -1100,18 +1100,6 @@ class RoomDetailFragment @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private val writingFileActivityResultLauncher = registerForPermissionsResult { allGranted ->
|
||||
if (allGranted) {
|
||||
val pendingUri = roomDetailViewModel.pendingUri
|
||||
if (pendingUri != null) {
|
||||
roomDetailViewModel.pendingUri = null
|
||||
sendUri(pendingUri)
|
||||
}
|
||||
} else {
|
||||
cleanUpAfterPermissionNotGranted()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupComposer() {
|
||||
val composerEditText = composerLayout.composerEditText
|
||||
autoCompleter.setup(composerEditText)
|
||||
|
@ -1157,14 +1145,7 @@ class RoomDetailFragment @Inject constructor(
|
|||
}
|
||||
|
||||
override fun onRichContentSelected(contentUri: Uri): Boolean {
|
||||
// We need WRITE_EXTERNAL permission
|
||||
return if (checkPermissions(PERMISSIONS_FOR_WRITING_FILES, requireActivity(), writingFileActivityResultLauncher)) {
|
||||
sendUri(contentUri)
|
||||
} else {
|
||||
roomDetailViewModel.pendingUri = contentUri
|
||||
// Always intercept when we request some permission
|
||||
true
|
||||
}
|
||||
return sendUri(contentUri)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1561,7 +1542,6 @@ class RoomDetailFragment @Inject constructor(
|
|||
private fun cleanUpAfterPermissionNotGranted() {
|
||||
// Reset all pending data
|
||||
roomDetailViewModel.pendingAction = null
|
||||
roomDetailViewModel.pendingUri = null
|
||||
attachmentsHelper.pendingType = null
|
||||
}
|
||||
|
||||
|
|
|
@ -128,9 +128,6 @@ class RoomDetailViewModel @AssistedInject constructor(
|
|||
// Slot to keep a pending action during permission request
|
||||
var pendingAction: RoomDetailAction? = null
|
||||
|
||||
// Slot to keep a pending uri during permission request
|
||||
var pendingUri: Uri? = null
|
||||
|
||||
// Slot to store if we want to prevent preview of attachment
|
||||
var preventAttachmentPreview = false
|
||||
|
||||
|
|
Loading…
Reference in a new issue