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 71ef76ad86
commit 7d1b671426
10 changed files with 562 additions and 454 deletions
@@ -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))
}
}
}