mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 16:10:00 +00:00
Rename callbacks for clarity and consistency
This commit is contained in:
+4
-4
@@ -68,16 +68,16 @@ class CreateRoomFlowNode @AssistedInject constructor(
|
||||
backstack.push(NavTarget.NewRoom)
|
||||
}
|
||||
|
||||
override fun onOpenRoom(roomId: RoomId) {
|
||||
plugins<CreateRoomEntryPoint.Callback>().forEach { it.onOpenRoom(roomId) }
|
||||
override fun onStartChatSuccess(roomId: RoomId) {
|
||||
plugins<CreateRoomEntryPoint.Callback>().forEach { it.onSuccess(roomId) }
|
||||
}
|
||||
}
|
||||
createNode<CreateRoomRootNode>(context = buildContext, plugins = listOf(callback))
|
||||
}
|
||||
NavTarget.NewRoom -> {
|
||||
val callback = object : ConfigureRoomNode.Callback {
|
||||
override fun onRoomCreated(roomId: RoomId) {
|
||||
plugins<CreateRoomEntryPoint.Callback>().forEach { it.onOpenRoom(roomId) }
|
||||
override fun onCreateRoomSuccess(roomId: RoomId) {
|
||||
plugins<CreateRoomEntryPoint.Callback>().forEach { it.onSuccess(roomId) }
|
||||
}
|
||||
}
|
||||
createNode<ConfigureRoomFlowNode>(context = buildContext, plugins = listOf(callback))
|
||||
|
||||
+4
-4
@@ -36,12 +36,12 @@ class ConfigureRoomNode @AssistedInject constructor(
|
||||
) : Node(buildContext, plugins = plugins) {
|
||||
|
||||
interface Callback : Plugin {
|
||||
fun onRoomCreated(roomId: RoomId)
|
||||
fun onCreateRoomSuccess(roomId: RoomId)
|
||||
}
|
||||
|
||||
private val callback = object : Callback {
|
||||
override fun onRoomCreated(roomId: RoomId) {
|
||||
plugins<Callback>().forEach { it.onRoomCreated(roomId) }
|
||||
override fun onCreateRoomSuccess(roomId: RoomId) {
|
||||
plugins<Callback>().forEach { it.onCreateRoomSuccess(roomId) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class ConfigureRoomNode @AssistedInject constructor(
|
||||
state = state,
|
||||
modifier = modifier,
|
||||
onBackPressed = this::navigateUp,
|
||||
onRoomCreated = callback::onRoomCreated
|
||||
onRoomCreated = callback::onCreateRoomSuccess
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -37,7 +37,7 @@ class CreateRoomRootNode @AssistedInject constructor(
|
||||
|
||||
interface Callback : Plugin {
|
||||
fun onCreateNewRoom()
|
||||
fun onOpenRoom(roomId: RoomId)
|
||||
fun onStartChatSuccess(roomId: RoomId)
|
||||
}
|
||||
|
||||
private val callback = object : Callback {
|
||||
@@ -45,8 +45,8 @@ class CreateRoomRootNode @AssistedInject constructor(
|
||||
plugins<Callback>().forEach { it.onCreateNewRoom() }
|
||||
}
|
||||
|
||||
override fun onOpenRoom(roomId: RoomId) {
|
||||
plugins<Callback>().forEach { it.onOpenRoom(roomId) }
|
||||
override fun onStartChatSuccess(roomId: RoomId) {
|
||||
plugins<Callback>().forEach { it.onStartChatSuccess(roomId) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class CreateRoomRootNode @AssistedInject constructor(
|
||||
modifier = modifier,
|
||||
onClosePressed = this::navigateUp,
|
||||
onNewRoomClicked = callback::onCreateNewRoom,
|
||||
onOpenDM = callback::onOpenRoom,
|
||||
onOpenDM = callback::onStartChatSuccess,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user