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 0310b5df0f
commit 1435f8d9f3
6 changed files with 11 additions and 11 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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