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
b8f3b66d0e
commit
87689d787e
250 changed files with 1698 additions and 1698 deletions
|
|
@ -35,9 +35,9 @@ class RoomDirectoryNode @AssistedInject constructor(
|
|||
@Assisted plugins: List<Plugin>,
|
||||
private val presenter: RoomDirectoryPresenter,
|
||||
) : Node(buildContext, plugins = plugins) {
|
||||
private fun onResultClicked(roomDescription: RoomDescription) {
|
||||
private fun onResultClick(roomDescription: RoomDescription) {
|
||||
plugins<RoomDirectoryEntryPoint.Callback>().forEach {
|
||||
it.onResultClicked(roomDescription)
|
||||
it.onResultClick(roomDescription)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -46,8 +46,8 @@ class RoomDirectoryNode @AssistedInject constructor(
|
|||
val state = presenter.present()
|
||||
RoomDirectoryView(
|
||||
state = state,
|
||||
onResultClicked = ::onResultClicked,
|
||||
onBackPressed = ::navigateUp,
|
||||
onResultClick = ::onResultClick,
|
||||
onBackClick = ::navigateUp,
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,19 +67,19 @@ import kotlinx.collections.immutable.ImmutableList
|
|||
@Composable
|
||||
fun RoomDirectoryView(
|
||||
state: RoomDirectoryState,
|
||||
onResultClicked: (RoomDescription) -> Unit,
|
||||
onBackPressed: () -> Unit,
|
||||
onResultClick: (RoomDescription) -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Scaffold(
|
||||
modifier = modifier,
|
||||
topBar = {
|
||||
RoomDirectoryTopBar(onBackPressed = onBackPressed)
|
||||
RoomDirectoryTopBar(onBackClick = onBackClick)
|
||||
},
|
||||
content = { padding ->
|
||||
RoomDirectoryContent(
|
||||
state = state,
|
||||
onResultClicked = onResultClicked,
|
||||
onResultClick = onResultClick,
|
||||
modifier = Modifier
|
||||
.padding(padding)
|
||||
.consumeWindowInsets(padding)
|
||||
|
|
@ -91,13 +91,13 @@ fun RoomDirectoryView(
|
|||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
private fun RoomDirectoryTopBar(
|
||||
onBackPressed: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
TopAppBar(
|
||||
modifier = modifier,
|
||||
navigationIcon = {
|
||||
BackButton(onClick = onBackPressed)
|
||||
BackButton(onClick = onBackClick)
|
||||
},
|
||||
title = {
|
||||
Text(
|
||||
|
|
@ -111,7 +111,7 @@ private fun RoomDirectoryTopBar(
|
|||
@Composable
|
||||
private fun RoomDirectoryContent(
|
||||
state: RoomDirectoryState,
|
||||
onResultClicked: (RoomDescription) -> Unit,
|
||||
onResultClick: (RoomDescription) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Column(modifier = modifier) {
|
||||
|
|
@ -125,7 +125,7 @@ private fun RoomDirectoryContent(
|
|||
roomDescriptions = state.roomDescriptions,
|
||||
displayLoadMoreIndicator = state.displayLoadMoreIndicator,
|
||||
displayEmptyState = state.displayEmptyState,
|
||||
onResultClicked = onResultClicked,
|
||||
onResultClick = onResultClick,
|
||||
onReachedLoadMore = { state.eventSink(RoomDirectoryEvents.LoadMore) },
|
||||
)
|
||||
}
|
||||
|
|
@ -136,7 +136,7 @@ private fun RoomDirectoryRoomList(
|
|||
roomDescriptions: ImmutableList<RoomDescription>,
|
||||
displayLoadMoreIndicator: Boolean,
|
||||
displayEmptyState: Boolean,
|
||||
onResultClicked: (RoomDescription) -> Unit,
|
||||
onResultClick: (RoomDescription) -> Unit,
|
||||
onReachedLoadMore: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
|
|
@ -145,7 +145,7 @@ private fun RoomDirectoryRoomList(
|
|||
RoomDirectoryRoomRow(
|
||||
roomDescription = roomDescription,
|
||||
onClick = {
|
||||
onResultClicked(roomDescription)
|
||||
onResultClick(roomDescription)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -287,7 +287,7 @@ private fun RoomDirectoryRoomRow(
|
|||
internal fun RoomDirectoryViewPreview(@PreviewParameter(RoomDirectoryStateProvider::class) state: RoomDirectoryState) = ElementPreview {
|
||||
RoomDirectoryView(
|
||||
state = state,
|
||||
onResultClicked = {},
|
||||
onBackPressed = {},
|
||||
onResultClick = {},
|
||||
onBackClick = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class RoomDirectoryViewTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `clicking on room item then onResultClicked lambda is called once`() {
|
||||
fun `clicking on room item then onResultClick lambda is called once`() {
|
||||
val eventsRecorder = EventsRecorder<RoomDirectoryEvents>()
|
||||
val state = aRoomDirectoryState(
|
||||
roomDescriptions = aRoomDescriptionList(),
|
||||
|
|
@ -64,7 +64,7 @@ class RoomDirectoryViewTest {
|
|||
ensureCalledOnceWithParam(clickedRoom) { callback ->
|
||||
rule.setRoomDirectoryView(
|
||||
state = state,
|
||||
onResultClicked = callback,
|
||||
onResultClick = callback,
|
||||
)
|
||||
rule.onNodeWithText(clickedRoom.computedName).performClick()
|
||||
}
|
||||
|
|
@ -84,14 +84,14 @@ class RoomDirectoryViewTest {
|
|||
|
||||
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setRoomDirectoryView(
|
||||
state: RoomDirectoryState,
|
||||
onBackPressed: () -> Unit = EnsureNeverCalled(),
|
||||
onResultClicked: (RoomDescription) -> Unit = EnsureNeverCalledWithParam(),
|
||||
onBackClick: () -> Unit = EnsureNeverCalled(),
|
||||
onResultClick: (RoomDescription) -> Unit = EnsureNeverCalledWithParam(),
|
||||
) {
|
||||
setContent {
|
||||
RoomDirectoryView(
|
||||
state = state,
|
||||
onResultClicked = onResultClicked,
|
||||
onBackPressed = onBackPressed,
|
||||
onResultClick = onResultClick,
|
||||
onBackClick = onBackClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue