This commit is contained in:
Benoit Marty 2021-04-30 17:34:40 +02:00
parent 5213309587
commit d6b6768f41
5 changed files with 1 additions and 45 deletions

View File

@ -22,7 +22,6 @@ import org.matrix.android.sdk.internal.crypto.algorithms.olm.OlmDecryptionResult
import org.matrix.android.sdk.internal.di.MoshiProvider
import io.realm.RealmObject
import io.realm.annotations.Index
import org.matrix.android.sdk.api.failure.MatrixError
internal open class EventEntity(@Index var eventId: String = "",
@Index var roomId: String = "",

View File

@ -63,8 +63,7 @@ internal class FileUploader @Inject constructor(@Authenticated
mimeType: String?,
progressListener: ProgressRequestBody.Listener? = null): ContentUploadResponse {
// Check size limit
// DO NOT COMMIT: 5 Mo
val maxUploadFileSize = 5 * 1024 * 1024L // homeServerCapabilitiesService.getHomeServerCapabilities().maxUploadFileSize
val maxUploadFileSize = homeServerCapabilitiesService.getHomeServerCapabilities().maxUploadFileSize
if (maxUploadFileSize != HomeServerCapabilities.MAX_UPLOAD_FILE_SIZE_UNKNOWN
&& file.length() > maxUploadFileSize) {

View File

@ -101,7 +101,6 @@ import im.vector.app.core.utils.Debouncer
import im.vector.app.core.utils.DimensionConverter
import im.vector.app.core.utils.KeyboardStateUtils
import im.vector.app.core.utils.PERMISSIONS_FOR_WRITING_FILES
import im.vector.app.core.utils.TextUtils
import im.vector.app.core.utils.checkPermissions
import im.vector.app.core.utils.colorizeMatchingText
import im.vector.app.core.utils.copyToClipboard
@ -381,7 +380,6 @@ class RoomDetailFragment @Inject constructor(
is RoomDetailViewEvents.ActionFailure -> displayRoomDetailActionFailure(it)
is RoomDetailViewEvents.ShowMessage -> showSnackWithMessage(it.message)
is RoomDetailViewEvents.NavigateToEvent -> navigateToEvent(it)
is RoomDetailViewEvents.FileTooBigError -> displayFileTooBigError(it)
is RoomDetailViewEvents.DownloadFileState -> handleDownloadFileState(it)
is RoomDetailViewEvents.JoinRoomCommandSuccess -> handleJoinedToAnotherRoom(it)
is RoomDetailViewEvents.SendMessageResult -> renderSendMessageResult(it)
@ -749,18 +747,6 @@ class RoomDetailFragment @Inject constructor(
}
}
private fun displayFileTooBigError(action: RoomDetailViewEvents.FileTooBigError) {
AlertDialog.Builder(requireActivity())
.setTitle(R.string.dialog_title_error)
.setMessage(getString(R.string.error_file_too_big,
action.filename,
TextUtils.formatFileSize(requireContext(), action.fileSizeInBytes),
TextUtils.formatFileSize(requireContext(), action.homeServerLimitInBytes)
))
.setPositiveButton(R.string.ok, null)
.show()
}
private fun handleDownloadFileState(action: RoomDetailViewEvents.DownloadFileState) {
val activity = requireActivity()
if (action.throwable != null) {

View File

@ -54,13 +54,6 @@ sealed class RoomDetailViewEvents : VectorViewEvents {
object ShowWaitingView : RoomDetailViewEvents()
object HideWaitingView : RoomDetailViewEvents()
// TODO Remove
data class FileTooBigError(
val filename: String,
val fileSizeInBytes: Long,
val homeServerLimitInBytes: Long
) : RoomDetailViewEvents()
data class DownloadFileState(
val mimeType: String?,
val file: File?,

View File

@ -1106,27 +1106,6 @@ class RoomDetailViewModel @AssistedInject constructor(
private fun handleSendMedia(action: RoomDetailAction.SendMedia) {
room.sendMedias(action.attachments, action.compressBeforeSending, emptySet())
/*
TODO Cleanup this error is now managed by the SDK
val attachments = action.attachments
val homeServerCapabilities = session.getHomeServerCapabilities()
val maxUploadFileSize = homeServerCapabilities.maxUploadFileSize
if (maxUploadFileSize == HomeServerCapabilities.MAX_UPLOAD_FILE_SIZE_UNKNOWN) {
// Unknown limitation
room.sendMedias(attachments, action.compressBeforeSending, emptySet())
} else {
when (val tooBigFile = attachments.find { it.size > maxUploadFileSize }) {
null -> room.sendMedias(attachments, action.compressBeforeSending, emptySet())
else -> _viewEvents.post(RoomDetailViewEvents.FileTooBigError(
tooBigFile.name ?: tooBigFile.queryUri.toString(),
tooBigFile.size,
maxUploadFileSize
))
}
}
*/
}
private fun handleEventVisible(action: RoomDetailAction.TimelineEventTurnsVisible) {