Lambda parameters in a composable function should be in present tense, not past tense.

https://mrmans0n.github.io/compose-rules/rules/#naming-parameters-properly
This commit is contained in:
Benoit Marty 2024-05-29 10:48:29 +02:00
parent 0ba5537082
commit 37d9a9f5a9
250 changed files with 1698 additions and 1698 deletions

View file

@ -115,7 +115,7 @@ class LockScreenSettingsFlowNode @AssistedInject constructor(
}
NavTarget.Settings -> {
val callback = object : LockScreenSettingsNode.Callback {
override fun onChangePinClicked() {
override fun onChangePinClick() {
backstack.push(NavTarget.SetupPin)
}
}

View file

@ -34,11 +34,11 @@ class LockScreenSettingsNode @AssistedInject constructor(
private val presenter: LockScreenSettingsPresenter,
) : Node(buildContext, plugins = plugins) {
interface Callback : Plugin {
fun onChangePinClicked()
fun onChangePinClick()
}
private fun onChangePinClicked() {
plugins<Callback>().forEach { it.onChangePinClicked() }
private fun onChangePinClick() {
plugins<Callback>().forEach { it.onChangePinClick() }
}
@Composable
@ -46,8 +46,8 @@ class LockScreenSettingsNode @AssistedInject constructor(
val state = presenter.present()
LockScreenSettingsView(
state = state,
onBackPressed = this::navigateUp,
onChangePinClicked = this::onChangePinClicked,
onBackClick = this::navigateUp,
onChangePinClick = this::onChangePinClick,
modifier = modifier,
)
}

View file

@ -34,19 +34,19 @@ import io.element.android.libraries.designsystem.preview.PreviewsDayNight
@Composable
fun LockScreenSettingsView(
state: LockScreenSettingsState,
onChangePinClicked: () -> Unit,
onBackPressed: () -> Unit,
onChangePinClick: () -> Unit,
onBackClick: () -> Unit,
modifier: Modifier = Modifier,
) {
PreferencePage(
title = stringResource(id = io.element.android.libraries.ui.strings.R.string.common_screen_lock),
onBackPressed = onBackPressed,
onBackClick = onBackClick,
modifier = modifier
) {
PreferenceCategory(showTopDivider = false) {
PreferenceText(
title = stringResource(id = R.string.screen_app_lock_settings_change_pin),
onClick = onChangePinClicked
onClick = onChangePinClick
)
PreferenceDivider()
if (state.showRemovePinOption) {
@ -74,7 +74,7 @@ fun LockScreenSettingsView(
ConfirmationDialog(
title = stringResource(id = R.string.screen_app_lock_settings_remove_pin_alert_title),
content = stringResource(id = R.string.screen_app_lock_settings_remove_pin_alert_message),
onSubmitClicked = {
onSubmitClick = {
state.eventSink(LockScreenSettingsEvents.ConfirmRemovePin)
},
onDismiss = {
@ -92,8 +92,8 @@ internal fun LockScreenSettingsViewPreview(
ElementPreview {
LockScreenSettingsView(
state = state,
onChangePinClicked = {},
onBackPressed = {},
onChangePinClick = {},
onBackClick = {},
)
}
}

View file

@ -49,8 +49,8 @@ fun SetupBiometricView(
},
footer = {
SetupBiometricFooter(
onAllowClicked = { state.eventSink(SetupBiometricEvents.AllowBiometric) },
onSkipClicked = { state.eventSink(SetupBiometricEvents.UsePin) }
onAllowClick = { state.eventSink(SetupBiometricEvents.AllowBiometric) },
onSkipClick = { state.eventSink(SetupBiometricEvents.UsePin) }
)
},
)
@ -68,18 +68,18 @@ private fun SetupBiometricHeader() {
@Composable
private fun SetupBiometricFooter(
onAllowClicked: () -> Unit,
onSkipClicked: () -> Unit,
onAllowClick: () -> Unit,
onSkipClick: () -> Unit,
) {
ButtonColumnMolecule {
val biometricAuth = stringResource(id = R.string.screen_app_lock_biometric_authentication)
Button(
text = stringResource(id = R.string.screen_app_lock_setup_biometric_unlock_allow_title, biometricAuth),
onClick = onAllowClicked
onClick = onAllowClick
)
TextButton(
text = stringResource(id = R.string.screen_app_lock_setup_biometric_unlock_skip),
onClick = onSkipClicked
onClick = onSkipClick
)
}
}

View file

@ -37,7 +37,7 @@ class SetupPinNode @AssistedInject constructor(
val state = presenter.present()
SetupPinView(
state = state,
onBackClicked = this::navigateUp,
onBackClick = this::navigateUp,
modifier = modifier
)
}

View file

@ -52,7 +52,7 @@ import io.element.android.libraries.designsystem.theme.components.TopAppBar
@Composable
fun SetupPinView(
state: SetupPinState,
onBackClicked: () -> Unit,
onBackClick: () -> Unit,
modifier: Modifier = Modifier,
) {
Scaffold(
@ -60,7 +60,7 @@ fun SetupPinView(
topBar = {
TopAppBar(
navigationIcon = {
BackButton(onClick = onBackClicked)
BackButton(onClick = onBackClick)
},
title = {}
)
@ -154,7 +154,7 @@ internal fun SetupPinViewPreview(@PreviewParameter(SetupPinStateProvider::class)
ElementPreview {
SetupPinView(
state = state,
onBackClicked = {},
onBackClick = {},
)
}
}

View file

@ -192,7 +192,7 @@ private fun SignOutPrompt(
ConfirmationDialog(
title = stringResource(id = R.string.screen_app_lock_signout_alert_title),
content = stringResource(id = R.string.screen_app_lock_signout_alert_message),
onSubmitClicked = onSignOut,
onSubmitClick = onSignOut,
onDismiss = onDismiss,
)
} else {