Update dependency org.matrix.rustcomponents:sdk-android to v26.04.27 (#6666)
* Update dependency org.matrix.rustcomponents:sdk-android to v26.04.27 * Fix breaking API changes: - OIDC components are now prefixed `OAuth`. - `Room.startLiveLocationShare` now returns the event id of the beacon state event if it succeeds. - `RoomInfo` now contains an `activeServiceMembersCount` property. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jorge Martín <jorgem@element.io>
This commit is contained in:
parent
46b7255e04
commit
247147209b
21 changed files with 50 additions and 42 deletions
|
|
@ -178,7 +178,7 @@ test_detekt_test = { module = "io.gitlab.arturbosch.detekt:detekt-test", version
|
||||||
# https://github.com/matrix-org/matrix-rust-components-kotlin/commits/main/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt
|
# https://github.com/matrix-org/matrix-rust-components-kotlin/commits/main/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt
|
||||||
# All new features should not be implemented in the pull request that upgrades the version, developers should
|
# All new features should not be implemented in the pull request that upgrades the version, developers should
|
||||||
# only fix API breaks and may add some TODOs.
|
# only fix API breaks and may add some TODOs.
|
||||||
matrix_sdk = "org.matrix.rustcomponents:sdk-android:26.04.21"
|
matrix_sdk = "org.matrix.rustcomponents:sdk-android:26.04.27"
|
||||||
|
|
||||||
# Others
|
# Others
|
||||||
coil = { module = "io.coil-kt.coil3:coil", version.ref = "coil" }
|
coil = { module = "io.coil-kt.coil3:coil", version.ref = "coil" }
|
||||||
|
|
|
||||||
|
|
@ -196,9 +196,9 @@ interface JoinedRoom : BaseRoom {
|
||||||
/**
|
/**
|
||||||
* Start sharing live location in this room.
|
* Start sharing live location in this room.
|
||||||
* @param durationMillis How long to share location (in milliseconds).
|
* @param durationMillis How long to share location (in milliseconds).
|
||||||
* @return Result indicating success or failure.
|
* @return Result containing the [EventId] of the beacon state event on success or an error on failure.
|
||||||
*/
|
*/
|
||||||
suspend fun startLiveLocationShare(durationMillis: Long): Result<Unit>
|
suspend fun startLiveLocationShare(durationMillis: Long): Result<EventId>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop sharing live location in this room.
|
* Stop sharing live location in this room.
|
||||||
|
|
|
||||||
|
|
@ -214,5 +214,5 @@ fun SessionData.toSession() = Session(
|
||||||
deviceId = deviceId,
|
deviceId = deviceId,
|
||||||
homeserverUrl = homeserverUrl,
|
homeserverUrl = homeserverUrl,
|
||||||
slidingSyncVersion = SlidingSyncVersion.NATIVE,
|
slidingSyncVersion = SlidingSyncVersion.NATIVE,
|
||||||
oidcData = oidcData,
|
oauthData = oidcData,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ package io.element.android.libraries.matrix.impl.auth
|
||||||
|
|
||||||
import io.element.android.libraries.matrix.api.auth.AuthenticationException
|
import io.element.android.libraries.matrix.api.auth.AuthenticationException
|
||||||
import org.matrix.rustcomponents.sdk.ClientBuildException
|
import org.matrix.rustcomponents.sdk.ClientBuildException
|
||||||
import org.matrix.rustcomponents.sdk.OidcException
|
import org.matrix.rustcomponents.sdk.OAuthException
|
||||||
|
|
||||||
fun Throwable.mapAuthenticationException(): AuthenticationException {
|
fun Throwable.mapAuthenticationException(): AuthenticationException {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
|
|
@ -29,12 +29,12 @@ fun Throwable.mapAuthenticationException(): AuthenticationException {
|
||||||
is ClientBuildException.WellKnownLookupFailed -> AuthenticationException.Generic(message)
|
is ClientBuildException.WellKnownLookupFailed -> AuthenticationException.Generic(message)
|
||||||
is ClientBuildException.EventCache -> AuthenticationException.Generic(message)
|
is ClientBuildException.EventCache -> AuthenticationException.Generic(message)
|
||||||
}
|
}
|
||||||
is OidcException -> when (this) {
|
is OAuthException -> when (this) {
|
||||||
is OidcException.Generic -> AuthenticationException.Oidc(message)
|
is OAuthException.Generic -> AuthenticationException.Oidc(message)
|
||||||
is OidcException.CallbackUrlInvalid -> AuthenticationException.Oidc(message)
|
is OAuthException.CallbackUrlInvalid -> AuthenticationException.Oidc(message)
|
||||||
is OidcException.Cancelled -> AuthenticationException.Oidc(message)
|
is OAuthException.Cancelled -> AuthenticationException.Oidc(message)
|
||||||
is OidcException.MetadataInvalid -> AuthenticationException.Oidc(message)
|
is OAuthException.MetadataInvalid -> AuthenticationException.Oidc(message)
|
||||||
is OidcException.NotSupported -> AuthenticationException.Oidc(message)
|
is OAuthException.NotSupported -> AuthenticationException.Oidc(message)
|
||||||
}
|
}
|
||||||
else -> AuthenticationException.Generic(message)
|
else -> AuthenticationException.Generic(message)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@ fun HomeserverLoginDetails.map(): MatrixHomeServerDetails = use {
|
||||||
MatrixHomeServerDetails(
|
MatrixHomeServerDetails(
|
||||||
url = url(),
|
url = url(),
|
||||||
supportsPasswordLogin = supportsPasswordLogin(),
|
supportsPasswordLogin = supportsPasswordLogin(),
|
||||||
supportsOidcLogin = supportsOidcLogin(),
|
supportsOidcLogin = supportsOauthLogin(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,14 @@ import dev.zacsweers.metro.Inject
|
||||||
import io.element.android.libraries.core.meta.BuildMeta
|
import io.element.android.libraries.core.meta.BuildMeta
|
||||||
import io.element.android.libraries.matrix.api.auth.OidcConfig
|
import io.element.android.libraries.matrix.api.auth.OidcConfig
|
||||||
import io.element.android.libraries.matrix.api.auth.OidcRedirectUrlProvider
|
import io.element.android.libraries.matrix.api.auth.OidcRedirectUrlProvider
|
||||||
import org.matrix.rustcomponents.sdk.OidcConfiguration
|
import org.matrix.rustcomponents.sdk.OAuthConfiguration
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
class OidcConfigurationProvider(
|
class OidcConfigurationProvider(
|
||||||
private val buildMeta: BuildMeta,
|
private val buildMeta: BuildMeta,
|
||||||
private val oidcRedirectUrlProvider: OidcRedirectUrlProvider,
|
private val oidcRedirectUrlProvider: OidcRedirectUrlProvider,
|
||||||
) {
|
) {
|
||||||
fun get(): OidcConfiguration = OidcConfiguration(
|
fun get(): OAuthConfiguration = OAuthConfiguration(
|
||||||
clientName = buildMeta.applicationName,
|
clientName = buildMeta.applicationName,
|
||||||
redirectUri = oidcRedirectUrlProvider.provide(),
|
redirectUri = oidcRedirectUrlProvider.provide(),
|
||||||
clientUri = OidcConfig.CLIENT_URI,
|
clientUri = OidcConfig.CLIENT_URI,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
package io.element.android.libraries.matrix.impl.auth
|
package io.element.android.libraries.matrix.impl.auth
|
||||||
|
|
||||||
import io.element.android.libraries.matrix.api.auth.OidcPrompt
|
import io.element.android.libraries.matrix.api.auth.OidcPrompt
|
||||||
import org.matrix.rustcomponents.sdk.OidcPrompt as RustOidcPrompt
|
import org.matrix.rustcomponents.sdk.OAuthPrompt as RustOidcPrompt
|
||||||
|
|
||||||
internal fun OidcPrompt.toRustPrompt(): RustOidcPrompt {
|
internal fun OidcPrompt.toRustPrompt(): RustOidcPrompt {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ class RustHomeServerLoginCompatibilityChecker(
|
||||||
it.homeserverLoginDetails()
|
it.homeserverLoginDetails()
|
||||||
}
|
}
|
||||||
.use {
|
.use {
|
||||||
Timber.d("Homeserver $url | OIDC: ${it.supportsOidcLogin()} | Password: ${it.supportsPasswordLogin()} | SSO: ${it.supportsSsoLogin()}")
|
Timber.d("Homeserver $url | OIDC: ${it.supportsOauthLogin()} | Password: ${it.supportsPasswordLogin()} | SSO: ${it.supportsSsoLogin()}")
|
||||||
it.supportsOidcLogin() || it.supportsPasswordLogin()
|
it.supportsOauthLogin() || it.supportsPasswordLogin()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -260,8 +260,8 @@ class RustMatrixAuthenticationService(
|
||||||
return withContext(coroutineDispatchers.io) {
|
return withContext(coroutineDispatchers.io) {
|
||||||
runCatchingExceptions {
|
runCatchingExceptions {
|
||||||
val client = currentClient ?: error("You need to call `setHomeserver()` first")
|
val client = currentClient ?: error("You need to call `setHomeserver()` first")
|
||||||
val oAuthAuthorizationData = client.urlForOidc(
|
val oAuthAuthorizationData = client.urlForOauth(
|
||||||
oidcConfiguration = oidcConfigurationProvider.get(),
|
oauthConfiguration = oidcConfigurationProvider.get(),
|
||||||
prompt = prompt.toRustPrompt(),
|
prompt = prompt.toRustPrompt(),
|
||||||
loginHint = loginHint,
|
loginHint = loginHint,
|
||||||
// If we want to restore a previous session for which we have encryption keys, we can pass the deviceId here. At the moment, we don't
|
// If we want to restore a previous session for which we have encryption keys, we can pass the deviceId here. At the moment, we don't
|
||||||
|
|
@ -282,7 +282,7 @@ class RustMatrixAuthenticationService(
|
||||||
return withContext(coroutineDispatchers.io) {
|
return withContext(coroutineDispatchers.io) {
|
||||||
runCatchingExceptions {
|
runCatchingExceptions {
|
||||||
pendingOAuthAuthorizationData?.use {
|
pendingOAuthAuthorizationData?.use {
|
||||||
currentClient?.abortOidcAuth(it)
|
currentClient?.abortOauthAuth(it)
|
||||||
}
|
}
|
||||||
pendingOAuthAuthorizationData = null
|
pendingOAuthAuthorizationData = null
|
||||||
}.mapFailure { failure ->
|
}.mapFailure { failure ->
|
||||||
|
|
@ -304,7 +304,7 @@ class RustMatrixAuthenticationService(
|
||||||
runCatchingExceptions {
|
runCatchingExceptions {
|
||||||
val client = currentClient ?: error("You need to call `setHomeserver()` first")
|
val client = currentClient ?: error("You need to call `setHomeserver()` first")
|
||||||
val currentSessionPaths = sessionPaths ?: error("You need to call `setHomeserver()` first")
|
val currentSessionPaths = sessionPaths ?: error("You need to call `setHomeserver()` first")
|
||||||
client.loginWithOidcCallback(
|
client.loginWithOauthCallback(
|
||||||
callbackUrl = callbackUrl,
|
callbackUrl = callbackUrl,
|
||||||
)
|
)
|
||||||
// Free the pending data since we won't use it to abort the flow anymore
|
// Free the pending data since we won't use it to abort the flow anymore
|
||||||
|
|
@ -368,7 +368,7 @@ class RustMatrixAuthenticationService(
|
||||||
qrCodeData = sdkQrCodeLoginData,
|
qrCodeData = sdkQrCodeLoginData,
|
||||||
)
|
)
|
||||||
client.newLoginWithQrCodeHandler(
|
client.newLoginWithQrCodeHandler(
|
||||||
oidcConfiguration = oidcConfiguration,
|
oauthConfiguration = oidcConfiguration,
|
||||||
).use {
|
).use {
|
||||||
it.scan(
|
it.scan(
|
||||||
qrCodeData = qrCodeData.rustQrCodeData,
|
qrCodeData = qrCodeData.rustQrCodeData,
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ object QrErrorMapper {
|
||||||
is RustHumanQrLoginException.OtherDeviceNotSignedIn -> QrLoginException.OtherDeviceNotSignedIn
|
is RustHumanQrLoginException.OtherDeviceNotSignedIn -> QrLoginException.OtherDeviceNotSignedIn
|
||||||
is RustHumanQrLoginException.LinkingNotSupported -> QrLoginException.LinkingNotSupported
|
is RustHumanQrLoginException.LinkingNotSupported -> QrLoginException.LinkingNotSupported
|
||||||
is RustHumanQrLoginException.Unknown -> QrLoginException.Unknown
|
is RustHumanQrLoginException.Unknown -> QrLoginException.Unknown
|
||||||
is RustHumanQrLoginException.OidcMetadataInvalid -> QrLoginException.OidcMetadataInvalid
|
is RustHumanQrLoginException.OAuthMetadataInvalid -> QrLoginException.OidcMetadataInvalid
|
||||||
is RustHumanQrLoginException.SlidingSyncNotAvailable -> QrLoginException.SlidingSyncNotAvailable
|
is RustHumanQrLoginException.SlidingSyncNotAvailable -> QrLoginException.SlidingSyncNotAvailable
|
||||||
is RustHumanQrLoginException.CheckCodeAlreadySent -> QrLoginException.CheckCodeAlreadySent
|
is RustHumanQrLoginException.CheckCodeAlreadySent -> QrLoginException.CheckCodeAlreadySent
|
||||||
is RustHumanQrLoginException.CheckCodeCannotBeSent -> QrLoginException.CheckCodeCannotBeSent
|
is RustHumanQrLoginException.CheckCodeCannotBeSent -> QrLoginException.CheckCodeCannotBeSent
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ object RustIdentityResetHandleFactory {
|
||||||
return runCatchingExceptions {
|
return runCatchingExceptions {
|
||||||
identityResetHandle?.let {
|
identityResetHandle?.let {
|
||||||
when (val authType = identityResetHandle.authType()) {
|
when (val authType = identityResetHandle.authType()) {
|
||||||
is CrossSigningResetAuthType.Oidc -> RustOidcIdentityResetHandle(identityResetHandle, authType.info.approvalUrl)
|
is CrossSigningResetAuthType.OAuth -> RustOidcIdentityResetHandle(identityResetHandle, authType.info.approvalUrl)
|
||||||
// User interactive authentication (user + password)
|
// User interactive authentication (user + password)
|
||||||
CrossSigningResetAuthType.Uiaa -> RustPasswordIdentityResetHandle(userId, identityResetHandle)
|
CrossSigningResetAuthType.Uiaa -> RustPasswordIdentityResetHandle(userId, identityResetHandle)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ internal fun Session.toSessionData(
|
||||||
accessToken = accessToken,
|
accessToken = accessToken,
|
||||||
refreshToken = refreshToken,
|
refreshToken = refreshToken,
|
||||||
homeserverUrl = homeserverUrl ?: this.homeserverUrl,
|
homeserverUrl = homeserverUrl ?: this.homeserverUrl,
|
||||||
oidcData = oidcData,
|
oidcData = oauthData,
|
||||||
loginTimestamp = Date(),
|
loginTimestamp = Date(),
|
||||||
isTokenValid = isTokenValid,
|
isTokenValid = isTokenValid,
|
||||||
loginType = loginType,
|
loginType = loginType,
|
||||||
|
|
|
||||||
|
|
@ -516,10 +516,10 @@ class JoinedRustRoom(
|
||||||
return innerRoom.liveLocationSharesFlow().timedByExpiry(systemClock::epochMillis)
|
return innerRoom.liveLocationSharesFlow().timedByExpiry(systemClock::epochMillis)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun startLiveLocationShare(durationMillis: Long): Result<Unit> = withContext(roomDispatcher) {
|
override suspend fun startLiveLocationShare(durationMillis: Long): Result<EventId> = withContext(roomDispatcher) {
|
||||||
runCatchingExceptions {
|
runCatchingExceptions {
|
||||||
innerRoom.startLiveLocationShare(durationMillis.toULong())
|
innerRoom.startLiveLocationShare(durationMillis.toULong())
|
||||||
}
|
}.map(::EventId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun stopLiveLocationShare(): Result<Unit> = withContext(roomDispatcher) {
|
override suspend fun stopLiveLocationShare(): Result<Unit> = withContext(roomDispatcher) {
|
||||||
|
|
@ -538,7 +538,7 @@ class JoinedRustRoom(
|
||||||
|
|
||||||
override fun destroy() {
|
override fun destroy() {
|
||||||
baseRoom.destroy()
|
baseRoom.destroy()
|
||||||
liveInnerTimeline.destroy()
|
liveTimeline.close()
|
||||||
threadsListService.destroy()
|
threadsListService.destroy()
|
||||||
Timber.d("Room $roomId destroyed")
|
Timber.d("Room $roomId destroyed")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ import kotlinx.coroutines.channels.awaitClose
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.buffer
|
import kotlinx.coroutines.flow.buffer
|
||||||
import kotlinx.coroutines.flow.callbackFlow
|
import kotlinx.coroutines.flow.callbackFlow
|
||||||
import org.matrix.rustcomponents.sdk.LiveLocationShareListener
|
|
||||||
import org.matrix.rustcomponents.sdk.LiveLocationShareUpdate
|
import org.matrix.rustcomponents.sdk.LiveLocationShareUpdate
|
||||||
|
import org.matrix.rustcomponents.sdk.LiveLocationsListener
|
||||||
import org.matrix.rustcomponents.sdk.RoomInterface
|
import org.matrix.rustcomponents.sdk.RoomInterface
|
||||||
import org.matrix.rustcomponents.sdk.LiveLocationShare as RustLiveLocationShare
|
import org.matrix.rustcomponents.sdk.LiveLocationShare as RustLiveLocationShare
|
||||||
|
|
||||||
|
|
@ -41,9 +41,9 @@ fun RoomInterface.liveLocationSharesFlow(): Flow<List<LiveLocationShare>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return callbackFlow {
|
return callbackFlow {
|
||||||
val liveLocationShares = liveLocationShares()
|
val liveLocationShares = liveLocationsObserver()
|
||||||
val shares: MutableList<LiveLocationShare> = ArrayList()
|
val shares: MutableList<LiveLocationShare> = ArrayList()
|
||||||
val taskHandle = liveLocationShares.subscribe(object : LiveLocationShareListener {
|
val taskHandle = liveLocationShares.subscribe(object : LiveLocationsListener {
|
||||||
override fun onUpdate(updates: List<LiveLocationShareUpdate>) {
|
override fun onUpdate(updates: List<LiveLocationShareUpdate>) {
|
||||||
for (update in updates) {
|
for (update in updates) {
|
||||||
shares.applyUpdate(update)
|
shares.applyUpdate(update)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import com.google.common.truth.Truth.assertThat
|
||||||
import io.element.android.libraries.matrix.api.auth.AuthenticationException
|
import io.element.android.libraries.matrix.api.auth.AuthenticationException
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.matrix.rustcomponents.sdk.ClientBuildException
|
import org.matrix.rustcomponents.sdk.ClientBuildException
|
||||||
import org.matrix.rustcomponents.sdk.OidcException
|
import org.matrix.rustcomponents.sdk.OAuthException
|
||||||
|
|
||||||
class AuthenticationExceptionMappingTest {
|
class AuthenticationExceptionMappingTest {
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -65,15 +65,15 @@ class AuthenticationExceptionMappingTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `mapping Oidc exceptions map to the Oidc Kotlin`() {
|
fun `mapping Oidc exceptions map to the Oidc Kotlin`() {
|
||||||
assertThat(OidcException.Generic("Generic").mapAuthenticationException())
|
assertThat(OAuthException.Generic("Generic").mapAuthenticationException())
|
||||||
.isException<AuthenticationException.Oidc>("Generic")
|
.isException<AuthenticationException.Oidc>("Generic")
|
||||||
assertThat(OidcException.CallbackUrlInvalid("CallbackUrlInvalid").mapAuthenticationException())
|
assertThat(OAuthException.CallbackUrlInvalid("CallbackUrlInvalid").mapAuthenticationException())
|
||||||
.isException<AuthenticationException.Oidc>("CallbackUrlInvalid")
|
.isException<AuthenticationException.Oidc>("CallbackUrlInvalid")
|
||||||
assertThat(OidcException.Cancelled("Cancelled").mapAuthenticationException())
|
assertThat(OAuthException.Cancelled("Cancelled").mapAuthenticationException())
|
||||||
.isException<AuthenticationException.Oidc>("Cancelled")
|
.isException<AuthenticationException.Oidc>("Cancelled")
|
||||||
assertThat(OidcException.MetadataInvalid("MetadataInvalid").mapAuthenticationException())
|
assertThat(OAuthException.MetadataInvalid("MetadataInvalid").mapAuthenticationException())
|
||||||
.isException<AuthenticationException.Oidc>("MetadataInvalid")
|
.isException<AuthenticationException.Oidc>("MetadataInvalid")
|
||||||
assertThat(OidcException.NotSupported("NotSupported").mapAuthenticationException())
|
assertThat(OAuthException.NotSupported("NotSupported").mapAuthenticationException())
|
||||||
.isException<AuthenticationException.Oidc>("NotSupported")
|
.isException<AuthenticationException.Oidc>("NotSupported")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class QrErrorMapperTest {
|
||||||
assertThat(QrErrorMapper.map(RustHumanQrLoginException.OtherDeviceNotSignedIn())).isEqualTo(QrLoginException.OtherDeviceNotSignedIn)
|
assertThat(QrErrorMapper.map(RustHumanQrLoginException.OtherDeviceNotSignedIn())).isEqualTo(QrLoginException.OtherDeviceNotSignedIn)
|
||||||
assertThat(QrErrorMapper.map(RustHumanQrLoginException.LinkingNotSupported())).isEqualTo(QrLoginException.LinkingNotSupported)
|
assertThat(QrErrorMapper.map(RustHumanQrLoginException.LinkingNotSupported())).isEqualTo(QrLoginException.LinkingNotSupported)
|
||||||
assertThat(QrErrorMapper.map(RustHumanQrLoginException.Unknown())).isEqualTo(QrLoginException.Unknown)
|
assertThat(QrErrorMapper.map(RustHumanQrLoginException.Unknown())).isEqualTo(QrLoginException.Unknown)
|
||||||
assertThat(QrErrorMapper.map(RustHumanQrLoginException.OidcMetadataInvalid())).isEqualTo(QrLoginException.OidcMetadataInvalid)
|
assertThat(QrErrorMapper.map(RustHumanQrLoginException.OAuthMetadataInvalid())).isEqualTo(QrLoginException.OidcMetadataInvalid)
|
||||||
assertThat(QrErrorMapper.map(RustHumanQrLoginException.SlidingSyncNotAvailable())).isEqualTo(QrLoginException.SlidingSyncNotAvailable)
|
assertThat(QrErrorMapper.map(RustHumanQrLoginException.SlidingSyncNotAvailable())).isEqualTo(QrLoginException.SlidingSyncNotAvailable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
package io.element.android.libraries.matrix.impl.fixtures.factories
|
package io.element.android.libraries.matrix.impl.fixtures.factories
|
||||||
|
|
||||||
import io.element.android.libraries.matrix.api.core.ThreadId
|
import io.element.android.libraries.matrix.api.core.ThreadId
|
||||||
|
import io.element.android.libraries.matrix.api.core.UserId
|
||||||
import io.element.android.libraries.matrix.impl.fixtures.fakes.FakeFfiTimelineEvent
|
import io.element.android.libraries.matrix.impl.fixtures.fakes.FakeFfiTimelineEvent
|
||||||
import io.element.android.libraries.matrix.test.A_ROOM_NAME
|
import io.element.android.libraries.matrix.test.A_ROOM_NAME
|
||||||
import io.element.android.libraries.matrix.test.A_USER_NAME
|
import io.element.android.libraries.matrix.test.A_USER_NAME
|
||||||
|
|
@ -68,6 +69,8 @@ internal fun aRustNotificationRoomInfo(
|
||||||
isDirect: Boolean = false,
|
isDirect: Boolean = false,
|
||||||
joinRule: JoinRule? = null,
|
joinRule: JoinRule? = null,
|
||||||
isSpace: Boolean = false,
|
isSpace: Boolean = false,
|
||||||
|
serviceMembers: List<UserId> = emptyList(),
|
||||||
|
activeServiceMemberCount: Int = 0,
|
||||||
) = NotificationRoomInfo(
|
) = NotificationRoomInfo(
|
||||||
displayName = displayName,
|
displayName = displayName,
|
||||||
avatarUrl = avatarUrl,
|
avatarUrl = avatarUrl,
|
||||||
|
|
@ -78,6 +81,8 @@ internal fun aRustNotificationRoomInfo(
|
||||||
isDirect = isDirect,
|
isDirect = isDirect,
|
||||||
joinRule = joinRule,
|
joinRule = joinRule,
|
||||||
isSpace = isSpace,
|
isSpace = isSpace,
|
||||||
|
serviceMembers = serviceMembers.map { it.value },
|
||||||
|
activeServiceMembersCount = activeServiceMemberCount.toULong(),
|
||||||
)
|
)
|
||||||
|
|
||||||
internal fun aRustNotificationEventTimeline(
|
internal fun aRustNotificationEventTimeline(
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ internal fun aRustRoomInfo(
|
||||||
serviceMembers: List<String> = emptyList(),
|
serviceMembers: List<String> = emptyList(),
|
||||||
isLowPriority: Boolean = false,
|
isLowPriority: Boolean = false,
|
||||||
activeRoomCallConsensusIntent: RtcCallIntentConsensus = RtcCallIntentConsensus.None,
|
activeRoomCallConsensusIntent: RtcCallIntentConsensus = RtcCallIntentConsensus.None,
|
||||||
|
activeServiceMembersCount: Int = 0,
|
||||||
) = RoomInfo(
|
) = RoomInfo(
|
||||||
id = id,
|
id = id,
|
||||||
displayName = displayName,
|
displayName = displayName,
|
||||||
|
|
@ -101,4 +102,5 @@ internal fun aRustRoomInfo(
|
||||||
serviceMembers = serviceMembers,
|
serviceMembers = serviceMembers,
|
||||||
isLowPriority = isLowPriority,
|
isLowPriority = isLowPriority,
|
||||||
activeRoomCallConsensusIntent = activeRoomCallConsensusIntent,
|
activeRoomCallConsensusIntent = activeRoomCallConsensusIntent,
|
||||||
|
activeServiceMembersCount = activeServiceMembersCount.toULong(),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,6 @@ internal fun aRustSession(
|
||||||
userId = A_USER_ID.value,
|
userId = A_USER_ID.value,
|
||||||
deviceId = A_DEVICE_ID.value,
|
deviceId = A_DEVICE_ID.value,
|
||||||
homeserverUrl = A_HOMESERVER_URL,
|
homeserverUrl = A_HOMESERVER_URL,
|
||||||
oidcData = null,
|
oauthData = null,
|
||||||
slidingSyncVersion = proxy,
|
slidingSyncVersion = proxy,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class FakeFfiHomeserverLoginDetails(
|
||||||
private val supportsSsoLogin: Boolean = false,
|
private val supportsSsoLogin: Boolean = false,
|
||||||
) : HomeserverLoginDetails(NoHandle) {
|
) : HomeserverLoginDetails(NoHandle) {
|
||||||
override fun url(): String = url
|
override fun url(): String = url
|
||||||
override fun supportsOidcLogin(): Boolean = supportsOidcLogin
|
override fun supportsOauthLogin(): Boolean = supportsOidcLogin
|
||||||
override fun supportsPasswordLogin(): Boolean = supportsPasswordLogin
|
override fun supportsPasswordLogin(): Boolean = supportsPasswordLogin
|
||||||
override fun supportsSsoLogin(): Boolean = supportsSsoLogin
|
override fun supportsSsoLogin(): Boolean = supportsSsoLogin
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import io.element.android.libraries.matrix.api.roomdirectory.RoomVisibility
|
||||||
import io.element.android.libraries.matrix.api.timeline.Timeline
|
import io.element.android.libraries.matrix.api.timeline.Timeline
|
||||||
import io.element.android.libraries.matrix.api.widget.MatrixWidgetDriver
|
import io.element.android.libraries.matrix.api.widget.MatrixWidgetDriver
|
||||||
import io.element.android.libraries.matrix.api.widget.MatrixWidgetSettings
|
import io.element.android.libraries.matrix.api.widget.MatrixWidgetSettings
|
||||||
|
import io.element.android.libraries.matrix.test.AN_EVENT_ID
|
||||||
import io.element.android.libraries.matrix.test.notificationsettings.FakeNotificationSettingsService
|
import io.element.android.libraries.matrix.test.notificationsettings.FakeNotificationSettingsService
|
||||||
import io.element.android.libraries.matrix.test.room.threads.FakeThreadsListService
|
import io.element.android.libraries.matrix.test.room.threads.FakeThreadsListService
|
||||||
import io.element.android.libraries.matrix.test.timeline.FakeTimeline
|
import io.element.android.libraries.matrix.test.timeline.FakeTimeline
|
||||||
|
|
@ -238,8 +239,8 @@ class FakeJoinedRoom(
|
||||||
return liveLocationSharesFlow
|
return liveLocationSharesFlow
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun startLiveLocationShare(durationMillis: Long): Result<Unit> = simulateLongTask {
|
override suspend fun startLiveLocationShare(durationMillis: Long): Result<EventId> = simulateLongTask {
|
||||||
startLiveLocationShareResult(durationMillis)
|
startLiveLocationShareResult(durationMillis).map { AN_EVENT_ID }
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun stopLiveLocationShare(): Result<Unit> = simulateLongTask {
|
override suspend fun stopLiveLocationShare(): Result<Unit> = simulateLongTask {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue