Remove useless parameter `id`
This commit is contained in:
parent
75071cf1d9
commit
5e2f091ec1
|
@ -41,20 +41,15 @@ interface FileService {
|
||||||
* Download a file.
|
* Download a file.
|
||||||
* Result will be a decrypted file, stored in the cache folder. url parameter will be used to create unique filename to avoid name collision.
|
* Result will be a decrypted file, stored in the cache folder. url parameter will be used to create unique filename to avoid name collision.
|
||||||
*/
|
*/
|
||||||
fun downloadFile(
|
fun downloadFile(fileName: String,
|
||||||
id: String,
|
mimeType: String?,
|
||||||
fileName: String,
|
url: String?,
|
||||||
mimeType: String?,
|
elementToDecrypt: ElementToDecrypt?,
|
||||||
url: String?,
|
callback: MatrixCallback<File>): Cancelable
|
||||||
elementToDecrypt: ElementToDecrypt?,
|
|
||||||
callback: MatrixCallback<File>): Cancelable
|
|
||||||
|
|
||||||
fun downloadFile(
|
fun downloadFile(messageContent: MessageWithAttachmentContent,
|
||||||
id: String,
|
callback: MatrixCallback<File>): Cancelable =
|
||||||
messageContent: MessageWithAttachmentContent,
|
|
||||||
callback: MatrixCallback<File>): Cancelable =
|
|
||||||
downloadFile(
|
downloadFile(
|
||||||
id = id,
|
|
||||||
fileName = messageContent.getFileName(),
|
fileName = messageContent.getFileName(),
|
||||||
mimeType = messageContent.mimeType,
|
mimeType = messageContent.mimeType,
|
||||||
url = messageContent.getFileUrl(),
|
url = messageContent.getFileUrl(),
|
||||||
|
|
|
@ -79,8 +79,7 @@ internal class DefaultFileService @Inject constructor(
|
||||||
* Download file in the cache folder, and eventually decrypt it
|
* Download file in the cache folder, and eventually decrypt it
|
||||||
* TODO looks like files are copied 3 times
|
* TODO looks like files are copied 3 times
|
||||||
*/
|
*/
|
||||||
override fun downloadFile(id: String,
|
override fun downloadFile(fileName: String,
|
||||||
fileName: String,
|
|
||||||
mimeType: String?,
|
mimeType: String?,
|
||||||
url: String?,
|
url: String?,
|
||||||
elementToDecrypt: ElementToDecrypt?,
|
elementToDecrypt: ElementToDecrypt?,
|
||||||
|
|
|
@ -109,10 +109,9 @@ class VectorGlideDataFetcher(private val activeSessionHolder: ActiveSessionHolde
|
||||||
}
|
}
|
||||||
// Use the file vector service, will avoid flickering and redownload after upload
|
// Use the file vector service, will avoid flickering and redownload after upload
|
||||||
fileService.downloadFile(
|
fileService.downloadFile(
|
||||||
mimeType = data.mimeType,
|
|
||||||
id = data.eventId,
|
|
||||||
url = data.url,
|
|
||||||
fileName = data.filename,
|
fileName = data.filename,
|
||||||
|
mimeType = data.mimeType,
|
||||||
|
url = data.url,
|
||||||
elementToDecrypt = data.elementToDecrypt,
|
elementToDecrypt = data.elementToDecrypt,
|
||||||
callback = object : MatrixCallback<File> {
|
callback = object : MatrixCallback<File> {
|
||||||
override fun onSuccess(data: File) {
|
override fun onSuccess(data: File) {
|
||||||
|
|
|
@ -1654,7 +1654,6 @@ class RoomDetailFragment @Inject constructor(
|
||||||
shareText(requireContext(), action.messageContent.body)
|
shareText(requireContext(), action.messageContent.body)
|
||||||
} else if (action.messageContent is MessageWithAttachmentContent) {
|
} else if (action.messageContent is MessageWithAttachmentContent) {
|
||||||
session.fileService().downloadFile(
|
session.fileService().downloadFile(
|
||||||
id = action.eventId,
|
|
||||||
messageContent = action.messageContent,
|
messageContent = action.messageContent,
|
||||||
callback = object : MatrixCallback<File> {
|
callback = object : MatrixCallback<File> {
|
||||||
override fun onSuccess(data: File) {
|
override fun onSuccess(data: File) {
|
||||||
|
@ -1685,7 +1684,6 @@ class RoomDetailFragment @Inject constructor(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
session.fileService().downloadFile(
|
session.fileService().downloadFile(
|
||||||
id = action.eventId,
|
|
||||||
messageContent = action.messageContent,
|
messageContent = action.messageContent,
|
||||||
callback = object : MatrixCallback<File> {
|
callback = object : MatrixCallback<File> {
|
||||||
override fun onSuccess(data: File) {
|
override fun onSuccess(data: File) {
|
||||||
|
|
|
@ -1030,7 +1030,6 @@ class RoomDetailViewModel @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
session.fileService().downloadFile(
|
session.fileService().downloadFile(
|
||||||
id = action.eventId,
|
|
||||||
messageContent = action.messageFileContent,
|
messageContent = action.messageFileContent,
|
||||||
callback = object : MatrixCallback<File> {
|
callback = object : MatrixCallback<File> {
|
||||||
override fun onSuccess(data: File) {
|
override fun onSuccess(data: File) {
|
||||||
|
|
|
@ -153,11 +153,10 @@ abstract class BaseAttachmentProvider<Type>(
|
||||||
} else {
|
} else {
|
||||||
target.onVideoFileLoading(info.uid)
|
target.onVideoFileLoading(info.uid)
|
||||||
fileService.downloadFile(
|
fileService.downloadFile(
|
||||||
id = data.eventId,
|
|
||||||
mimeType = data.mimeType,
|
|
||||||
elementToDecrypt = data.elementToDecrypt,
|
|
||||||
fileName = data.filename,
|
fileName = data.filename,
|
||||||
|
mimeType = data.mimeType,
|
||||||
url = data.url,
|
url = data.url,
|
||||||
|
elementToDecrypt = data.elementToDecrypt,
|
||||||
callback = object : MatrixCallback<File> {
|
callback = object : MatrixCallback<File> {
|
||||||
override fun onSuccess(data: File) {
|
override fun onSuccess(data: File) {
|
||||||
target.onVideoFileReady(info.uid, data)
|
target.onVideoFileReady(info.uid, data)
|
||||||
|
|
|
@ -77,10 +77,9 @@ class DataAttachmentRoomProvider(
|
||||||
override fun getFileForSharing(position: Int, callback: (File?) -> Unit) {
|
override fun getFileForSharing(position: Int, callback: (File?) -> Unit) {
|
||||||
val item = getItem(position)
|
val item = getItem(position)
|
||||||
fileService.downloadFile(
|
fileService.downloadFile(
|
||||||
id = item.eventId,
|
|
||||||
fileName = item.filename,
|
fileName = item.filename,
|
||||||
mimeType = item.mimeType,
|
mimeType = item.mimeType,
|
||||||
url = item.url ?: "",
|
url = item.url,
|
||||||
elementToDecrypt = item.elementToDecrypt,
|
elementToDecrypt = item.elementToDecrypt,
|
||||||
callback = object : MatrixCallback<File> {
|
callback = object : MatrixCallback<File> {
|
||||||
override fun onSuccess(data: File) {
|
override fun onSuccess(data: File) {
|
||||||
|
|
|
@ -125,7 +125,6 @@ class RoomEventsAttachmentProvider(
|
||||||
as? MessageWithAttachmentContent
|
as? MessageWithAttachmentContent
|
||||||
?: return@let
|
?: return@let
|
||||||
fileService.downloadFile(
|
fileService.downloadFile(
|
||||||
id = timelineEvent.eventId,
|
|
||||||
fileName = messageContent.body,
|
fileName = messageContent.body,
|
||||||
mimeType = messageContent.mimeType,
|
mimeType = messageContent.mimeType,
|
||||||
url = messageContent.getFileUrl(),
|
url = messageContent.getFileUrl(),
|
||||||
|
|
|
@ -75,7 +75,6 @@ class VideoContentRenderer @Inject constructor(private val activeSessionHolder:
|
||||||
|
|
||||||
activeSessionHolder.getActiveSession().fileService()
|
activeSessionHolder.getActiveSession().fileService()
|
||||||
.downloadFile(
|
.downloadFile(
|
||||||
id = data.eventId,
|
|
||||||
fileName = data.filename,
|
fileName = data.filename,
|
||||||
mimeType = data.mimeType,
|
mimeType = data.mimeType,
|
||||||
url = data.url,
|
url = data.url,
|
||||||
|
@ -114,7 +113,6 @@ class VideoContentRenderer @Inject constructor(private val activeSessionHolder:
|
||||||
|
|
||||||
activeSessionHolder.getActiveSession().fileService()
|
activeSessionHolder.getActiveSession().fileService()
|
||||||
.downloadFile(
|
.downloadFile(
|
||||||
id = data.eventId,
|
|
||||||
fileName = data.filename,
|
fileName = data.filename,
|
||||||
mimeType = data.mimeType,
|
mimeType = data.mimeType,
|
||||||
url = data.url,
|
url = data.url,
|
||||||
|
|
|
@ -131,7 +131,6 @@ class RoomUploadsViewModel @AssistedInject constructor(
|
||||||
try {
|
try {
|
||||||
val file = awaitCallback<File> {
|
val file = awaitCallback<File> {
|
||||||
session.fileService().downloadFile(
|
session.fileService().downloadFile(
|
||||||
id = action.uploadEvent.eventId,
|
|
||||||
messageContent = action.uploadEvent.contentWithAttachmentContent,
|
messageContent = action.uploadEvent.contentWithAttachmentContent,
|
||||||
callback = it
|
callback = it
|
||||||
)
|
)
|
||||||
|
@ -148,7 +147,6 @@ class RoomUploadsViewModel @AssistedInject constructor(
|
||||||
try {
|
try {
|
||||||
val file = awaitCallback<File> {
|
val file = awaitCallback<File> {
|
||||||
session.fileService().downloadFile(
|
session.fileService().downloadFile(
|
||||||
id = action.uploadEvent.eventId,
|
|
||||||
messageContent = action.uploadEvent.contentWithAttachmentContent,
|
messageContent = action.uploadEvent.contentWithAttachmentContent,
|
||||||
callback = it)
|
callback = it)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue