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)
Bugfix 🐛:
-
- Regression | Share action menu do not work (#1647)
Translations 🗣:
-

View file

@ -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<File> {
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<File> {
override fun onSuccess(data: File) {
if (isAdded) {
shareMedia(requireContext(), data, getMimeTypeFromUri(requireContext(), data.toUri()))

View file

@ -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<File> {
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<File> {
override fun onSuccess(data: File) {
_viewEvents.post(RoomDetailViewEvents.DownloadFileState(
action.messageFileContent.mimeType,

View file

@ -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<File> {
downloadMode = FileService.DownloadMode.FOR_EXTERNAL_SHARE,
id = mediaData.eventId,
fileName = mediaData.filename,
mimeType = mediaData.mimeType,
url = mediaData.url,
elementToDecrypt = mediaData.elementToDecrypt,
callback = object : MatrixCallback<File> {
override fun onSuccess(data: File) {
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,
id = data.eventId,
fileName = data.filename,
mimeType = null,
mimeType = data.mimeType,
url = data.url,
elementToDecrypt = data.elementToDecrypt,
callback = object : MatrixCallback<File> {

View file

@ -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<File> {
downloadMode = FileService.DownloadMode.FOR_EXTERNAL_SHARE,
id = mediaData.eventId,
fileName = mediaData.filename,
mimeType = mediaData.mimeType,
url = mediaData.url,
elementToDecrypt = mediaData.elementToDecrypt,
callback = object : MatrixCallback<File> {
override fun onSuccess(data: File) {
shareMedia(this@VideoMediaViewerActivity, data, getMimeTypeFromUri(this@VideoMediaViewerActivity, data.toUri()))
}

View file

@ -158,13 +158,13 @@ class RoomUploadsViewModel @AssistedInject constructor(
try {
val file = awaitCallback<File> {
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) {