Rename eventId to focusedEventId for clarity.

This commit is contained in:
Benoit Marty 2024-04-17 23:06:54 +02:00 committed by Benoit Marty
parent 986f20b526
commit 1fcaf902e0
6 changed files with 11 additions and 11 deletions

View file

@ -22,7 +22,7 @@ import kotlinx.parcelize.Parcelize
sealed interface RoomNavigationTarget : Parcelable {
@Parcelize
data class Messages(val eventId: EventId? = null) : RoomNavigationTarget
data class Messages(val focusedEventId: EventId? = null) : RoomNavigationTarget
@Parcelize
data object Details : RoomNavigationTarget

View file

@ -66,7 +66,7 @@ class JoinedRoomLoadedFlowNode @AssistedInject constructor(
) : BaseFlowNode<JoinedRoomLoadedFlowNode.NavTarget>(
backstack = BackStack(
initialElement = when (val input = plugins.filterIsInstance(Inputs::class.java).first().initialElement) {
is RoomNavigationTarget.Messages -> NavTarget.Messages(input.eventId)
is RoomNavigationTarget.Messages -> NavTarget.Messages(input.focusedEventId)
RoomNavigationTarget.Details -> NavTarget.RoomDetails
RoomNavigationTarget.NotificationSettings -> NavTarget.RoomNotificationSettings
},
@ -161,7 +161,7 @@ class JoinedRoomLoadedFlowNode @AssistedInject constructor(
}
}
messagesEntryPoint.nodeBuilder(this, buildContext)
.params(MessagesEntryPoint.Params(navTarget.eventId))
.params(MessagesEntryPoint.Params(navTarget.focusedEventId))
.callback(callback)
.build()
}
@ -179,7 +179,7 @@ class JoinedRoomLoadedFlowNode @AssistedInject constructor(
sealed interface NavTarget : Parcelable {
@Parcelize
data class Messages(val eventId: EventId? = null) : NavTarget
data class Messages(val focusedEventId: EventId? = null) : NavTarget
@Parcelize
data object RoomDetails : NavTarget

View file

@ -35,7 +35,7 @@ interface MessagesEntryPoint : FeatureEntryPoint {
}
data class Params(
val eventId: EventId?,
val focusedEventId: EventId?,
)
interface Callback : Plugin {

View file

@ -32,7 +32,7 @@ class DefaultMessagesEntryPoint @Inject constructor() : MessagesEntryPoint {
return object : MessagesEntryPoint.NodeBuilder {
override fun params(params: MessagesEntryPoint.Params): MessagesEntryPoint.NodeBuilder {
plugins += MessagesNode.Inputs(eventId = params.eventId)
plugins += MessagesNode.Inputs(focusedEventId = params.focusedEventId)
return this
}

View file

@ -81,7 +81,7 @@ class MessagesFlowNode @AssistedInject constructor(
private val createPollEntryPoint: CreatePollEntryPoint,
) : BaseFlowNode<MessagesFlowNode.NavTarget>(
backstack = BackStack(
initialElement = NavTarget.Messages(plugins.filterIsInstance<Inputs>().firstOrNull()?.eventId),
initialElement = NavTarget.Messages(plugins.filterIsInstance<Inputs>().firstOrNull()?.focusedEventId),
savedStateMap = buildContext.savedStateMap,
),
overlay = Overlay(
@ -90,7 +90,7 @@ class MessagesFlowNode @AssistedInject constructor(
buildContext = buildContext,
plugins = plugins
) {
data class Inputs(val eventId: EventId?) : NodeInputs
data class Inputs(val focusedEventId: EventId?) : NodeInputs
sealed interface NavTarget : Parcelable {
@Parcelize
@ -98,7 +98,7 @@ class MessagesFlowNode @AssistedInject constructor(
@Parcelize
data class Messages(
val eventId: EventId? = null,
val focusedEventId: EventId? = null,
) : NavTarget
@Parcelize
@ -192,7 +192,7 @@ class MessagesFlowNode @AssistedInject constructor(
}
}
val params = MessagesNode.Inputs(
eventId = navTarget.eventId,
focusedEventId = navTarget.focusedEventId,
)
createNode<MessagesNode>(buildContext, listOf(callback, params))
}

View file

@ -69,7 +69,7 @@ class MessagesNode @AssistedInject constructor(
private val callback = plugins<Callback>().firstOrNull()
// TODO Handle navigation to the Event
data class Inputs(val eventId: EventId?) : NodeInputs
data class Inputs(val focusedEventId: EventId?) : NodeInputs
interface Callback : Plugin {
fun onRoomDetailsClicked()