Dagger: makes sure to not remove an active component when navigating

This commit is contained in:
ganfra 2023-06-09 23:04:33 +02:00
parent e3d939726c
commit f57a2a694d
4 changed files with 16 additions and 13 deletions

View file

@ -68,13 +68,13 @@ class MainNode(
}
private val roomFlowNodeCallback = object : RoomFlowNode.LifecycleCallback {
override fun onFlowCreated(room: MatrixRoom) {
override fun onFlowCreated(owner: String, room: MatrixRoom) {
val component = bindings<RoomComponent.ParentBindings>().roomComponentBuilder().room(room).build()
mainDaggerComponentOwner.addComponent(room.roomId.value, component)
mainDaggerComponentOwner.addComponent(owner, component)
}
override fun onFlowReleased(room: MatrixRoom) {
mainDaggerComponentOwner.removeComponent(room.roomId.value)
override fun onFlowReleased(owner: String, room: MatrixRoom) {
mainDaggerComponentOwner.removeComponent(owner)
}
}