mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
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:
+3
@@ -10,6 +10,9 @@ package io.element.android.features.roommembermoderation.api
|
|||||||
|
|
||||||
import io.element.android.libraries.matrix.api.user.MatrixUser
|
import io.element.android.libraries.matrix.api.user.MatrixUser
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Events sent to the moderation presenter through [RoomMemberModerationState.eventSink].
|
||||||
|
*/
|
||||||
interface RoomMemberModerationEvents {
|
interface RoomMemberModerationEvents {
|
||||||
data class ShowActionsForUser(val user: MatrixUser) : RoomMemberModerationEvents
|
data class ShowActionsForUser(val user: MatrixUser) : RoomMemberModerationEvents
|
||||||
data class ProcessAction(val action: ModerationAction, val targetUser: MatrixUser) : RoomMemberModerationEvents
|
data class ProcessAction(val action: ModerationAction, val targetUser: MatrixUser) : RoomMemberModerationEvents
|
||||||
|
|||||||
+11
@@ -12,7 +12,18 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import io.element.android.libraries.matrix.api.user.MatrixUser
|
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 {
|
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
|
@Composable
|
||||||
fun Render(
|
fun Render(
|
||||||
state: RoomMemberModerationState,
|
state: RoomMemberModerationState,
|
||||||
|
|||||||
+6
@@ -10,9 +10,15 @@ package io.element.android.features.roommembermoderation.api
|
|||||||
|
|
||||||
import androidx.compose.runtime.Immutable
|
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
|
@Immutable
|
||||||
interface RoomMemberModerationState {
|
interface RoomMemberModerationState {
|
||||||
|
/** Which moderation actions the current user is allowed to perform, so the UI can hide or disable the rest. */
|
||||||
val permissions: RoomMemberModerationPermissions
|
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
|
val eventSink: (RoomMemberModerationEvents) -> Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user