mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Limit usage of nullable callback.
This commit is contained in:
+7
-2
@@ -25,11 +25,16 @@ class DefaultRoomMemberModerationRenderer : RoomMemberModerationRenderer {
|
||||
override fun Render(
|
||||
state: RoomMemberModerationState,
|
||||
onSelectAction: (ModerationAction, MatrixUser) -> Unit,
|
||||
onAvatarClick: ((MatrixUser) -> Unit)?,
|
||||
onAvatarClick: (MatrixUser) -> Unit,
|
||||
modifier: Modifier
|
||||
) {
|
||||
if (state is InternalRoomMemberModerationState) {
|
||||
RoomMemberModerationView(modifier = modifier, state = state, onSelectAction = onSelectAction, onAvatarClick = onAvatarClick)
|
||||
RoomMemberModerationView(
|
||||
modifier = modifier,
|
||||
state = state,
|
||||
onSelectAction = onSelectAction,
|
||||
onAvatarClick = onAvatarClick,
|
||||
)
|
||||
} else {
|
||||
SideEffect {
|
||||
Timber.d("RoomMemberModerationRenderer: Render called with unsupported state: $state")
|
||||
|
||||
+4
-4
@@ -66,7 +66,7 @@ import timber.log.Timber
|
||||
fun RoomMemberModerationView(
|
||||
state: InternalRoomMemberModerationState,
|
||||
onSelectAction: (ModerationAction, MatrixUser) -> Unit,
|
||||
onAvatarClick: ((MatrixUser) -> Unit)?,
|
||||
onAvatarClick: (MatrixUser) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Box(modifier = modifier) {
|
||||
@@ -218,7 +218,7 @@ private fun RoomMemberActionsBottomSheet(
|
||||
user: MatrixUser,
|
||||
actions: ImmutableList<ModerationActionState>,
|
||||
onSelectAction: (ModerationAction, MatrixUser) -> Unit,
|
||||
onAvatarClick: ((MatrixUser) -> Unit)? = null,
|
||||
onAvatarClick: (MatrixUser) -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
) {
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
@@ -248,10 +248,10 @@ private fun RoomMemberActionsBottomSheet(
|
||||
modifier = Modifier
|
||||
.padding(bottom = 24.dp)
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.clickable(enabled = user.avatarUrl != null && onAvatarClick != null) {
|
||||
.clickable(enabled = user.avatarUrl != null) {
|
||||
coroutineScope.launch {
|
||||
bottomSheetState.hide()
|
||||
onAvatarClick?.invoke(user)
|
||||
onAvatarClick(user)
|
||||
onDismiss()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user