mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 01:45:52 +03:00
Fix crash when editing image
This commit is contained in:
parent
b8eeede5fd
commit
b5a402c1e1
1 changed files with 3 additions and 1 deletions
|
@ -201,7 +201,9 @@ class AttachmentsPreviewFragment @Inject constructor(
|
||||||
private fun doHandleEditAction() = withState(viewModel) {
|
private fun doHandleEditAction() = withState(viewModel) {
|
||||||
val currentAttachment = it.attachments.getOrNull(it.currentAttachmentIndex) ?: return@withState
|
val currentAttachment = it.attachments.getOrNull(it.currentAttachmentIndex) ?: return@withState
|
||||||
val destinationFile = File(requireContext().cacheDir, "${currentAttachment.name}_edited_image_${System.currentTimeMillis()}")
|
val destinationFile = File(requireContext().cacheDir, "${currentAttachment.name}_edited_image_${System.currentTimeMillis()}")
|
||||||
UCrop.of(currentAttachment.queryUri.toUri(), destinationFile.toUri())
|
// Note: using currentAttachment.queryUri.toUri() make the app crash when sharing from Google Photos
|
||||||
|
val uri = File(currentAttachment.path).toUri()
|
||||||
|
UCrop.of(uri, destinationFile.toUri())
|
||||||
.withOptions(
|
.withOptions(
|
||||||
UCrop.Options()
|
UCrop.Options()
|
||||||
.apply {
|
.apply {
|
||||||
|
|
Loading…
Reference in a new issue