Add KDoc to the features/roommembermoderation API interfaces

Document RoomMemberModerationState, RoomMemberModerationEvents and
RoomMemberModerationRenderer along with their members and parameters.

The renderer doc states that it draws nothing until the host screen asks for a
member's actions, and that onSelectAction exists so the host can navigate for the
actions that need a screen of their own.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benoit Marty
2026-08-14 10:06:53 +02:00
parent 50214fe01a
commit 055fe408a6
3 changed files with 20 additions and 0 deletions
@@ -10,6 +10,9 @@ package io.element.android.features.roommembermoderation.api
import io.element.android.libraries.matrix.api.user.MatrixUser
/**
* Events sent to the moderation presenter through [RoomMemberModerationState.eventSink].
*/
interface RoomMemberModerationEvents {
data class ShowActionsForUser(val user: MatrixUser) : RoomMemberModerationEvents
data class ProcessAction(val action: ModerationAction, val targetUser: MatrixUser) : RoomMemberModerationEvents
@@ -12,7 +12,18 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import io.element.android.libraries.matrix.api.user.MatrixUser
/**
* Renders the moderation action sheet and its confirmation dialogs; it draws nothing until the host screen asks for a member's actions.
*/
interface RoomMemberModerationRenderer {
/**
* Draws whichever sheet or dialog the current state calls for.
*
* @param state the state produced by the moderation presenter.
* @param onSelectAction called when the user picks an action, so the host screen can navigate if that action needs its own screen.
* @param onAvatarClick called when the user taps the member's avatar, or `null` to make it non-interactive.
* @param modifier layout modifier for the container.
*/
@Composable
fun Render(
state: RoomMemberModerationState,
@@ -10,9 +10,15 @@ package io.element.android.features.roommembermoderation.api
import androidx.compose.runtime.Immutable
/**
* State of the member moderation flow, which is the action sheet and the confirmation dialogs shown for a room member.
*/
@Immutable
interface RoomMemberModerationState {
/** Which moderation actions the current user is allowed to perform, so the UI can hide or disable the rest. */
val permissions: RoomMemberModerationPermissions
/** Where the host screen sends its events to open the actions of a member or run one of them. */
val eventSink: (RoomMemberModerationEvents) -> Unit
}