Fixes #1647 share not working

This commit is contained in:
Valere 2020-07-08 11:00:13 +02:00
parent a2c75e7c71
commit c5ba746904
7 changed files with 37 additions and 37 deletions

View file

@ -10,7 +10,7 @@ Improvements 🙌:
- Handling (almost) properly the groups fetching (#1634) - Handling (almost) properly the groups fetching (#1634)
Bugfix 🐛: Bugfix 🐛:
- - Regression | Share action menu do not work (#1647)
Translations 🗣: Translations 🗣:
- -

View file

@ -1337,13 +1337,13 @@ class RoomDetailFragment @Inject constructor(
private fun onShareActionClicked(action: EventSharedAction.Share) { private fun onShareActionClicked(action: EventSharedAction.Share) {
session.fileService().downloadFile( session.fileService().downloadFile(
FileService.DownloadMode.FOR_EXTERNAL_SHARE, downloadMode = FileService.DownloadMode.FOR_EXTERNAL_SHARE,
action.eventId, id = action.eventId,
action.messageContent.body, fileName = action.messageContent.body,
action.messageContent.getFileUrl(), mimeType = action.messageContent.mimeType,
action.messageContent.mimeType, url = action.messageContent.getFileUrl(),
action.messageContent.encryptedFileInfo?.toElementToDecrypt(), elementToDecrypt = action.messageContent.encryptedFileInfo?.toElementToDecrypt(),
object : MatrixCallback<File> { callback = object : MatrixCallback<File> {
override fun onSuccess(data: File) { override fun onSuccess(data: File) {
if (isAdded) { if (isAdded) {
shareMedia(requireContext(), data, getMimeTypeFromUri(requireContext(), data.toUri())) shareMedia(requireContext(), data, getMimeTypeFromUri(requireContext(), data.toUri()))

View file

@ -873,13 +873,13 @@ class RoomDetailViewModel @AssistedInject constructor(
} }
} else { } else {
session.fileService().downloadFile( session.fileService().downloadFile(
FileService.DownloadMode.FOR_INTERNAL_USE, downloadMode = FileService.DownloadMode.FOR_INTERNAL_USE,
action.eventId, id = action.eventId,
action.messageFileContent.getFileName(), fileName = action.messageFileContent.getFileName(),
action.messageFileContent.mimeType, mimeType = action.messageFileContent.mimeType,
mxcUrl, url = mxcUrl,
action.messageFileContent.encryptedFileInfo?.toElementToDecrypt(), elementToDecrypt = action.messageFileContent.encryptedFileInfo?.toElementToDecrypt(),
object : MatrixCallback<File> { callback = object : MatrixCallback<File> {
override fun onSuccess(data: File) { override fun onSuccess(data: File) {
_viewEvents.post(RoomDetailViewEvents.DownloadFileState( _viewEvents.post(RoomDetailViewEvents.DownloadFileState(
action.messageFileContent.mimeType, action.messageFileContent.mimeType,

View file

@ -134,13 +134,13 @@ class ImageMediaViewerActivity : VectorBaseActivity() {
private fun onShareActionClicked() { private fun onShareActionClicked() {
session.fileService().downloadFile( session.fileService().downloadFile(
FileService.DownloadMode.FOR_EXTERNAL_SHARE, downloadMode = FileService.DownloadMode.FOR_EXTERNAL_SHARE,
mediaData.eventId, id = mediaData.eventId,
mediaData.filename, fileName = mediaData.filename,
mediaData.mimeType, mimeType = mediaData.mimeType,
mediaData.url, url = mediaData.url,
mediaData.elementToDecrypt, elementToDecrypt = mediaData.elementToDecrypt,
object : MatrixCallback<File> { callback = object : MatrixCallback<File> {
override fun onSuccess(data: File) { override fun onSuccess(data: File) {
shareMedia(this@ImageMediaViewerActivity, data, getMimeTypeFromUri(this@ImageMediaViewerActivity, data.toUri())) shareMedia(this@ImageMediaViewerActivity, data, getMimeTypeFromUri(this@ImageMediaViewerActivity, data.toUri()))
} }

View file

@ -70,7 +70,7 @@ class VideoContentRenderer @Inject constructor(private val activeSessionHolder:
downloadMode = FileService.DownloadMode.FOR_INTERNAL_USE, downloadMode = FileService.DownloadMode.FOR_INTERNAL_USE,
id = data.eventId, id = data.eventId,
fileName = data.filename, fileName = data.filename,
mimeType = null, mimeType = data.mimeType,
url = data.url, url = data.url,
elementToDecrypt = data.elementToDecrypt, elementToDecrypt = data.elementToDecrypt,
callback = object : MatrixCallback<File> { callback = object : MatrixCallback<File> {

View file

@ -79,13 +79,13 @@ class VideoMediaViewerActivity : VectorBaseActivity() {
private fun onShareActionClicked() { private fun onShareActionClicked() {
session.fileService().downloadFile( session.fileService().downloadFile(
FileService.DownloadMode.FOR_EXTERNAL_SHARE, downloadMode = FileService.DownloadMode.FOR_EXTERNAL_SHARE,
mediaData.eventId, id = mediaData.eventId,
mediaData.filename, fileName = mediaData.filename,
mediaData.mimeType, mimeType = mediaData.mimeType,
mediaData.url, url = mediaData.url,
mediaData.elementToDecrypt, elementToDecrypt = mediaData.elementToDecrypt,
object : MatrixCallback<File> { callback = object : MatrixCallback<File> {
override fun onSuccess(data: File) { override fun onSuccess(data: File) {
shareMedia(this@VideoMediaViewerActivity, data, getMimeTypeFromUri(this@VideoMediaViewerActivity, data.toUri())) shareMedia(this@VideoMediaViewerActivity, data, getMimeTypeFromUri(this@VideoMediaViewerActivity, data.toUri()))
} }

View file

@ -158,13 +158,13 @@ class RoomUploadsViewModel @AssistedInject constructor(
try { try {
val file = awaitCallback<File> { val file = awaitCallback<File> {
session.fileService().downloadFile( session.fileService().downloadFile(
FileService.DownloadMode.FOR_EXTERNAL_SHARE, downloadMode = FileService.DownloadMode.FOR_EXTERNAL_SHARE,
action.uploadEvent.eventId, id = action.uploadEvent.eventId,
action.uploadEvent.contentWithAttachmentContent.body, fileName = action.uploadEvent.contentWithAttachmentContent.body,
action.uploadEvent.contentWithAttachmentContent.getFileUrl(), mimeType = action.uploadEvent.contentWithAttachmentContent.mimeType,
action.uploadEvent.contentWithAttachmentContent.mimeType, url = action.uploadEvent.contentWithAttachmentContent.getFileUrl(),
action.uploadEvent.contentWithAttachmentContent.encryptedFileInfo?.toElementToDecrypt(), elementToDecrypt = action.uploadEvent.contentWithAttachmentContent.encryptedFileInfo?.toElementToDecrypt(),
it) callback = it)
} }
_viewEvents.post(RoomUploadsViewEvents.FileReadyForSaving(file, action.uploadEvent.contentWithAttachmentContent.body)) _viewEvents.post(RoomUploadsViewEvents.FileReadyForSaving(file, action.uploadEvent.contentWithAttachmentContent.body))
} catch (failure: Throwable) { } catch (failure: Throwable) {