mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Merge branch 'develop' into feature/valere/timeline_active_call_rendering
This commit is contained in:
+1
-4
@@ -90,7 +90,6 @@ sealed interface NotificationContent {
|
||||
val question: String,
|
||||
) : MessageLike
|
||||
|
||||
// TODO put real implementation
|
||||
data object Beacon : MessageLike
|
||||
}
|
||||
|
||||
@@ -119,9 +118,7 @@ sealed interface NotificationContent {
|
||||
data class RoomTopic(val topic: String) : StateEvent
|
||||
data object SpaceChild : StateEvent
|
||||
data object SpaceParent : StateEvent
|
||||
|
||||
// TODO put real implementation
|
||||
data object Beacon : StateEvent
|
||||
data object BeaconInfo : StateEvent
|
||||
}
|
||||
|
||||
data class Invite(
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ private fun StateEventContent.toContent(): NotificationContent.StateEvent {
|
||||
is StateEventContent.RoomTopic -> NotificationContent.StateEvent.RoomTopic(topic)
|
||||
StateEventContent.SpaceChild -> NotificationContent.StateEvent.SpaceChild
|
||||
StateEventContent.SpaceParent -> NotificationContent.StateEvent.SpaceParent
|
||||
StateEventContent.BeaconInfo -> NotificationContent.StateEvent.Beacon
|
||||
StateEventContent.BeaconInfo -> NotificationContent.StateEvent.BeaconInfo
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -90,6 +90,8 @@ class RustMatrixClientTest {
|
||||
userId = userId,
|
||||
displayName = A_USER_NAME,
|
||||
avatarUrl = AN_AVATAR_URL,
|
||||
status = null,
|
||||
call = null,
|
||||
)
|
||||
},
|
||||
),
|
||||
|
||||
+6
@@ -9,14 +9,20 @@
|
||||
package io.element.android.libraries.matrix.impl.fixtures.factories
|
||||
|
||||
import io.element.android.libraries.matrix.test.A_USER_ID
|
||||
import org.matrix.rustcomponents.sdk.UserCall
|
||||
import org.matrix.rustcomponents.sdk.UserProfile
|
||||
import org.matrix.rustcomponents.sdk.UserStatus
|
||||
|
||||
internal fun aRustUserProfile(
|
||||
userId: String = A_USER_ID.value,
|
||||
displayName: String = "displayName",
|
||||
avatarUrl: String = "avatarUrl",
|
||||
status: UserStatus? = null,
|
||||
call: UserCall? = null,
|
||||
) = UserProfile(
|
||||
userId = userId,
|
||||
displayName = displayName,
|
||||
avatarUrl = avatarUrl,
|
||||
status = status,
|
||||
call = call,
|
||||
)
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@
|
||||
package io.element.android.libraries.matrix.impl.fixtures.fakes
|
||||
|
||||
import io.element.android.libraries.matrix.impl.fixtures.factories.aRustSession
|
||||
import io.element.android.libraries.matrix.impl.fixtures.factories.aRustUserProfile
|
||||
import io.element.android.libraries.matrix.test.A_DEVICE_ID
|
||||
import io.element.android.libraries.matrix.test.A_HOMESERVER_URL
|
||||
import io.element.android.libraries.matrix.test.A_USER_ID
|
||||
@@ -49,7 +50,7 @@ class FakeFfiClient(
|
||||
private val session: Session = aRustSession(),
|
||||
private val clearCachesResult: () -> Unit = { lambdaError() },
|
||||
private val withUtdHook: (UnableToDecryptDelegate) -> Unit = { lambdaError() },
|
||||
private val getProfileResult: (String) -> UserProfile = { UserProfile(userId = userId, displayName = null, avatarUrl = null) },
|
||||
private val getProfileResult: (String) -> UserProfile = { aRustUserProfile() },
|
||||
private val homeserverLoginDetailsResult: () -> HomeserverLoginDetails = { lambdaError() },
|
||||
private val getStoreSizesResult: () -> StoreSizes = { lambdaError() },
|
||||
private val createRoomResult: (CreateRoomParameters) -> String = { lambdaError() },
|
||||
|
||||
+4
-4
@@ -126,7 +126,7 @@ class FakeMatrixClient(
|
||||
private val getMapStyleUrlResult: () -> Result<String?> = { lambdaError() },
|
||||
private val getDatabaseSizesLambda: () -> Result<SdkStoreSizes> = { lambdaError() },
|
||||
private val resetWellKnownConfigLambda: () -> Result<Unit> = { lambdaError() },
|
||||
override val contentScanner: ContentScanner? = null
|
||||
override val contentScanner: ContentScanner? = null,
|
||||
) : MatrixClient {
|
||||
var setDisplayNameCalled: Boolean = false
|
||||
private set
|
||||
@@ -144,7 +144,7 @@ class FakeMatrixClient(
|
||||
private val _userProfile: MutableStateFlow<MatrixUser> = MutableStateFlow(MatrixUser(sessionId, userDisplayName, userAvatarUrl))
|
||||
override val userProfile: StateFlow<MatrixUser> = _userProfile
|
||||
|
||||
private var createRoomResult: Result<RoomId> = Result.success(A_ROOM_ID)
|
||||
var createRoomResult: (CreateRoomParameters) -> Result<RoomId> = { Result.success(A_ROOM_ID) }
|
||||
private var createDmResult: Result<RoomId> = Result.success(A_ROOM_ID)
|
||||
private var findDmResult: Result<RoomId?> = Result.success(A_ROOM_ID)
|
||||
private val getRoomResults = mutableMapOf<RoomId, BaseRoom>()
|
||||
@@ -193,7 +193,7 @@ class FakeMatrixClient(
|
||||
}
|
||||
|
||||
override suspend fun createRoom(createRoomParams: CreateRoomParameters): Result<RoomId> = simulateLongTask {
|
||||
return createRoomResult
|
||||
return createRoomResult(createRoomParams)
|
||||
}
|
||||
|
||||
override suspend fun createDM(userId: UserId): Result<RoomId> = simulateLongTask {
|
||||
@@ -297,7 +297,7 @@ class FakeMatrixClient(
|
||||
// Mocks
|
||||
|
||||
fun givenCreateRoomResult(result: Result<RoomId>) {
|
||||
createRoomResult = result
|
||||
createRoomResult = { result }
|
||||
}
|
||||
|
||||
fun givenCreateDmResult(result: Result<RoomId>) {
|
||||
|
||||
+6
-1
@@ -299,6 +299,10 @@ class DefaultNotifiableEventResolver(
|
||||
Timber.tag(loggerTag.value).d("Ignoring notification for sticker")
|
||||
throw NotificationResolverException.EventFilteredOut
|
||||
}
|
||||
NotificationContent.MessageLike.Beacon -> {
|
||||
Timber.tag(loggerTag.value).d("Ignoring notification for beacon")
|
||||
throw NotificationResolverException.EventFilteredOut
|
||||
}
|
||||
is NotificationContent.StateEvent.RoomMemberContent,
|
||||
NotificationContent.StateEvent.PolicyRuleRoom,
|
||||
NotificationContent.StateEvent.PolicyRuleServer,
|
||||
@@ -318,7 +322,8 @@ class DefaultNotifiableEventResolver(
|
||||
NotificationContent.StateEvent.RoomTombstone,
|
||||
is NotificationContent.StateEvent.RoomTopic,
|
||||
NotificationContent.StateEvent.SpaceChild,
|
||||
NotificationContent.StateEvent.SpaceParent -> {
|
||||
NotificationContent.StateEvent.SpaceParent,
|
||||
NotificationContent.StateEvent.BeaconInfo -> {
|
||||
Timber.tag(loggerTag.value).d("Ignoring notification for state event ${content.javaClass.simpleName}")
|
||||
throw NotificationResolverException.EventFilteredOut
|
||||
}
|
||||
|
||||
+1
@@ -17,4 +17,5 @@ data class ElementWellKnown(
|
||||
val identityProviderAppScheme: String?,
|
||||
val customRecoveryPassphrase: CustomRecoveryPassphrase?,
|
||||
val contentScannerUrl: String?,
|
||||
val forceDisableE2EE: Boolean?,
|
||||
)
|
||||
|
||||
+2
@@ -46,6 +46,8 @@ data class InternalElementWellKnown(
|
||||
val customRecoveryPassphrase: InternalCustomRecoveryPassphrase? = null,
|
||||
@SerialName("content_scanner_url")
|
||||
val contentScannerUrl: String? = null,
|
||||
@SerialName("force_disable_e2ee")
|
||||
val forceDisableE2EE: Boolean? = null,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
|
||||
+1
@@ -31,6 +31,7 @@ fun InternalElementWellKnown.map() = ElementWellKnown(
|
||||
identityProviderAppScheme = identityProviderAppScheme,
|
||||
customRecoveryPassphrase = customRecoveryPassphrase?.toPublic(),
|
||||
contentScannerUrl = contentScannerUrl,
|
||||
forceDisableE2EE = forceDisableE2EE,
|
||||
)
|
||||
|
||||
private fun InternalCustomRecoveryPassphrase.toPublic(): CustomRecoveryPassphrase {
|
||||
|
||||
+7
-1
@@ -50,6 +50,7 @@ class DefaultSessionWellknownRetrieverTest {
|
||||
identityProviderAppScheme = null,
|
||||
customRecoveryPassphrase = null,
|
||||
contentScannerUrl = null,
|
||||
forceDisableE2EE = null,
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -77,6 +78,7 @@ class DefaultSessionWellknownRetrieverTest {
|
||||
identityProviderAppScheme = "an_app_scheme",
|
||||
customRecoveryPassphrase = null,
|
||||
contentScannerUrl = "https://content-scanner.example.com",
|
||||
forceDisableE2EE = false,
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -108,6 +110,7 @@ class DefaultSessionWellknownRetrieverTest {
|
||||
identityProviderAppScheme = null,
|
||||
contentScannerUrl = null,
|
||||
customRecoveryPassphrase = null,
|
||||
forceDisableE2EE = null,
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -255,6 +258,7 @@ class DefaultSessionWellknownRetrieverTest {
|
||||
identityProviderAppScheme = "an_app_scheme",
|
||||
customRecoveryPassphrase = null,
|
||||
contentScannerUrl = "https://content-scanner.example.com",
|
||||
forceDisableE2EE = false,
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -303,6 +307,7 @@ class DefaultSessionWellknownRetrieverTest {
|
||||
identityProviderAppScheme = "an_app_scheme",
|
||||
customRecoveryPassphrase = null,
|
||||
contentScannerUrl = "https://content-scanner.example.com",
|
||||
forceDisableE2EE = false,
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -340,7 +345,8 @@ class DefaultSessionWellknownRetrieverTest {
|
||||
"brand_color": "#FF0000",
|
||||
"notification_sound": "a_notification_sound.flac",
|
||||
"idp_app_scheme": "an_app_scheme",
|
||||
"content_scanner_url": "https://content-scanner.example.com"
|
||||
"content_scanner_url": "https://content-scanner.example.com",
|
||||
"force_disable_e2ee": false,
|
||||
}"""
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -50,6 +50,7 @@ class DefaultWellknownRetrieverTest {
|
||||
identityProviderAppScheme = null,
|
||||
customRecoveryPassphrase = null,
|
||||
contentScannerUrl = null,
|
||||
forceDisableE2EE = null,
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -72,6 +73,7 @@ class DefaultWellknownRetrieverTest {
|
||||
identityProviderAppScheme = "an_app_scheme",
|
||||
customRecoveryPassphrase = null,
|
||||
contentScannerUrl = "https://content-scanner.example.com",
|
||||
forceDisableE2EE = false,
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -101,6 +103,7 @@ class DefaultWellknownRetrieverTest {
|
||||
identityProviderAppScheme = null,
|
||||
contentScannerUrl = null,
|
||||
customRecoveryPassphrase = null,
|
||||
forceDisableE2EE = null,
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -266,7 +269,8 @@ class DefaultWellknownRetrieverTest {
|
||||
"brand_color": "#FF0000",
|
||||
"notification_sound": "a_notification_sound.flac",
|
||||
"idp_app_scheme": "an_app_scheme",
|
||||
"content_scanner_url": "https://content-scanner.example.com"
|
||||
"content_scanner_url": "https://content-scanner.example.com",
|
||||
"force_disable_e2ee": false
|
||||
}"""
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -20,6 +20,7 @@ fun anElementWellKnown(
|
||||
identityProviderAppScheme: String? = null,
|
||||
customRecoveryPassphrase: CustomRecoveryPassphrase? = null,
|
||||
contentScannerUrl: String? = null,
|
||||
forceDisableE2EE: Boolean? = null,
|
||||
) = ElementWellKnown(
|
||||
registrationHelperUrl = registrationHelperUrl,
|
||||
enforceElementPro = enforceElementPro,
|
||||
@@ -29,6 +30,7 @@ fun anElementWellKnown(
|
||||
identityProviderAppScheme = identityProviderAppScheme,
|
||||
customRecoveryPassphrase = customRecoveryPassphrase,
|
||||
contentScannerUrl = contentScannerUrl,
|
||||
forceDisableE2EE = forceDisableE2EE,
|
||||
)
|
||||
|
||||
fun aCustomRecoveryPassphrase(
|
||||
|
||||
Reference in New Issue
Block a user