Remove Modifier parameter in private function when only default value is used.
This will improve the code coverage metrics, and this also fixes a few potential bug, where the Modifier was used several times.
This commit is contained in:
parent
d06e5c23cb
commit
b104dba845
59 changed files with 117 additions and 262 deletions
|
|
@ -412,10 +412,9 @@ private fun MessagesViewContent(
|
|||
private fun MessagesViewComposerBottomSheetContents(
|
||||
subcomposing: Boolean,
|
||||
state: MessagesState,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
if (state.userHasPermissionToSendMessage) {
|
||||
Column(modifier = modifier.fillMaxWidth()) {
|
||||
Column(modifier = Modifier.fillMaxWidth()) {
|
||||
MentionSuggestionsPickerView(
|
||||
modifier = Modifier
|
||||
.heightIn(max = 230.dp)
|
||||
|
|
@ -443,7 +442,7 @@ private fun MessagesViewComposerBottomSheetContents(
|
|||
)
|
||||
}
|
||||
} else {
|
||||
CantSendMessageBanner(modifier = modifier)
|
||||
CantSendMessageBanner()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -456,10 +455,8 @@ private fun MessagesViewTopBar(
|
|||
onRoomDetailsClicked: () -> Unit,
|
||||
onJoinCallClicked: () -> Unit,
|
||||
onBackPressed: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
TopAppBar(
|
||||
modifier = modifier,
|
||||
navigationIcon = {
|
||||
BackButton(onClick = onBackPressed)
|
||||
},
|
||||
|
|
@ -497,7 +494,6 @@ private fun MessagesViewTopBar(
|
|||
|
||||
@Composable
|
||||
private fun JoinCallMenuItem(
|
||||
modifier: Modifier = Modifier,
|
||||
onJoinCallClicked: () -> Unit,
|
||||
) {
|
||||
Material3Button(
|
||||
|
|
@ -507,7 +503,7 @@ private fun JoinCallMenuItem(
|
|||
containerColor = ElementTheme.colors.iconAccentTertiary
|
||||
),
|
||||
contentPadding = PaddingValues(horizontal = 10.dp, vertical = 0.dp),
|
||||
modifier = modifier.heightIn(min = 36.dp),
|
||||
modifier = Modifier.heightIn(min = 36.dp),
|
||||
) {
|
||||
Icon(
|
||||
modifier = Modifier.size(20.dp),
|
||||
|
|
@ -545,11 +541,9 @@ private fun RoomAvatarAndNameRow(
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun CantSendMessageBanner(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
private fun CantSendMessageBanner() {
|
||||
Row(
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(MaterialTheme.colorScheme.secondary)
|
||||
.padding(16.dp),
|
||||
|
|
|
|||
|
|
@ -337,7 +337,6 @@ private fun EmojiButton(
|
|||
emoji: String,
|
||||
isHighlighted: Boolean,
|
||||
onClicked: (String) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val backgroundColor = if (isHighlighted) {
|
||||
ElementTheme.colors.bgActionPrimaryRest
|
||||
|
|
@ -350,7 +349,7 @@ private fun EmojiButton(
|
|||
stringResource(id = CommonStrings.a11y_react_with, emoji)
|
||||
}
|
||||
Box(
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.size(48.dp)
|
||||
.background(backgroundColor, CircleShape)
|
||||
.clearAndSetSemantics {
|
||||
|
|
|
|||
|
|
@ -118,10 +118,9 @@ private fun AttachmentPreviewContent(
|
|||
attachment: Attachment,
|
||||
onSendClicked: () -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(top = 24.dp)
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -101,10 +101,9 @@ private fun AttachmentSourcePickerMenu(
|
|||
onSendLocationClicked: () -> Unit,
|
||||
onCreatePollClicked: () -> Unit,
|
||||
enableTextFormatting: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.navigationBarsPadding()
|
||||
.imePadding()
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -126,9 +126,8 @@ private val ADD_EMOJI_SIZE = 16.dp
|
|||
@Composable
|
||||
private fun TextContent(
|
||||
text: String,
|
||||
modifier: Modifier = Modifier,
|
||||
) = Text(
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.height(REACTION_EMOJI_LINE_HEIGHT.toDp()),
|
||||
text = text,
|
||||
style = ElementTheme.typography.fontBodyMdRegular,
|
||||
|
|
@ -138,27 +137,24 @@ private fun TextContent(
|
|||
@Composable
|
||||
private fun IconContent(
|
||||
@DrawableRes resourceId: Int,
|
||||
modifier: Modifier = Modifier
|
||||
) = Icon(
|
||||
resourceId = resourceId,
|
||||
contentDescription = stringResource(id = R.string.screen_room_timeline_add_reaction),
|
||||
tint = ElementTheme.materialColors.secondary,
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.size(ADD_EMOJI_SIZE)
|
||||
)
|
||||
|
||||
@Composable
|
||||
private fun ReactionContent(
|
||||
reaction: AggregatedReaction,
|
||||
modifier: Modifier = Modifier,
|
||||
) = Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = modifier,
|
||||
) {
|
||||
// Check if this is a custom reaction (MSC4027)
|
||||
if (reaction.key.startsWith("mxc://")) {
|
||||
AsyncImage(
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.heightIn(min = REACTION_EMOJI_LINE_HEIGHT.toDp(), max = REACTION_EMOJI_LINE_HEIGHT.toDp())
|
||||
.aspectRatio(REACTION_IMAGE_ASPECT_RATIO, false),
|
||||
model = MediaRequestData(MediaSource(reaction.key), MediaRequestData.Kind.Content),
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import androidx.compose.foundation.layout.Row
|
|||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.padding
|
||||
|
|
@ -106,7 +107,6 @@ fun ReactionSummaryView(
|
|||
@Composable
|
||||
private fun SheetContent(
|
||||
summary: ReactionSummaryState.Summary,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val animationScope = rememberCoroutineScope()
|
||||
var selectedReactionKey: String by rememberSaveable { mutableStateOf(summary.selectedKey) }
|
||||
|
|
@ -127,9 +127,8 @@ private fun SheetContent(
|
|||
}
|
||||
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.fillMaxHeight()
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
) {
|
||||
LazyRow(
|
||||
state = reactionListState,
|
||||
|
|
@ -172,7 +171,6 @@ private fun AggregatedReactionButton(
|
|||
reaction: AggregatedReaction,
|
||||
isHighlighted: Boolean,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val buttonColor = if (isHighlighted) {
|
||||
ElementTheme.colors.bgActionPrimaryRest
|
||||
|
|
@ -188,7 +186,7 @@ private fun AggregatedReactionButton(
|
|||
|
||||
val roundedCornerShape = RoundedCornerShape(corner = CornerSize(percent = 50))
|
||||
Surface(
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.background(buttonColor, roundedCornerShape)
|
||||
.clip(roundedCornerShape)
|
||||
.clickable(onClick = onClick)
|
||||
|
|
@ -238,10 +236,9 @@ private fun SenderRow(
|
|||
name: String,
|
||||
userId: String,
|
||||
sentTime: String,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Row(
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.heightIn(min = 56.dp)
|
||||
.padding(start = 16.dp, top = 4.dp, end = 16.dp, bottom = 4.dp),
|
||||
|
|
|
|||
|
|
@ -125,11 +125,10 @@ fun EventDebugInfoView(
|
|||
private fun CollapsibleSection(
|
||||
title: String,
|
||||
text: String,
|
||||
modifier: Modifier = Modifier,
|
||||
initiallyExpanded: Boolean = false,
|
||||
) {
|
||||
var isExpanded by remember { mutableStateOf(initiallyExpanded) }
|
||||
Column(modifier = modifier.fillMaxWidth()) {
|
||||
Column(modifier = Modifier.fillMaxWidth()) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.clickable { isExpanded = !isExpanded }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue