Merge pull request #4274 from element-hq/feature/bma/mediaTimelineImprovment

Update Matrix Room API and allow media swipe on pinned event only.
This commit is contained in:
Benoit Marty 2025-02-19 09:41:27 +01:00 committed by GitHub
commit 86afffb4bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 296 additions and 185 deletions

View file

@ -84,6 +84,27 @@ class EnsureCalledOnceWithTwoParams<T, U>(
}
}
class EnsureCalledOnceWithTwoParamsAndResult<T, U, R>(
private val expectedParam1: T,
private val expectedParam2: U,
private val result: R,
) : (T, U) -> R {
private var counter = 0
override fun invoke(p1: T, p2: U): R {
if (p1 != expectedParam1 || p2 != expectedParam2) {
throw AssertionError("Expected to be called with $expectedParam1 and $expectedParam2, but was called with $p1 and $p2")
}
counter++
return result
}
fun assertSuccess() {
if (counter != 1) {
throw AssertionError("Expected to be called once, but was called $counter times")
}
}
}
/**
* Shortcut for [<T, R> ensureCalledOnceWithParam] with Unit result.
*/

View file

@ -32,3 +32,9 @@ class EnsureNeverCalledWithTwoParams<T, U> : (T, U) -> Unit {
lambdaError("Should not be called and is called with $p1 and $p2")
}
}
class EnsureNeverCalledWithTwoParamsAndResult<T, U, R> : (T, U) -> R {
override fun invoke(p1: T, p2: U): R {
lambdaError("Should not be called and is called with $p1 and $p2")
}
}