Media: improve media viewer

This commit is contained in:
ganfra 2023-05-12 18:48:24 +02:00
parent 51a7a761b9
commit 80adbd4bd1
20 changed files with 244 additions and 59 deletions

View file

@ -16,8 +16,6 @@
package io.element.android.libraries.matrix.api.media
import android.net.Uri
interface MatrixMediaLoader {
/**
* @param url to fetch the content for.
@ -36,7 +34,7 @@ interface MatrixMediaLoader {
/**
* @param url to fetch the data for.
* @param mimeType: optional mime type
* @return a [Result] of [Uri]. It's the uri of the downloaded file.
* @return a [Result] of [MediaFile]
*/
suspend fun loadMediaFile(source: MatrixMediaSource, mimeType: String?): Result<Uri>
suspend fun loadMediaFile(source: MatrixMediaSource, mimeType: String?): Result<MediaFile>
}

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2023 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.element.android.libraries.matrix.api.media
import java.io.Closeable
/**
* A wrapper around a media file on the disk.
* When closed the file will be removed from the disk.
*/
interface MediaFile : Closeable {
fun path(): String
}