Refactor of voice message playing code (#1643)

After PR review suggestions from @jonnyandrew 
User facing functionality doesn't change, but overall architecture and testing is better.
This commit is contained in:
Marco Romano 2023-10-26 12:51:12 +02:00 committed by GitHub
parent cabd7ac388
commit 40e19349b5
10 changed files with 562 additions and 454 deletions

View file

@ -24,6 +24,7 @@ import io.element.android.tests.testutils.simulateLongTask
class FakeMediaLoader : MatrixMediaLoader {
var shouldFail = false
var path: String = ""
override suspend fun loadMediaContent(source: MediaSource): Result<ByteArray> = simulateLongTask {
if (shouldFail) {
@ -45,7 +46,7 @@ class FakeMediaLoader : MatrixMediaLoader {
if (shouldFail) {
Result.failure(RuntimeException())
} else {
Result.success(FakeMediaFile(""))
Result.success(FakeMediaFile(path))
}
}
}