Merge branch 'develop' into feature/fga/user_moderation_bottomsheet

This commit is contained in:
ganfra 2025-06-03 10:46:12 +02:00
commit abc5547aa3
647 changed files with 7223 additions and 2888 deletions

View file

@ -9,12 +9,14 @@ package io.element.android.libraries.matrix.api.notification
import io.element.android.libraries.matrix.api.core.EventId
import io.element.android.libraries.matrix.api.core.RoomId
import io.element.android.libraries.matrix.api.core.SessionId
import io.element.android.libraries.matrix.api.core.ThreadId
import io.element.android.libraries.matrix.api.core.UserId
import io.element.android.libraries.matrix.api.room.RoomMembershipState
import io.element.android.libraries.matrix.api.timeline.item.event.MessageType
data class NotificationData(
val sessionId: SessionId,
val eventId: EventId,
val threadId: ThreadId?,
val roomId: RoomId,

View file

@ -11,5 +11,5 @@ import io.element.android.libraries.matrix.api.core.EventId
import io.element.android.libraries.matrix.api.core.RoomId
interface NotificationService {
suspend fun getNotification(roomId: RoomId, eventId: EventId): Result<NotificationData?>
suspend fun getNotifications(ids: Map<RoomId, List<EventId>>): Result<Map<EventId, NotificationData>>
}

View file

@ -32,7 +32,6 @@ data class RoomInfo(
val isEncrypted: Boolean?,
val joinRule: JoinRule?,
val isSpace: Boolean,
val tombstone: RoomTombstone?,
val isFavorite: Boolean,
val canonicalAlias: RoomAlias?,
val alternativeAliases: ImmutableList<RoomAlias>,
@ -74,12 +73,8 @@ data class RoomInfo(
val pinnedEventIds: ImmutableList<EventId>,
val creator: UserId?,
val historyVisibility: RoomHistoryVisibility,
val successorRoom: SuccessorRoom?,
) {
val aliases: List<RoomAlias>
get() = listOfNotNull(canonicalAlias) + alternativeAliases
}
data class RoomTombstone(
val body: String,
val replacementRoomId: RoomId,
)

View file

@ -22,15 +22,12 @@ class RoomMembershipObserver {
private val _updates = MutableSharedFlow<RoomMembershipUpdate>(extraBufferCapacity = 10)
val updates = _updates.asSharedFlow()
suspend fun notifyUserLeftRoom(roomId: RoomId) {
_updates.emit(RoomMembershipUpdate(roomId, false, MembershipChange.LEFT))
}
suspend fun notifyUserDeclinedInvite(roomId: RoomId) {
_updates.emit(RoomMembershipUpdate(roomId, false, MembershipChange.INVITATION_REJECTED))
}
suspend fun notifyUserCanceledKnock(roomId: RoomId) {
_updates.emit(RoomMembershipUpdate(roomId, false, MembershipChange.KNOCK_RETRACTED))
suspend fun notifyUserLeftRoom(roomId: RoomId, membershipBeforeLeft: CurrentUserMembership) {
val membershipChange = when (membershipBeforeLeft) {
CurrentUserMembership.INVITED -> MembershipChange.INVITATION_REJECTED
CurrentUserMembership.KNOCKED -> MembershipChange.KNOCK_RETRACTED
else -> MembershipChange.LEFT
}
_updates.emit(RoomMembershipUpdate(roomId, false, membershipChange))
}
}

View file

@ -0,0 +1,30 @@
/*
* Copyright 2025 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/
package io.element.android.libraries.matrix.api.room
import io.element.android.libraries.matrix.api.core.RoomId
/**
*
* When a room A is tombstoned, it is replaced by a room B. The room A is the
* predecessor of B, and B is the successor of A. This type holds information
* about the successor room.
*
* A room is tombstoned if it has received a m.room.tombstone state event.
*
*/
data class SuccessorRoom(
/**
* The ID of the replacement room.
*/
val roomId: RoomId,
/**
* The message explaining why the room has been tombstoned.
*/
val reason: String?,
)