Merge pull request #2874 from element-hq/feature/fga/fix_2692

Fix modal contents overlapping screen lock pin #2692
This commit is contained in:
ganfra 2024-05-21 15:53:51 +02:00 committed by GitHub
commit 509e080fc2
24 changed files with 364 additions and 99 deletions

View file

@ -53,7 +53,6 @@ import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.flowOf
@ -95,7 +94,6 @@ class FakeMatrixClient(
private var createRoomResult: Result<RoomId> = Result.success(A_ROOM_ID)
private var createDmResult: Result<RoomId> = Result.success(A_ROOM_ID)
private var findDmResult: RoomId? = A_ROOM_ID
private var logoutFailure: Throwable? = null
private val getRoomResults = mutableMapOf<RoomId, MatrixRoom>()
private val searchUserResults = mutableMapOf<String, Result<MatrixSearchUserResults>>()
private val getProfileResults = mutableMapOf<UserId, Result<MatrixUser>>()
@ -115,6 +113,9 @@ class FakeMatrixClient(
var getRoomInfoFlowLambda = { _: RoomId ->
flowOf<Optional<MatrixRoomInfo>>(Optional.empty())
}
var logoutLambda: (Boolean) -> String? = {
null
}
override suspend fun getRoom(roomId: RoomId): MatrixRoom? {
return getRoomResults[roomId]
@ -159,12 +160,8 @@ class FakeMatrixClient(
override suspend fun clearCache() {
}
override suspend fun logout(ignoreSdkError: Boolean): String? {
delay(100)
if (ignoreSdkError.not()) {
logoutFailure?.let { throw it }
}
return null
override suspend fun logout(ignoreSdkError: Boolean): String? = simulateLongTask {
return logoutLambda(ignoreSdkError)
}
override fun close() = Unit
@ -228,10 +225,6 @@ class FakeMatrixClient(
// Mocks
fun givenLogoutError(failure: Throwable?) {
logoutFailure = failure
}
fun givenCreateRoomResult(result: Result<RoomId>) {
createRoomResult = result
}

View file

@ -39,13 +39,13 @@ class FakeAuthenticationService : MatrixAuthenticationService {
private var changeServerError: Throwable? = null
private var matrixClient: MatrixClient? = null
var getLatestSessionIdLambda: (() -> SessionId?) = { null }
override fun loggedInStateFlow(): Flow<LoggedInState> {
return flowOf(LoggedInState.NotLoggedIn)
}
override suspend fun getLatestSessionId(): SessionId? {
return null
}
override suspend fun getLatestSessionId(): SessionId? = getLatestSessionIdLambda()
override suspend fun restoreSession(sessionId: SessionId): Result<MatrixClient> {
return if (matrixClient != null) {