From c5ba74690471fa8763513592ae1744678ef25763 Mon Sep 17 00:00:00 2001 From: Valere Date: Wed, 8 Jul 2020 11:00:13 +0200 Subject: [PATCH] Fixes #1647 share not working --- CHANGES.md | 2 +- .../home/room/detail/RoomDetailFragment.kt | 14 +++++++------- .../home/room/detail/RoomDetailViewModel.kt | 14 +++++++------- .../features/media/ImageMediaViewerActivity.kt | 14 +++++++------- .../riotx/features/media/VideoContentRenderer.kt | 2 +- .../features/media/VideoMediaViewerActivity.kt | 14 +++++++------- .../roomprofile/uploads/RoomUploadsViewModel.kt | 14 +++++++------- 7 files changed, 37 insertions(+), 37 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 04ac45c3cc..1200be4a12 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,7 +10,7 @@ Improvements 🙌: - Handling (almost) properly the groups fetching (#1634) Bugfix 🐛: - - + - Regression | Share action menu do not work (#1647) Translations 🗣: - diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt index 8c075004a9..d38a26c099 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt @@ -1337,13 +1337,13 @@ class RoomDetailFragment @Inject constructor( private fun onShareActionClicked(action: EventSharedAction.Share) { session.fileService().downloadFile( - FileService.DownloadMode.FOR_EXTERNAL_SHARE, - action.eventId, - action.messageContent.body, - action.messageContent.getFileUrl(), - action.messageContent.mimeType, - action.messageContent.encryptedFileInfo?.toElementToDecrypt(), - object : MatrixCallback { + downloadMode = FileService.DownloadMode.FOR_EXTERNAL_SHARE, + id = action.eventId, + fileName = action.messageContent.body, + mimeType = action.messageContent.mimeType, + url = action.messageContent.getFileUrl(), + elementToDecrypt = action.messageContent.encryptedFileInfo?.toElementToDecrypt(), + callback = object : MatrixCallback { override fun onSuccess(data: File) { if (isAdded) { shareMedia(requireContext(), data, getMimeTypeFromUri(requireContext(), data.toUri())) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt index 62830a1c63..e2e7700d1f 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt @@ -873,13 +873,13 @@ class RoomDetailViewModel @AssistedInject constructor( } } else { session.fileService().downloadFile( - FileService.DownloadMode.FOR_INTERNAL_USE, - action.eventId, - action.messageFileContent.getFileName(), - action.messageFileContent.mimeType, - mxcUrl, - action.messageFileContent.encryptedFileInfo?.toElementToDecrypt(), - object : MatrixCallback { + downloadMode = FileService.DownloadMode.FOR_INTERNAL_USE, + id = action.eventId, + fileName = action.messageFileContent.getFileName(), + mimeType = action.messageFileContent.mimeType, + url = mxcUrl, + elementToDecrypt = action.messageFileContent.encryptedFileInfo?.toElementToDecrypt(), + callback = object : MatrixCallback { override fun onSuccess(data: File) { _viewEvents.post(RoomDetailViewEvents.DownloadFileState( action.messageFileContent.mimeType, diff --git a/vector/src/main/java/im/vector/riotx/features/media/ImageMediaViewerActivity.kt b/vector/src/main/java/im/vector/riotx/features/media/ImageMediaViewerActivity.kt index 2be940d0c1..092199759f 100644 --- a/vector/src/main/java/im/vector/riotx/features/media/ImageMediaViewerActivity.kt +++ b/vector/src/main/java/im/vector/riotx/features/media/ImageMediaViewerActivity.kt @@ -134,13 +134,13 @@ class ImageMediaViewerActivity : VectorBaseActivity() { private fun onShareActionClicked() { session.fileService().downloadFile( - FileService.DownloadMode.FOR_EXTERNAL_SHARE, - mediaData.eventId, - mediaData.filename, - mediaData.mimeType, - mediaData.url, - mediaData.elementToDecrypt, - object : MatrixCallback { + downloadMode = FileService.DownloadMode.FOR_EXTERNAL_SHARE, + id = mediaData.eventId, + fileName = mediaData.filename, + mimeType = mediaData.mimeType, + url = mediaData.url, + elementToDecrypt = mediaData.elementToDecrypt, + callback = object : MatrixCallback { override fun onSuccess(data: File) { shareMedia(this@ImageMediaViewerActivity, data, getMimeTypeFromUri(this@ImageMediaViewerActivity, data.toUri())) } diff --git a/vector/src/main/java/im/vector/riotx/features/media/VideoContentRenderer.kt b/vector/src/main/java/im/vector/riotx/features/media/VideoContentRenderer.kt index eb9105f792..760d3b12a0 100644 --- a/vector/src/main/java/im/vector/riotx/features/media/VideoContentRenderer.kt +++ b/vector/src/main/java/im/vector/riotx/features/media/VideoContentRenderer.kt @@ -70,7 +70,7 @@ class VideoContentRenderer @Inject constructor(private val activeSessionHolder: downloadMode = FileService.DownloadMode.FOR_INTERNAL_USE, id = data.eventId, fileName = data.filename, - mimeType = null, + mimeType = data.mimeType, url = data.url, elementToDecrypt = data.elementToDecrypt, callback = object : MatrixCallback { diff --git a/vector/src/main/java/im/vector/riotx/features/media/VideoMediaViewerActivity.kt b/vector/src/main/java/im/vector/riotx/features/media/VideoMediaViewerActivity.kt index 6ef8927f00..d9df861a25 100644 --- a/vector/src/main/java/im/vector/riotx/features/media/VideoMediaViewerActivity.kt +++ b/vector/src/main/java/im/vector/riotx/features/media/VideoMediaViewerActivity.kt @@ -79,13 +79,13 @@ class VideoMediaViewerActivity : VectorBaseActivity() { private fun onShareActionClicked() { session.fileService().downloadFile( - FileService.DownloadMode.FOR_EXTERNAL_SHARE, - mediaData.eventId, - mediaData.filename, - mediaData.mimeType, - mediaData.url, - mediaData.elementToDecrypt, - object : MatrixCallback { + downloadMode = FileService.DownloadMode.FOR_EXTERNAL_SHARE, + id = mediaData.eventId, + fileName = mediaData.filename, + mimeType = mediaData.mimeType, + url = mediaData.url, + elementToDecrypt = mediaData.elementToDecrypt, + callback = object : MatrixCallback { override fun onSuccess(data: File) { shareMedia(this@VideoMediaViewerActivity, data, getMimeTypeFromUri(this@VideoMediaViewerActivity, data.toUri())) } diff --git a/vector/src/main/java/im/vector/riotx/features/roomprofile/uploads/RoomUploadsViewModel.kt b/vector/src/main/java/im/vector/riotx/features/roomprofile/uploads/RoomUploadsViewModel.kt index 10f0a5051e..7cc8b9b31d 100644 --- a/vector/src/main/java/im/vector/riotx/features/roomprofile/uploads/RoomUploadsViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/roomprofile/uploads/RoomUploadsViewModel.kt @@ -158,13 +158,13 @@ class RoomUploadsViewModel @AssistedInject constructor( try { val file = awaitCallback { session.fileService().downloadFile( - FileService.DownloadMode.FOR_EXTERNAL_SHARE, - action.uploadEvent.eventId, - action.uploadEvent.contentWithAttachmentContent.body, - action.uploadEvent.contentWithAttachmentContent.getFileUrl(), - action.uploadEvent.contentWithAttachmentContent.mimeType, - action.uploadEvent.contentWithAttachmentContent.encryptedFileInfo?.toElementToDecrypt(), - it) + downloadMode = FileService.DownloadMode.FOR_EXTERNAL_SHARE, + id = action.uploadEvent.eventId, + fileName = action.uploadEvent.contentWithAttachmentContent.body, + mimeType = action.uploadEvent.contentWithAttachmentContent.mimeType, + url = action.uploadEvent.contentWithAttachmentContent.getFileUrl(), + elementToDecrypt = action.uploadEvent.contentWithAttachmentContent.encryptedFileInfo?.toElementToDecrypt(), + callback = it) } _viewEvents.post(RoomUploadsViewEvents.FileReadyForSaving(file, action.uploadEvent.contentWithAttachmentContent.body)) } catch (failure: Throwable) {