Merge pull request #4869 from element-hq/feature/bma/anotherCleanup
Another cleanup
This commit is contained in:
commit
148b3d9dc7
63 changed files with 44 additions and 186 deletions
|
|
@ -13,7 +13,6 @@ import io.element.android.libraries.core.mimetype.MimeTypes
|
|||
import io.element.android.libraries.matrix.api.media.MatrixMediaLoader
|
||||
import io.element.android.libraries.matrix.api.media.MediaFile
|
||||
import io.element.android.libraries.matrix.api.media.MediaSource
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.matrix.rustcomponents.sdk.Client
|
||||
import org.matrix.rustcomponents.sdk.use
|
||||
|
|
@ -25,14 +24,12 @@ class RustMediaLoader(
|
|||
dispatchers: CoroutineDispatchers,
|
||||
private val innerClient: Client,
|
||||
) : MatrixMediaLoader {
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
private val mediaDispatcher = dispatchers.io.limitedParallelism(32)
|
||||
private val cacheDirectory
|
||||
get() = File(baseCacheDirectory, "temp/media").apply {
|
||||
if (!exists()) mkdirs() // Must always ensure that this directory exists because "Clear cache" does not restart an app's process.
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalUnsignedTypes::class)
|
||||
override suspend fun loadMediaContent(source: MediaSource): Result<ByteArray> =
|
||||
withContext(mediaDispatcher) {
|
||||
runCatchingExceptions {
|
||||
|
|
@ -42,7 +39,6 @@ class RustMediaLoader(
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalUnsignedTypes::class)
|
||||
override suspend fun loadMediaThumbnail(
|
||||
source: MediaSource,
|
||||
width: Long,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue