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:
Benoit Marty 2024-02-08 10:03:24 +01:00 committed by Benoit Marty
parent d06e5c23cb
commit b104dba845
59 changed files with 117 additions and 262 deletions

View file

@ -92,9 +92,8 @@ fun DeveloperSettingsView(
@Composable
private fun ElementCallCategory(
state: DeveloperSettingsState,
modifier: Modifier = Modifier,
) {
PreferenceCategory(modifier = modifier, title = "Element Call", showDivider = true) {
PreferenceCategory(title = "Element Call", showDivider = true) {
val callUrlState = state.customElementCallBaseUrlState
fun isUsingDefaultUrl(value: String?): Boolean {
return value.isNullOrEmpty() || value == callUrlState.defaultUrl
@ -120,14 +119,12 @@ private fun ElementCallCategory(
@Composable
private fun FeatureListContent(
state: DeveloperSettingsState,
modifier: Modifier = Modifier
) {
fun onFeatureEnabled(feature: FeatureUiModel, isEnabled: Boolean) {
state.eventSink(DeveloperSettingsEvents.UpdateEnabledFeature(feature, isEnabled))
}
FeatureListView(
modifier = modifier,
features = state.features,
onCheckedChange = ::onFeatureEnabled,
)

View file

@ -141,14 +141,12 @@ fun ConfigureTracingView(
@Composable
private fun CrateListContent(
state: ConfigureTracingState,
modifier: Modifier = Modifier
) {
fun onLogLevelChange(target: Target, logLevel: LogLevel) {
state.eventSink(ConfigureTracingEvents.UpdateFilter(target, logLevel))
}
TargetAndLogLevelListView(
modifier = modifier,
data = state.targetsToLogLevel,
onLogLevelChange = ::onLogLevelChange,
)
@ -158,11 +156,8 @@ private fun CrateListContent(
private fun TargetAndLogLevelListView(
data: ImmutableMap<Target, LogLevel>,
onLogLevelChange: (Target, LogLevel) -> Unit,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier,
) {
Column {
data.forEach { item ->
fun onLogLevelChange(logLevel: LogLevel) {
onLogLevelChange(item.key, logLevel)
@ -182,10 +177,8 @@ private fun TargetAndLogLevelView(
target: Target,
logLevel: LogLevel,
onLogLevelChange: (LogLevel) -> Unit,
modifier: Modifier = Modifier
) {
ListItem(
modifier = modifier,
headlineContent = { Text(text = target.filter.takeIf { it.isNotEmpty() } ?: "(common)") },
trailingContent = ListItemContent.Custom {
LogLevelDropdownMenu(
@ -200,10 +193,9 @@ private fun TargetAndLogLevelView(
private fun LogLevelDropdownMenu(
logLevel: LogLevel,
onLogLevelChange: (LogLevel) -> Unit,
modifier: Modifier = Modifier,
) {
var expanded by remember { mutableStateOf(false) }
Box(modifier = modifier) {
Box {
DropdownMenuItem(
modifier = Modifier.widthIn(max = 120.dp),
text = { Text(text = logLevel.filter) },

View file

@ -99,7 +99,6 @@ private fun NotificationSettingsContentView(
// TODO We are removing the call notification toggle until support for call notifications has been added
// onCallsNotificationsChanged: (Boolean) -> Unit,
onInviteForMeNotificationsChanged: (Boolean) -> Unit,
modifier: Modifier = Modifier,
) {
val context = LocalContext.current
if (systemSettings.appNotificationsEnabled && !systemSettings.systemNotificationsEnabled) {
@ -117,7 +116,6 @@ private fun NotificationSettingsContentView(
}
PreferenceSwitch(
modifier = modifier,
title = stringResource(id = R.string.screen_notification_settings_enable_notifications),
isChecked = systemSettings.appNotificationsEnabled,
switchAlignment = Alignment.Top,
@ -182,10 +180,8 @@ private fun InvalidNotificationSettingsView(
showError: Boolean,
onContinueClicked: () -> Unit,
onDismissError: () -> Unit,
modifier: Modifier = Modifier
) {
DialogLikeBannerMolecule(
modifier = modifier,
title = stringResource(R.string.screen_notification_settings_configuration_mismatch),
content = stringResource(R.string.screen_notification_settings_configuration_mismatch_description),
onSubmitClicked = onContinueClicked,