Rename module roomlist to home
This commit is contained in:
parent
fe9fbe894c
commit
60083ad5ea
95 changed files with 192 additions and 184 deletions
|
|
@ -49,11 +49,11 @@ import io.element.android.features.createroom.api.CreateRoomEntryPoint
|
|||
import io.element.android.features.ftue.api.FtueEntryPoint
|
||||
import io.element.android.features.ftue.api.state.FtueService
|
||||
import io.element.android.features.ftue.api.state.FtueState
|
||||
import io.element.android.features.home.api.HomeEntryPoint
|
||||
import io.element.android.features.logout.api.LogoutEntryPoint
|
||||
import io.element.android.features.preferences.api.PreferencesEntryPoint
|
||||
import io.element.android.features.roomdirectory.api.RoomDescription
|
||||
import io.element.android.features.roomdirectory.api.RoomDirectoryEntryPoint
|
||||
import io.element.android.features.roomlist.api.RoomListEntryPoint
|
||||
import io.element.android.features.securebackup.api.SecureBackupEntryPoint
|
||||
import io.element.android.features.share.api.ShareEntryPoint
|
||||
import io.element.android.features.userprofile.api.UserProfileEntryPoint
|
||||
|
|
@ -90,6 +90,15 @@ import java.time.Duration
|
|||
import java.time.Instant
|
||||
import java.util.Optional
|
||||
import java.util.UUID
|
||||
import kotlin.collections.List
|
||||
import kotlin.collections.any
|
||||
import kotlin.collections.emptyList
|
||||
import kotlin.collections.first
|
||||
import kotlin.collections.forEach
|
||||
import kotlin.collections.listOf
|
||||
import kotlin.collections.mapNotNull
|
||||
import kotlin.collections.plus
|
||||
import kotlin.collections.setOf
|
||||
import kotlin.time.Duration.Companion.minutes
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
import kotlin.time.toKotlinDuration
|
||||
|
|
@ -98,7 +107,7 @@ import kotlin.time.toKotlinDuration
|
|||
class LoggedInFlowNode @AssistedInject constructor(
|
||||
@Assisted buildContext: BuildContext,
|
||||
@Assisted plugins: List<Plugin>,
|
||||
private val roomListEntryPoint: RoomListEntryPoint,
|
||||
private val homeEntryPoint: HomeEntryPoint,
|
||||
private val preferencesEntryPoint: PreferencesEntryPoint,
|
||||
private val createRoomEntryPoint: CreateRoomEntryPoint,
|
||||
private val appNavigationStateService: AppNavigationStateService,
|
||||
|
|
@ -160,7 +169,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
|||
// Otherwise, the RoomList UI may be incorrectly displayed on top
|
||||
withTimeout(5.seconds) {
|
||||
backstack.elements.first { elements ->
|
||||
elements.any { it.key.navTarget == NavTarget.RoomList }
|
||||
elements.any { it.key.navTarget == NavTarget.Home }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +194,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
|||
when (ftueState) {
|
||||
is FtueState.Unknown -> Unit // Nothing to do
|
||||
is FtueState.Incomplete -> backstack.safeRoot(NavTarget.Ftue)
|
||||
is FtueState.Complete -> backstack.safeRoot(NavTarget.RoomList)
|
||||
is FtueState.Complete -> backstack.safeRoot(NavTarget.Home)
|
||||
}
|
||||
}
|
||||
.launchIn(lifecycleScope)
|
||||
|
|
@ -212,7 +221,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
|||
data object LoggedInPermanent : NavTarget
|
||||
|
||||
@Parcelize
|
||||
data object RoomList : NavTarget
|
||||
data object Home : NavTarget
|
||||
|
||||
@Parcelize
|
||||
data class Room(
|
||||
|
|
@ -269,8 +278,8 @@ class LoggedInFlowNode @AssistedInject constructor(
|
|||
}
|
||||
createNode<LoggedInNode>(buildContext, listOf(callback))
|
||||
}
|
||||
NavTarget.RoomList -> {
|
||||
val callback = object : RoomListEntryPoint.Callback {
|
||||
NavTarget.Home -> {
|
||||
val callback = object : HomeEntryPoint.Callback {
|
||||
override fun onRoomClick(roomId: RoomId) {
|
||||
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias()))
|
||||
}
|
||||
|
|
@ -303,7 +312,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
|||
backstack.push(NavTarget.LogoutForNativeSlidingSyncMigrationNeeded)
|
||||
}
|
||||
}
|
||||
roomListEntryPoint
|
||||
homeEntryPoint
|
||||
.nodeBuilder(this, buildContext)
|
||||
.callback(callback)
|
||||
.build()
|
||||
|
|
@ -487,7 +496,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
|||
clearBackstack: Boolean,
|
||||
) {
|
||||
waitForNavTargetAttached { navTarget ->
|
||||
navTarget is NavTarget.RoomList
|
||||
navTarget is NavTarget.Home
|
||||
}
|
||||
attachChild<RoomFlowNode> {
|
||||
val roomNavTarget = NavTarget.Room(
|
||||
|
|
@ -504,7 +513,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
|||
|
||||
suspend fun attachUser(userId: UserId) {
|
||||
waitForNavTargetAttached { navTarget ->
|
||||
navTarget is NavTarget.RoomList
|
||||
navTarget is NavTarget.Home
|
||||
}
|
||||
attachChild<Node> {
|
||||
backstack.push(
|
||||
|
|
@ -517,7 +526,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
|||
|
||||
internal suspend fun attachIncomingShare(intent: Intent) {
|
||||
waitForNavTargetAttached { navTarget ->
|
||||
navTarget is NavTarget.RoomList
|
||||
navTarget is NavTarget.Home
|
||||
}
|
||||
attachChild<Node> {
|
||||
backstack.push(
|
||||
|
|
@ -555,7 +564,7 @@ private class AttachRoomOperation(
|
|||
return if (clearBackstack) {
|
||||
// Makes sure the room list target is alone in the backstack and stashed
|
||||
elements.mapNotNull { element ->
|
||||
if (element.key.navTarget == LoggedInFlowNode.NavTarget.RoomList) {
|
||||
if (element.key.navTarget == LoggedInFlowNode.NavTarget.Home) {
|
||||
element.transitionTo(STASHED, this)
|
||||
} else {
|
||||
null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue