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
|
|
@ -38,8 +38,8 @@ class LogoutNode @AssistedInject constructor(
|
|||
@Assisted plugins: List<Plugin>,
|
||||
private val presenter: LogoutPresenter,
|
||||
) : Node(buildContext, plugins = plugins) {
|
||||
private fun onChangeRecoveryKeyClicked() {
|
||||
plugins<LogoutEntryPoint.Callback>().forEach { it.onChangeRecoveryKeyClicked() }
|
||||
private fun onChangeRecoveryKeyClick() {
|
||||
plugins<LogoutEntryPoint.Callback>().forEach { it.onChangeRecoveryKeyClick() }
|
||||
}
|
||||
|
||||
private fun onSuccessLogout(activity: Activity, url: String?) {
|
||||
|
|
@ -55,9 +55,9 @@ class LogoutNode @AssistedInject constructor(
|
|||
val activity = LocalContext.current as Activity
|
||||
LogoutView(
|
||||
state = state,
|
||||
onChangeRecoveryKeyClicked = ::onChangeRecoveryKeyClicked,
|
||||
onChangeRecoveryKeyClick = ::onChangeRecoveryKeyClick,
|
||||
onSuccessLogout = { onSuccessLogout(activity, it) },
|
||||
onBackClicked = ::navigateUp,
|
||||
onBackClick = ::navigateUp,
|
||||
modifier = modifier,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,15 +51,15 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
@Composable
|
||||
fun LogoutView(
|
||||
state: LogoutState,
|
||||
onChangeRecoveryKeyClicked: () -> Unit,
|
||||
onBackClicked: () -> Unit,
|
||||
onChangeRecoveryKeyClick: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
onSuccessLogout: (logoutUrlResult: String?) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val eventSink = state.eventSink
|
||||
|
||||
FlowStepPage(
|
||||
onBackClicked = onBackClicked,
|
||||
onBackClick = onBackClick,
|
||||
title = title(state),
|
||||
subTitle = subtitle(state),
|
||||
iconVector = CompoundIcons.KeySolid(),
|
||||
|
|
@ -68,8 +68,8 @@ fun LogoutView(
|
|||
buttons = {
|
||||
Buttons(
|
||||
state = state,
|
||||
onChangeRecoveryKeyClicked = onChangeRecoveryKeyClicked,
|
||||
onLogoutClicked = {
|
||||
onChangeRecoveryKeyClick = onChangeRecoveryKeyClick,
|
||||
onLogoutClick = {
|
||||
eventSink(LogoutEvents.Logout(ignoreSdkError = false))
|
||||
}
|
||||
)
|
||||
|
|
@ -78,10 +78,10 @@ fun LogoutView(
|
|||
|
||||
LogoutActionDialog(
|
||||
state.logoutAction,
|
||||
onConfirmClicked = {
|
||||
onConfirmClick = {
|
||||
eventSink(LogoutEvents.Logout(ignoreSdkError = false))
|
||||
},
|
||||
onForceLogoutClicked = {
|
||||
onForceLogoutClick = {
|
||||
eventSink(LogoutEvents.Logout(ignoreSdkError = true))
|
||||
},
|
||||
onDismissDialog = {
|
||||
|
|
@ -124,15 +124,15 @@ private fun subtitle(state: LogoutState): String? {
|
|||
@Composable
|
||||
private fun ColumnScope.Buttons(
|
||||
state: LogoutState,
|
||||
onLogoutClicked: () -> Unit,
|
||||
onChangeRecoveryKeyClicked: () -> Unit,
|
||||
onLogoutClick: () -> Unit,
|
||||
onChangeRecoveryKeyClick: () -> Unit,
|
||||
) {
|
||||
val logoutAction = state.logoutAction
|
||||
if (state.isLastDevice) {
|
||||
OutlinedButton(
|
||||
text = stringResource(id = CommonStrings.common_settings),
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
onClick = onChangeRecoveryKeyClicked,
|
||||
onClick = onChangeRecoveryKeyClick,
|
||||
)
|
||||
}
|
||||
val signOutSubmitRes = when {
|
||||
|
|
@ -147,7 +147,7 @@ private fun ColumnScope.Buttons(
|
|||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.testTag(TestTags.signOut),
|
||||
onClick = onLogoutClicked,
|
||||
onClick = onLogoutClick,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -183,8 +183,8 @@ internal fun LogoutViewPreview(
|
|||
) = ElementPreview {
|
||||
LogoutView(
|
||||
state,
|
||||
onChangeRecoveryKeyClicked = {},
|
||||
onChangeRecoveryKeyClick = {},
|
||||
onSuccessLogout = {},
|
||||
onBackClicked = {},
|
||||
onBackClick = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ class DefaultDirectLogoutView @Inject constructor() : DirectLogoutView {
|
|||
val eventSink = state.eventSink
|
||||
LogoutActionDialog(
|
||||
state.logoutAction,
|
||||
onConfirmClicked = {
|
||||
onConfirmClick = {
|
||||
eventSink(DirectLogoutEvents.Logout(ignoreSdkError = false))
|
||||
},
|
||||
onForceLogoutClicked = {
|
||||
onForceLogoutClick = {
|
||||
eventSink(DirectLogoutEvents.Logout(ignoreSdkError = true))
|
||||
},
|
||||
onDismissDialog = {
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
@Composable
|
||||
fun LogoutActionDialog(
|
||||
state: AsyncAction<String?>,
|
||||
onConfirmClicked: () -> Unit,
|
||||
onForceLogoutClicked: () -> Unit,
|
||||
onConfirmClick: () -> Unit,
|
||||
onForceLogoutClick: () -> Unit,
|
||||
onDismissDialog: () -> Unit,
|
||||
onSuccessLogout: (String?) -> Unit,
|
||||
) {
|
||||
|
|
@ -40,7 +40,7 @@ fun LogoutActionDialog(
|
|||
Unit
|
||||
AsyncAction.Confirming ->
|
||||
LogoutConfirmationDialog(
|
||||
onSubmitClicked = onConfirmClicked,
|
||||
onSubmitClick = onConfirmClick,
|
||||
onDismiss = onDismissDialog
|
||||
)
|
||||
is AsyncAction.Loading ->
|
||||
|
|
@ -50,7 +50,7 @@ fun LogoutActionDialog(
|
|||
title = stringResource(id = CommonStrings.dialog_title_error),
|
||||
content = stringResource(id = CommonStrings.error_unknown),
|
||||
retryText = stringResource(id = CommonStrings.action_signout_anyway),
|
||||
onRetry = onForceLogoutClicked,
|
||||
onRetry = onForceLogoutClick,
|
||||
onDismiss = onDismissDialog,
|
||||
)
|
||||
is AsyncAction.Success -> {
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
|
||||
@Composable
|
||||
fun LogoutConfirmationDialog(
|
||||
onSubmitClicked: () -> Unit,
|
||||
onSubmitClick: () -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
) {
|
||||
ConfirmationDialog(
|
||||
title = stringResource(id = CommonStrings.action_signout),
|
||||
content = stringResource(id = R.string.screen_signout_confirmation_dialog_content),
|
||||
submitText = stringResource(id = CommonStrings.action_signout),
|
||||
onSubmitClicked = onSubmitClicked,
|
||||
onSubmitClick = onSubmitClick,
|
||||
onDismiss = onDismiss,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class LogoutViewTest {
|
|||
aLogoutState(
|
||||
eventSink = eventsRecorder
|
||||
),
|
||||
onBackClicked = callback,
|
||||
onBackClick = callback,
|
||||
)
|
||||
rule.pressBack()
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ class LogoutViewTest {
|
|||
isLastDevice = true,
|
||||
eventSink = eventsRecorder
|
||||
),
|
||||
onChangeRecoveryKeyClicked = callback,
|
||||
onChangeRecoveryKeyClick = callback,
|
||||
)
|
||||
rule.clickOn(CommonStrings.common_settings)
|
||||
}
|
||||
|
|
@ -138,15 +138,15 @@ class LogoutViewTest {
|
|||
|
||||
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setLogoutView(
|
||||
state: LogoutState,
|
||||
onChangeRecoveryKeyClicked: () -> Unit = EnsureNeverCalled(),
|
||||
onBackClicked: () -> Unit = EnsureNeverCalled(),
|
||||
onChangeRecoveryKeyClick: () -> Unit = EnsureNeverCalled(),
|
||||
onBackClick: () -> Unit = EnsureNeverCalled(),
|
||||
onSuccessLogout: (logoutUrlResult: String?) -> Unit = EnsureNeverCalledWithParam()
|
||||
) {
|
||||
setContent {
|
||||
LogoutView(
|
||||
state = state,
|
||||
onChangeRecoveryKeyClicked = onChangeRecoveryKeyClicked,
|
||||
onBackClicked = onBackClicked,
|
||||
onChangeRecoveryKeyClick = onChangeRecoveryKeyClick,
|
||||
onBackClick = onBackClick,
|
||||
onSuccessLogout = onSuccessLogout,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue