Remove NavigationState.Space.
We do not have the concept of current space.
This commit is contained in:
parent
5cb5f5f1a4
commit
f93dfbdae4
10 changed files with 22 additions and 210 deletions
|
|
@ -10,7 +10,6 @@ package io.element.android.services.appnavstate.api
|
|||
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.core.SessionId
|
||||
import io.element.android.libraries.matrix.api.core.SpaceId
|
||||
import io.element.android.libraries.matrix.api.core.ThreadId
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
|
|
@ -23,9 +22,6 @@ interface AppNavigationStateService {
|
|||
fun onNavigateToSession(owner: String, sessionId: SessionId)
|
||||
fun onLeavingSession(owner: String)
|
||||
|
||||
fun onNavigateToSpace(owner: String, spaceId: SpaceId)
|
||||
fun onLeavingSpace(owner: String)
|
||||
|
||||
fun onNavigateToRoom(owner: String, roomId: RoomId)
|
||||
fun onLeavingRoom(owner: String)
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ package io.element.android.services.appnavstate.api
|
|||
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.core.SessionId
|
||||
import io.element.android.libraries.matrix.api.core.SpaceId
|
||||
import io.element.android.libraries.matrix.api.core.ThreadId
|
||||
|
||||
/**
|
||||
|
|
@ -29,17 +28,10 @@ sealed class NavigationState(open val owner: String) {
|
|||
val sessionId: SessionId,
|
||||
) : NavigationState(owner)
|
||||
|
||||
data class Space(
|
||||
override val owner: String,
|
||||
// Can be fake value, if no space is selected
|
||||
val spaceId: SpaceId,
|
||||
val parentSession: Session,
|
||||
) : NavigationState(owner)
|
||||
|
||||
data class Room(
|
||||
override val owner: String,
|
||||
val roomId: RoomId,
|
||||
val parentSpace: Space,
|
||||
val parentSession: Session,
|
||||
) : NavigationState(owner)
|
||||
|
||||
data class Thread(
|
||||
|
|
|
|||
|
|
@ -10,26 +10,14 @@ package io.element.android.services.appnavstate.api
|
|||
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.core.SessionId
|
||||
import io.element.android.libraries.matrix.api.core.SpaceId
|
||||
import io.element.android.libraries.matrix.api.core.ThreadId
|
||||
|
||||
fun NavigationState.currentSessionId(): SessionId? {
|
||||
return when (this) {
|
||||
NavigationState.Root -> null
|
||||
is NavigationState.Session -> sessionId
|
||||
is NavigationState.Space -> parentSession.sessionId
|
||||
is NavigationState.Room -> parentSpace.parentSession.sessionId
|
||||
is NavigationState.Thread -> parentRoom.parentSpace.parentSession.sessionId
|
||||
}
|
||||
}
|
||||
|
||||
fun NavigationState.currentSpaceId(): SpaceId? {
|
||||
return when (this) {
|
||||
NavigationState.Root -> null
|
||||
is NavigationState.Session -> null
|
||||
is NavigationState.Space -> spaceId
|
||||
is NavigationState.Room -> parentSpace.spaceId
|
||||
is NavigationState.Thread -> parentRoom.parentSpace.spaceId
|
||||
is NavigationState.Room -> parentSession.sessionId
|
||||
is NavigationState.Thread -> parentRoom.parentSession.sessionId
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -37,7 +25,6 @@ fun NavigationState.currentRoomId(): RoomId? {
|
|||
return when (this) {
|
||||
NavigationState.Root -> null
|
||||
is NavigationState.Session -> null
|
||||
is NavigationState.Space -> null
|
||||
is NavigationState.Room -> roomId
|
||||
is NavigationState.Thread -> parentRoom.roomId
|
||||
}
|
||||
|
|
@ -47,7 +34,6 @@ fun NavigationState.currentThreadId(): ThreadId? {
|
|||
return when (this) {
|
||||
NavigationState.Root -> null
|
||||
is NavigationState.Session -> null
|
||||
is NavigationState.Space -> null
|
||||
is NavigationState.Room -> null
|
||||
is NavigationState.Thread -> threadId
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue