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
|
|
@ -115,10 +115,8 @@ fun SunsetPage(
|
|||
|
||||
@OptIn(CoreColorToken::class)
|
||||
@Composable
|
||||
private fun SunsetBackground(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Column(modifier = modifier.fillMaxSize()) {
|
||||
private fun SunsetBackground() {
|
||||
Column(modifier = Modifier.fillMaxSize()) {
|
||||
// The top background colors are the opposite of the current theme ones
|
||||
val topBackgroundColor = if (ElementTheme.isLightTheme) {
|
||||
DarkColorTokens.colorThemeBg
|
||||
|
|
|
|||
|
|
@ -73,7 +73,6 @@ fun BlurHashAsyncImage(
|
|||
@Composable
|
||||
private fun BlurHashImage(
|
||||
blurHash: String?,
|
||||
modifier: Modifier = Modifier,
|
||||
contentDescription: String? = null,
|
||||
contentScale: ContentScale = ContentScale.Fit,
|
||||
) {
|
||||
|
|
@ -91,7 +90,7 @@ private fun BlurHashImage(
|
|||
}
|
||||
bitmapState.value?.let { bitmap ->
|
||||
Image(
|
||||
modifier = modifier.fillMaxSize(),
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
bitmap = bitmap.asImageBitmap(),
|
||||
contentScale = contentScale,
|
||||
contentDescription = contentDescription
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ private fun ConfirmationDialogContent(
|
|||
cancelText: String,
|
||||
onSubmitClicked: () -> Unit,
|
||||
onCancelClicked: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
title: String? = null,
|
||||
thirdButtonText: String? = null,
|
||||
onThirdButtonClicked: () -> Unit = {},
|
||||
|
|
@ -73,7 +72,6 @@ private fun ConfirmationDialogContent(
|
|||
icon: @Composable (() -> Unit)? = null,
|
||||
) {
|
||||
SimpleAlertDialogContent(
|
||||
modifier = modifier,
|
||||
title = title,
|
||||
content = content,
|
||||
submitText = submitText,
|
||||
|
|
|
|||
|
|
@ -51,12 +51,10 @@ fun ErrorDialog(
|
|||
private fun ErrorDialogContent(
|
||||
content: String,
|
||||
onSubmitClicked: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
title: String = ErrorDialogDefaults.title,
|
||||
submitText: String = ErrorDialogDefaults.submitText,
|
||||
) {
|
||||
SimpleAlertDialogContent(
|
||||
modifier = modifier,
|
||||
title = title,
|
||||
content = content,
|
||||
submitText = submitText,
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ private fun ListDialogContent(
|
|||
onSubmitClicked: () -> Unit,
|
||||
cancelText: String,
|
||||
submitText: String,
|
||||
modifier: Modifier = Modifier,
|
||||
title: String? = null,
|
||||
enabled: Boolean = true,
|
||||
subtitle: @Composable (() -> Unit)? = null,
|
||||
|
|
@ -88,7 +87,6 @@ private fun ListDialogContent(
|
|||
SimpleAlertDialogContent(
|
||||
title = title,
|
||||
subtitle = subtitle,
|
||||
modifier = modifier,
|
||||
cancelText = cancelText,
|
||||
submitText = submitText,
|
||||
onCancelClicked = onDismissRequest,
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ private fun MultipleSelectionDialogContent(
|
|||
onConfirmClicked: (List<Int>) -> Unit,
|
||||
dismissButtonTitle: String,
|
||||
onDismissRequest: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
title: String? = null,
|
||||
initialSelected: ImmutableList<Int> = persistentListOf(),
|
||||
subtitle: @Composable (() -> Unit)? = null,
|
||||
|
|
@ -96,7 +95,6 @@ private fun MultipleSelectionDialogContent(
|
|||
SimpleAlertDialogContent(
|
||||
title = title,
|
||||
subtitle = subtitle,
|
||||
modifier = modifier,
|
||||
submitText = confirmButtonTitle,
|
||||
onSubmitClicked = {
|
||||
onConfirmClicked(selectedOptionIndexes.toList())
|
||||
|
|
|
|||
|
|
@ -56,13 +56,11 @@ private fun RetryDialogContent(
|
|||
content: String,
|
||||
onRetry: () -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
title: String = RetryDialogDefaults.title,
|
||||
retryText: String = RetryDialogDefaults.retryText,
|
||||
dismissText: String = RetryDialogDefaults.dismissText,
|
||||
) {
|
||||
SimpleAlertDialogContent(
|
||||
modifier = modifier,
|
||||
title = title,
|
||||
content = content,
|
||||
submitText = retryText,
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@ private fun SingleSelectionDialogContent(
|
|||
onOptionSelected: (Int) -> Unit,
|
||||
dismissButtonTitle: String,
|
||||
onDismissRequest: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
title: String? = null,
|
||||
initialSelection: Int? = null,
|
||||
subtitle: @Composable (() -> Unit)? = null,
|
||||
|
|
@ -87,7 +86,6 @@ private fun SingleSelectionDialogContent(
|
|||
SimpleAlertDialogContent(
|
||||
title = title,
|
||||
subtitle = subtitle,
|
||||
modifier = modifier,
|
||||
submitText = dismissButtonTitle,
|
||||
onSubmitClicked = onDismissRequest,
|
||||
applyPaddingToContents = false,
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ fun PreferenceCategory(
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun PreferenceCategoryTitle(title: String, modifier: Modifier = Modifier) {
|
||||
private fun PreferenceCategoryTitle(title: String) {
|
||||
Text(
|
||||
modifier = modifier.padding(
|
||||
modifier = Modifier.padding(
|
||||
top = 20.dp,
|
||||
bottom = 8.dp,
|
||||
start = preferencePaddingHorizontal,
|
||||
|
|
|
|||
|
|
@ -80,10 +80,8 @@ fun PreferencePage(
|
|||
private fun PreferenceTopAppBar(
|
||||
title: String,
|
||||
onBackPressed: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
TopAppBar(
|
||||
modifier = modifier,
|
||||
navigationIcon = {
|
||||
BackButton(onClick = onBackPressed)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -91,7 +91,6 @@ private fun TextFieldDialog(
|
|||
onDismissRequest: () -> Unit,
|
||||
value: String?,
|
||||
placeholder: String?,
|
||||
modifier: Modifier = Modifier,
|
||||
validation: (String?) -> Boolean = { true },
|
||||
onValidationErrorMessage: String? = null,
|
||||
autoSelectOnDisplay: Boolean = true,
|
||||
|
|
@ -110,7 +109,6 @@ private fun TextFieldDialog(
|
|||
onSubmit = { onSubmit(textFieldContents.text) },
|
||||
onDismissRequest = onDismissRequest,
|
||||
enabled = canSubmit,
|
||||
modifier = modifier,
|
||||
) {
|
||||
item {
|
||||
TextFieldListItem(
|
||||
|
|
|
|||
|
|
@ -98,11 +98,9 @@ private fun IconsPreview(
|
|||
title: String,
|
||||
iconsList: ImmutableList<Int>,
|
||||
iconNameTransform: (String) -> String,
|
||||
modifier: Modifier = Modifier,
|
||||
) = ElementPreview {
|
||||
val context = LocalContext.current
|
||||
Column(
|
||||
modifier = modifier,
|
||||
verticalArrangement = Arrangement.spacedBy(2.dp),
|
||||
) {
|
||||
Text(
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ internal fun SimpleAlertDialogContent(
|
|||
content: String,
|
||||
submitText: String,
|
||||
onSubmitClicked: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
title: String? = null,
|
||||
subtitle: @Composable (() -> Unit)? = null,
|
||||
destructiveSubmit: Boolean = false,
|
||||
|
|
@ -67,7 +66,6 @@ internal fun SimpleAlertDialogContent(
|
|||
icon: @Composable (() -> Unit)? = null,
|
||||
) {
|
||||
SimpleAlertDialogContent(
|
||||
modifier = modifier,
|
||||
icon = icon,
|
||||
title = title,
|
||||
subtitle = subtitle,
|
||||
|
|
@ -92,7 +90,6 @@ internal fun SimpleAlertDialogContent(
|
|||
internal fun SimpleAlertDialogContent(
|
||||
submitText: String,
|
||||
onSubmitClicked: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
title: String? = null,
|
||||
subtitle: @Composable (() -> Unit)? = null,
|
||||
destructiveSubmit: Boolean = false,
|
||||
|
|
@ -148,7 +145,6 @@ internal fun SimpleAlertDialogContent(
|
|||
}
|
||||
}
|
||||
},
|
||||
modifier = modifier,
|
||||
title = title?.let { titleText ->
|
||||
@Composable {
|
||||
Text(
|
||||
|
|
@ -192,11 +188,9 @@ internal fun AlertDialogContent(
|
|||
iconContentColor: Color,
|
||||
titleContentColor: Color,
|
||||
textContentColor: Color,
|
||||
modifier: Modifier = Modifier,
|
||||
applyPaddingToContents: Boolean = true,
|
||||
) {
|
||||
Surface(
|
||||
modifier = modifier,
|
||||
shape = shape,
|
||||
color = containerColor,
|
||||
tonalElevation = tonalElevation,
|
||||
|
|
|
|||
|
|
@ -49,13 +49,11 @@ fun FeatureListView(
|
|||
private fun FeaturePreferenceView(
|
||||
feature: FeatureUiModel,
|
||||
onCheckedChange: (Boolean) -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
PreferenceCheckbox(
|
||||
title = feature.title,
|
||||
supportingText = feature.description,
|
||||
isChecked = feature.isEnabled,
|
||||
modifier = modifier,
|
||||
onCheckedChange = onCheckedChange
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,6 @@ private fun PdfPagesView(
|
|||
@Composable
|
||||
private fun PdfPageView(
|
||||
pdfPage: PdfPage,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val pdfPageState by pdfPage.stateFlow.collectAsState()
|
||||
DisposableEffect(pdfPage) {
|
||||
|
|
@ -101,12 +100,12 @@ private fun PdfPageView(
|
|||
bitmap = state.bitmap.asImageBitmap(),
|
||||
contentDescription = stringResource(id = CommonStrings.a11y_page_n, pdfPage.pageIndex),
|
||||
contentScale = ContentScale.FillWidth,
|
||||
modifier = modifier.fillMaxWidth()
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
is PdfPage.State.Loading -> {
|
||||
Box(
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(state.height.toDp())
|
||||
.background(color = Color.White)
|
||||
|
|
|
|||
|
|
@ -259,10 +259,8 @@ private fun ErrorView(
|
|||
errorMessage: String,
|
||||
onRetry: () -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
RetryDialog(
|
||||
modifier = modifier,
|
||||
content = errorMessage,
|
||||
onRetry = onRetry,
|
||||
onDismiss = onDismiss
|
||||
|
|
|
|||
|
|
@ -209,10 +209,9 @@ private fun RoomSummaryView(
|
|||
summary: RoomSummaryDetails,
|
||||
isSelected: Boolean,
|
||||
onSelection: (RoomSummaryDetails) -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Row(
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.clickable { onSelection(summary) }
|
||||
.fillMaxWidth()
|
||||
.padding(start = 16.dp, end = 4.dp)
|
||||
|
|
|
|||
|
|
@ -405,14 +405,13 @@ private fun TextInput(
|
|||
onError: (Throwable) -> Unit,
|
||||
onTyping: (Boolean) -> Unit,
|
||||
onRichContentSelected: ((Uri) -> Unit)?,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val bgColor = ElementTheme.colors.bgSubtleSecondary
|
||||
val borderColor = ElementTheme.colors.borderDisabled
|
||||
val roundedCorners = textInputRoundedCornerShape(composerMode = composerMode)
|
||||
|
||||
Column(
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.clip(roundedCorners)
|
||||
.border(0.5.dp, borderColor, roundedCorners)
|
||||
.background(color = bgColor)
|
||||
|
|
@ -464,15 +463,14 @@ private fun TextInput(
|
|||
private fun ComposerModeView(
|
||||
composerMode: MessageComposerMode,
|
||||
onResetComposerMode: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
when (composerMode) {
|
||||
is MessageComposerMode.Edit -> {
|
||||
EditingModeView(onResetComposerMode = onResetComposerMode, modifier = modifier)
|
||||
EditingModeView(onResetComposerMode = onResetComposerMode)
|
||||
}
|
||||
is MessageComposerMode.Reply -> {
|
||||
ReplyToModeView(
|
||||
modifier = modifier.padding(8.dp),
|
||||
modifier = Modifier.padding(8.dp),
|
||||
senderName = composerMode.senderName,
|
||||
text = composerMode.defaultContent,
|
||||
attachmentThumbnailInfo = composerMode.attachmentThumbnailInfo,
|
||||
|
|
@ -486,12 +484,11 @@ private fun ComposerModeView(
|
|||
@Composable
|
||||
private fun EditingModeView(
|
||||
onResetComposerMode: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(start = 12.dp)
|
||||
) {
|
||||
|
|
@ -881,11 +878,8 @@ internal fun TextComposerVoicePreview() = ElementPreview {
|
|||
@Composable
|
||||
private fun PreviewColumn(
|
||||
items: ImmutableList<@Composable () -> Unit>,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
) {
|
||||
Column {
|
||||
items.forEach { item ->
|
||||
Box(
|
||||
modifier = Modifier.height(IntrinsicSize.Min)
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import io.element.android.wysiwyg.view.models.LinkAction
|
|||
import kotlinx.coroutines.launch
|
||||
import uniffi.wysiwyg_composer.ActionState
|
||||
import uniffi.wysiwyg_composer.ComposerAction
|
||||
|
||||
@Composable
|
||||
internal fun TextFormatting(
|
||||
state: RichTextEditorState,
|
||||
|
|
|
|||
|
|
@ -124,11 +124,10 @@ private fun PlayerButton(
|
|||
type: PlayerButtonType,
|
||||
enabled: Boolean,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
IconButton(
|
||||
onClick = onClick,
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.background(color = ElementTheme.colors.bgCanvasDefault, shape = CircleShape)
|
||||
.size(30.dp),
|
||||
enabled = enabled,
|
||||
|
|
|
|||
|
|
@ -88,9 +88,7 @@ internal fun VoiceMessageRecording(
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun RedRecordingDot(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
private fun RedRecordingDot() {
|
||||
val infiniteTransition = rememberInfiniteTransition("RedRecordingDot")
|
||||
val alpha by infiniteTransition.animateFloat(
|
||||
initialValue = 1f,
|
||||
|
|
@ -102,7 +100,7 @@ private fun RedRecordingDot(
|
|||
label = "RedRecordingDotAlpha",
|
||||
)
|
||||
Box(
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.size(8.dp)
|
||||
.alpha(alpha)
|
||||
.background(color = ElementTheme.colors.textCriticalPrimary, shape = CircleShape)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue