parent
882d5577a7
commit
53fe12bdda
7 changed files with 49 additions and 4 deletions
|
|
@ -382,6 +382,10 @@ class LoggedInFlowNode(
|
|||
}
|
||||
is NavTarget.Room -> {
|
||||
val joinedRoomCallback = object : JoinedRoomLoadedFlowNode.Callback {
|
||||
override fun onDone() {
|
||||
backstack.pop()
|
||||
}
|
||||
|
||||
override fun navigateToRoom(roomId: RoomId, serverNames: List<String>, clearBackStack: Boolean) {
|
||||
lifecycleScope.launch {
|
||||
attachRoom(roomIdOrAlias = roomId.toRoomIdOrAlias(), serverNames = serverNames, clearBackstack = clearBackStack)
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ class JoinedRoomLoadedFlowNode(
|
|||
plugins = plugins,
|
||||
), DependencyInjectionGraphOwner {
|
||||
interface Callback : Plugin {
|
||||
fun onDone()
|
||||
fun navigateToRoom(roomId: RoomId, serverNames: List<String>, clearBackStack: Boolean = false)
|
||||
fun handlePermalinkClick(data: PermalinkData, pushToBackstack: Boolean)
|
||||
fun navigateToGlobalNotificationSettings()
|
||||
|
|
@ -142,6 +143,10 @@ class JoinedRoomLoadedFlowNode(
|
|||
|
||||
private fun createRoomDetailsNode(buildContext: BuildContext, initialTarget: RoomDetailsEntryPoint.InitialTarget): Node {
|
||||
val callback = object : RoomDetailsEntryPoint.Callback {
|
||||
override fun onDone() {
|
||||
callback.onDone()
|
||||
}
|
||||
|
||||
override fun navigateToGlobalNotificationSettings() {
|
||||
callback.navigateToGlobalNotificationSettings()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ interface RoomDetailsEntryPoint : FeatureEntryPoint {
|
|||
data class Params(val initialElement: InitialTarget) : NodeInputs
|
||||
|
||||
interface Callback : Plugin {
|
||||
fun onDone()
|
||||
fun navigateToGlobalNotificationSettings()
|
||||
fun navigateToDeveloperSettings()
|
||||
fun navigateToRoom(roomId: RoomId, serverNames: List<String>, clearBackStack: Boolean = false)
|
||||
|
|
|
|||
|
|
@ -176,6 +176,10 @@ class RoomDetailsFlowNode(
|
|||
return when (navTarget) {
|
||||
NavTarget.RoomDetails -> {
|
||||
val roomDetailsCallback = object : RoomDetailsNode.Callback {
|
||||
override fun navigateBack() {
|
||||
callback.onDone()
|
||||
}
|
||||
|
||||
override fun navigateToRoomMemberList() {
|
||||
backstack.push(NavTarget.RoomMemberList)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright (c) 2026 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.features.roomdetails.impl
|
||||
|
||||
interface RoomDetailsNavigator {
|
||||
fun onDone()
|
||||
}
|
||||
|
|
@ -42,12 +42,13 @@ import io.element.android.libraries.androidutils.R as AndroidUtilsR
|
|||
class RoomDetailsNode(
|
||||
@Assisted buildContext: BuildContext,
|
||||
@Assisted plugins: List<Plugin>,
|
||||
private val presenter: RoomDetailsPresenter,
|
||||
presenterFactory: RoomDetailsPresenter.Factory,
|
||||
private val room: BaseRoom,
|
||||
private val analyticsService: AnalyticsService,
|
||||
private val leaveRoomRenderer: LeaveRoomRenderer,
|
||||
) : Node(buildContext, plugins = plugins) {
|
||||
) : Node(buildContext, plugins = plugins), RoomDetailsNavigator {
|
||||
interface Callback : Plugin {
|
||||
fun navigateBack()
|
||||
fun navigateToRoomMemberList()
|
||||
fun navigateToInviteMembers()
|
||||
fun navigateToRoomDetailsEdit()
|
||||
|
|
@ -65,6 +66,7 @@ class RoomDetailsNode(
|
|||
fun navigateToSelectNewOwnersWhenLeaving()
|
||||
}
|
||||
|
||||
private val presenter = presenterFactory.create(this)
|
||||
private val callback: Callback = callback()
|
||||
|
||||
init {
|
||||
|
|
@ -144,4 +146,8 @@ class RoomDetailsNode(
|
|||
}
|
||||
)
|
||||
}
|
||||
|
||||
override fun onDone() {
|
||||
callback.navigateBack()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@ import androidx.compose.runtime.getValue
|
|||
import androidx.compose.runtime.produceState
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import dev.zacsweers.metro.Inject
|
||||
import dev.zacsweers.metro.Assisted
|
||||
import dev.zacsweers.metro.AssistedFactory
|
||||
import dev.zacsweers.metro.AssistedInject
|
||||
import im.vector.app.features.analytics.plan.Interaction
|
||||
import io.element.android.features.knockrequests.api.KnockRequestPermissions
|
||||
import io.element.android.features.knockrequests.api.knockRequestPermissions
|
||||
|
|
@ -59,8 +61,9 @@ import kotlinx.coroutines.flow.launchIn
|
|||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@Inject
|
||||
@AssistedInject
|
||||
class RoomDetailsPresenter(
|
||||
@Assisted private val navigator: RoomDetailsNavigator,
|
||||
private val client: MatrixClient,
|
||||
private val room: JoinedRoom,
|
||||
private val notificationSettingsService: NotificationSettingsService,
|
||||
|
|
@ -74,6 +77,13 @@ class RoomDetailsPresenter(
|
|||
private val sessionPreferencesStore: SessionPreferencesStore,
|
||||
private val notificationCleaner: NotificationCleaner,
|
||||
) : Presenter<RoomDetailsState> {
|
||||
@AssistedFactory
|
||||
interface Factory {
|
||||
fun create(
|
||||
navigator: RoomDetailsNavigator,
|
||||
): RoomDetailsPresenter
|
||||
}
|
||||
|
||||
@Composable
|
||||
override fun present(): RoomDetailsState {
|
||||
val scope = rememberCoroutineScope()
|
||||
|
|
@ -278,5 +288,8 @@ class RoomDetailsPresenter(
|
|||
.onSuccess {
|
||||
analyticsService.captureInteraction(name = Interaction.Name.MobileRoomListRoomContextMenuUnreadToggle)
|
||||
}
|
||||
.onSuccess {
|
||||
navigator.onDone()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue