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:
parent
0ba5537082
commit
37d9a9f5a9
250 changed files with 1698 additions and 1698 deletions
|
|
@ -163,7 +163,7 @@ class LoginFlowNode @AssistedInject constructor(
|
|||
backstack.singleTop(NavTarget.ConfirmAccountProvider)
|
||||
}
|
||||
|
||||
override fun onOtherClicked() {
|
||||
override fun onOtherClick() {
|
||||
backstack.push(NavTarget.SearchAccountProvider)
|
||||
}
|
||||
}
|
||||
|
|
@ -197,7 +197,7 @@ class LoginFlowNode @AssistedInject constructor(
|
|||
loginFormState = navTarget.loginFormState,
|
||||
)
|
||||
val callback = object : WaitListNode.Callback {
|
||||
override fun onCancelClicked() {
|
||||
override fun onCancelClick() {
|
||||
navigateUp()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
|||
@Composable
|
||||
fun ChangeServerView(
|
||||
state: ChangeServerState,
|
||||
onLearnMoreClicked: () -> Unit,
|
||||
onDone: () -> Unit,
|
||||
onLearnMoreClick: () -> Unit,
|
||||
onSuccess: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val eventSink = state.eventSink
|
||||
|
|
@ -53,8 +53,8 @@ fun ChangeServerView(
|
|||
is ChangeServerError.SlidingSyncAlert -> {
|
||||
SlidingSyncNotSupportedDialog(
|
||||
modifier = modifier,
|
||||
onLearnMoreClicked = {
|
||||
onLearnMoreClicked()
|
||||
onLearnMoreClick = {
|
||||
onLearnMoreClick()
|
||||
eventSink.invoke(ChangeServerEvents.ClearError)
|
||||
},
|
||||
onDismiss = {
|
||||
|
|
@ -66,9 +66,9 @@ fun ChangeServerView(
|
|||
}
|
||||
is AsyncData.Loading -> ProgressDialog()
|
||||
is AsyncData.Success -> {
|
||||
val latestOnDone by rememberUpdatedState(onDone)
|
||||
val latestOnSuccess by rememberUpdatedState(onSuccess)
|
||||
LaunchedEffect(state.changeServerAction) {
|
||||
latestOnDone()
|
||||
latestOnSuccess()
|
||||
}
|
||||
}
|
||||
AsyncData.Uninitialized -> Unit
|
||||
|
|
@ -80,7 +80,7 @@ fun ChangeServerView(
|
|||
internal fun ChangeServerViewPreview(@PreviewParameter(ChangeServerStateProvider::class) state: ChangeServerState) = ElementPreview {
|
||||
ChangeServerView(
|
||||
state = state,
|
||||
onLearnMoreClicked = {},
|
||||
onDone = {},
|
||||
onLearnMoreClick = {},
|
||||
onSuccess = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
|
||||
@Composable
|
||||
internal fun SlidingSyncNotSupportedDialog(
|
||||
onLearnMoreClicked: () -> Unit,
|
||||
onLearnMoreClick: () -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
|
|
@ -35,8 +35,8 @@ internal fun SlidingSyncNotSupportedDialog(
|
|||
modifier = modifier,
|
||||
onDismiss = onDismiss,
|
||||
submitText = stringResource(CommonStrings.action_learn_more),
|
||||
onSubmitClicked = onLearnMoreClicked,
|
||||
onCancelClicked = onDismiss,
|
||||
onSubmitClick = onLearnMoreClick,
|
||||
onCancelClick = onDismiss,
|
||||
title = stringResource(CommonStrings.dialog_title_error),
|
||||
content = stringResource(R.string.screen_change_server_error_no_sliding_sync_message),
|
||||
)
|
||||
|
|
@ -46,7 +46,7 @@ internal fun SlidingSyncNotSupportedDialog(
|
|||
@Composable
|
||||
internal fun SlidingSyncNotSupportedDialogPreview() = ElementPreview {
|
||||
SlidingSyncNotSupportedDialog(
|
||||
onLearnMoreClicked = {},
|
||||
onLearnMoreClick = {},
|
||||
onDismiss = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,15 +37,15 @@ class ChangeAccountProviderNode @AssistedInject constructor(
|
|||
) : Node(buildContext, plugins = plugins) {
|
||||
interface Callback : Plugin {
|
||||
fun onDone()
|
||||
fun onOtherClicked()
|
||||
fun onOtherClick()
|
||||
}
|
||||
|
||||
private fun onDone() {
|
||||
plugins<Callback>().forEach { it.onDone() }
|
||||
}
|
||||
|
||||
private fun onOtherClicked() {
|
||||
plugins<Callback>().forEach { it.onOtherClicked() }
|
||||
private fun onOtherClick() {
|
||||
plugins<Callback>().forEach { it.onOtherClick() }
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
@ -55,10 +55,10 @@ class ChangeAccountProviderNode @AssistedInject constructor(
|
|||
ChangeAccountProviderView(
|
||||
state = state,
|
||||
modifier = modifier,
|
||||
onBackPressed = ::navigateUp,
|
||||
onLearnMoreClicked = { openLearnMorePage(context) },
|
||||
onDone = ::onDone,
|
||||
onOtherProviderClicked = ::onOtherClicked,
|
||||
onBackClick = ::navigateUp,
|
||||
onLearnMoreClick = { openLearnMorePage(context) },
|
||||
onSuccess = ::onDone,
|
||||
onOtherProviderClick = ::onOtherClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ import io.element.android.libraries.designsystem.theme.components.TopAppBar
|
|||
@Composable
|
||||
fun ChangeAccountProviderView(
|
||||
state: ChangeAccountProviderState,
|
||||
onBackPressed: () -> Unit,
|
||||
onLearnMoreClicked: () -> Unit,
|
||||
onDone: () -> Unit,
|
||||
onOtherProviderClicked: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
onLearnMoreClick: () -> Unit,
|
||||
onSuccess: () -> Unit,
|
||||
onOtherProviderClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Scaffold(
|
||||
|
|
@ -66,7 +66,7 @@ fun ChangeAccountProviderView(
|
|||
topBar = {
|
||||
TopAppBar(
|
||||
title = {},
|
||||
navigationIcon = { BackButton(onClick = onBackPressed) }
|
||||
navigationIcon = { BackButton(onClick = onBackClick) }
|
||||
)
|
||||
}
|
||||
) { padding ->
|
||||
|
|
@ -111,14 +111,14 @@ fun ChangeAccountProviderView(
|
|||
url = "",
|
||||
title = stringResource(id = R.string.screen_change_account_provider_other),
|
||||
),
|
||||
onClick = onOtherProviderClicked
|
||||
onClick = onOtherProviderClick
|
||||
)
|
||||
Spacer(Modifier.height(32.dp))
|
||||
}
|
||||
ChangeServerView(
|
||||
state = state.changeServerState,
|
||||
onLearnMoreClicked = onLearnMoreClicked,
|
||||
onDone = onDone,
|
||||
onLearnMoreClick = onLearnMoreClick,
|
||||
onSuccess = onSuccess,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -129,9 +129,9 @@ fun ChangeAccountProviderView(
|
|||
internal fun ChangeAccountProviderViewPreview(@PreviewParameter(ChangeAccountProviderStateProvider::class) state: ChangeAccountProviderState) = ElementPreview {
|
||||
ChangeAccountProviderView(
|
||||
state = state,
|
||||
onBackPressed = { },
|
||||
onLearnMoreClicked = { },
|
||||
onDone = { },
|
||||
onOtherProviderClicked = { },
|
||||
onBackClick = { },
|
||||
onLearnMoreClick = { },
|
||||
onSuccess = { },
|
||||
onOtherProviderClick = { },
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ class ConfirmAccountProviderNode @AssistedInject constructor(
|
|||
state = state,
|
||||
modifier = modifier,
|
||||
onOidcDetails = ::onOidcDetails,
|
||||
onLoginPasswordNeeded = ::onLoginPasswordNeeded,
|
||||
onNeedLoginPassword = ::onLoginPasswordNeeded,
|
||||
onChange = ::onChangeAccountProvider,
|
||||
onLearnMoreClicked = { openLearnMorePage(context) },
|
||||
onLearnMoreClick = { openLearnMorePage(context) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
fun ConfirmAccountProviderView(
|
||||
state: ConfirmAccountProviderState,
|
||||
onOidcDetails: (OidcDetails) -> Unit,
|
||||
onLoginPasswordNeeded: () -> Unit,
|
||||
onLearnMoreClicked: () -> Unit,
|
||||
onNeedLoginPassword: () -> Unit,
|
||||
onLearnMoreClick: () -> Unit,
|
||||
onChange: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
|
|
@ -118,8 +118,8 @@ fun ConfirmAccountProviderView(
|
|||
)
|
||||
}
|
||||
is ChangeServerError.SlidingSyncAlert -> {
|
||||
SlidingSyncNotSupportedDialog(onLearnMoreClicked = {
|
||||
onLearnMoreClicked()
|
||||
SlidingSyncNotSupportedDialog(onLearnMoreClick = {
|
||||
onLearnMoreClick()
|
||||
eventSink(ConfirmAccountProviderEvents.ClearError)
|
||||
}, onDismiss = {
|
||||
eventSink(ConfirmAccountProviderEvents.ClearError)
|
||||
|
|
@ -131,7 +131,7 @@ fun ConfirmAccountProviderView(
|
|||
is AsyncData.Success -> {
|
||||
when (val loginFlowState = state.loginFlow.data) {
|
||||
is LoginFlow.OidcFlow -> onOidcDetails(loginFlowState.oidcDetails)
|
||||
LoginFlow.PasswordLogin -> onLoginPasswordNeeded()
|
||||
LoginFlow.PasswordLogin -> onNeedLoginPassword()
|
||||
}
|
||||
}
|
||||
AsyncData.Uninitialized -> Unit
|
||||
|
|
@ -147,8 +147,8 @@ internal fun ConfirmAccountProviderViewPreview(
|
|||
ConfirmAccountProviderView(
|
||||
state = state,
|
||||
onOidcDetails = {},
|
||||
onLoginPasswordNeeded = {},
|
||||
onLearnMoreClicked = {},
|
||||
onNeedLoginPassword = {},
|
||||
onLearnMoreClick = {},
|
||||
onChange = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class LoginPasswordNode @AssistedInject constructor(
|
|||
LoginPasswordView(
|
||||
state = state,
|
||||
modifier = modifier,
|
||||
onBackPressed = ::navigateUp,
|
||||
onBackClick = ::navigateUp,
|
||||
onWaitListError = ::onWaitListError,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
@Composable
|
||||
fun LoginPasswordView(
|
||||
state: LoginPasswordState,
|
||||
onBackPressed: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
onWaitListError: (LoginFormState) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
|
|
@ -103,7 +103,7 @@ fun LoginPasswordView(
|
|||
topBar = {
|
||||
TopAppBar(
|
||||
title = {},
|
||||
navigationIcon = { BackButton(onClick = onBackPressed) },
|
||||
navigationIcon = { BackButton(onClick = onBackClick) },
|
||||
)
|
||||
}
|
||||
) { padding ->
|
||||
|
|
@ -310,7 +310,7 @@ private fun LoginErrorDialog(error: Throwable, onDismiss: () -> Unit) {
|
|||
internal fun LoginPasswordViewPreview(@PreviewParameter(LoginPasswordStateProvider::class) state: LoginPasswordState) = ElementPreview {
|
||||
LoginPasswordView(
|
||||
state = state,
|
||||
onBackPressed = {},
|
||||
onBackClick = {},
|
||||
onWaitListError = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ class SearchAccountProviderNode @AssistedInject constructor(
|
|||
SearchAccountProviderView(
|
||||
state = state,
|
||||
modifier = modifier,
|
||||
onBackPressed = ::navigateUp,
|
||||
onLearnMoreClicked = { openLearnMorePage(context) },
|
||||
onDone = ::onDone,
|
||||
onBackClick = ::navigateUp,
|
||||
onLearnMoreClick = { openLearnMorePage(context) },
|
||||
onSuccess = ::onDone,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,9 +77,9 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
@Composable
|
||||
fun SearchAccountProviderView(
|
||||
state: SearchAccountProviderState,
|
||||
onBackPressed: () -> Unit,
|
||||
onLearnMoreClicked: () -> Unit,
|
||||
onDone: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
onLearnMoreClick: () -> Unit,
|
||||
onSuccess: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val eventSink = state.eventSink
|
||||
|
|
@ -88,7 +88,7 @@ fun SearchAccountProviderView(
|
|||
topBar = {
|
||||
TopAppBar(
|
||||
title = {},
|
||||
navigationIcon = { BackButton(onClick = onBackPressed) }
|
||||
navigationIcon = { BackButton(onClick = onBackClick) }
|
||||
)
|
||||
}
|
||||
) { padding ->
|
||||
|
|
@ -188,8 +188,8 @@ fun SearchAccountProviderView(
|
|||
}
|
||||
ChangeServerView(
|
||||
state = state.changeServerState,
|
||||
onLearnMoreClicked = onLearnMoreClicked,
|
||||
onDone = onDone,
|
||||
onLearnMoreClick = onLearnMoreClick,
|
||||
onSuccess = onSuccess,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -214,8 +214,8 @@ private fun HomeserverData.toAccountProvider(): AccountProvider {
|
|||
internal fun SearchAccountProviderViewPreview(@PreviewParameter(SearchAccountProviderStateProvider::class) state: SearchAccountProviderState) = ElementPreview {
|
||||
SearchAccountProviderView(
|
||||
state = state,
|
||||
onBackPressed = {},
|
||||
onLearnMoreClicked = {},
|
||||
onDone = {},
|
||||
onBackClick = {},
|
||||
onLearnMoreClick = {},
|
||||
onSuccess = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@ class WaitListNode @AssistedInject constructor(
|
|||
private val presenter = presenterFactory.create(inputs.loginFormState)
|
||||
|
||||
interface Callback : Plugin {
|
||||
fun onCancelClicked()
|
||||
fun onCancelClick()
|
||||
}
|
||||
|
||||
private fun onCancelClicked() {
|
||||
plugins<Callback>().forEach { it.onCancelClicked() }
|
||||
private fun onCancelClick() {
|
||||
plugins<Callback>().forEach { it.onCancelClick() }
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
@ -54,7 +54,7 @@ class WaitListNode @AssistedInject constructor(
|
|||
val state = presenter.present()
|
||||
WaitListView(
|
||||
state = state,
|
||||
onCancelClicked = ::onCancelClicked,
|
||||
onCancelClick = ::onCancelClick,
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
@Composable
|
||||
fun WaitListView(
|
||||
state: WaitListState,
|
||||
onCancelClicked: () -> Unit,
|
||||
onCancelClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
OnLifecycleEvent { _, event ->
|
||||
|
|
@ -57,7 +57,7 @@ fun WaitListView(
|
|||
else -> Unit
|
||||
}
|
||||
}
|
||||
WaitListContent(state, onCancelClicked, modifier)
|
||||
WaitListContent(state, onCancelClick, modifier)
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
|
@ -81,7 +81,7 @@ private fun WaitListError(state: WaitListState) {
|
|||
@Composable
|
||||
private fun WaitListContent(
|
||||
state: WaitListState,
|
||||
onCancelClicked: () -> Unit,
|
||||
onCancelClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Box(
|
||||
|
|
@ -109,7 +109,7 @@ private fun WaitListContent(
|
|||
title = title,
|
||||
subtitle = subtitle,
|
||||
) {
|
||||
OverallContent(state, onCancelClicked)
|
||||
OverallContent(state, onCancelClick)
|
||||
}
|
||||
WaitListError(state)
|
||||
}
|
||||
|
|
@ -118,14 +118,14 @@ private fun WaitListContent(
|
|||
@Composable
|
||||
private fun OverallContent(
|
||||
state: WaitListState,
|
||||
onCancelClicked: () -> Unit,
|
||||
onCancelClick: () -> Unit,
|
||||
) {
|
||||
Box(modifier = Modifier.fillMaxSize()) {
|
||||
if (state.loginAction !is AsyncData.Success) {
|
||||
CompositionLocalProvider(LocalContentColor provides ElementTheme.colors.textOnSolidPrimary) {
|
||||
TextButton(
|
||||
text = stringResource(CommonStrings.action_cancel),
|
||||
onClick = onCancelClicked,
|
||||
onClick = onCancelClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -147,6 +147,6 @@ private fun OverallContent(
|
|||
internal fun WaitListViewPreview(@PreviewParameter(WaitListStateProvider::class) state: WaitListState) = ElementPreview {
|
||||
WaitListView(
|
||||
state = state,
|
||||
onCancelClicked = {},
|
||||
onCancelClick = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue