Invites : open room instead of invite list when clicking an invite notification

This commit is contained in:
ganfra 2024-04-16 13:20:43 +02:00
parent 3e13191153
commit 997c4606c6
12 changed files with 1 additions and 49 deletions

View file

@ -18,7 +18,3 @@ package io.element.android.libraries.deeplink
internal const val SCHEME = "elementx"
internal const val HOST = "open"
object DeepLinkPaths {
const val INVITE_LIST = "invites"
}

View file

@ -36,13 +36,4 @@ class DeepLinkCreator @Inject constructor() {
}
}
}
fun inviteList(sessionId: SessionId): String {
return buildString {
append("$SCHEME://$HOST/")
append(sessionId.value)
append("/")
append(DeepLinkPaths.INVITE_LIST)
}
}
}

View file

@ -30,6 +30,4 @@ sealed interface DeeplinkData {
/** The target is a room, with the given [sessionId], [roomId] and optionally a [threadId]. */
data class Room(override val sessionId: SessionId, val roomId: RoomId, val threadId: ThreadId?) : DeeplinkData
/** The target is the invites list, with the given [sessionId]. */
data class InviteList(override val sessionId: SessionId) : DeeplinkData
}

View file

@ -39,7 +39,6 @@ class DeeplinkParser @Inject constructor() {
return when (val screenPathComponent = pathBits.elementAtOrNull(1)) {
null -> DeeplinkData.Root(sessionId)
DeepLinkPaths.INVITE_LIST -> DeeplinkData.InviteList(sessionId)
else -> {
val roomId = screenPathComponent.let(::RoomId)
val threadId = pathBits.elementAtOrNull(2)?.let(::ThreadId)

View file

@ -34,10 +34,4 @@ class DeepLinkCreatorTest {
.isEqualTo("elementx://open/@alice:server.org/!aRoomId:domain/\$aThreadId")
}
@Test
fun inviteList() {
val sut = DeepLinkCreator()
assertThat(sut.inviteList(A_SESSION_ID))
.isEqualTo("elementx://open/@alice:server.org/invites")
}
}

View file

@ -36,8 +36,6 @@ class DeeplinkParserTest {
"elementx://open/@alice:server.org/!aRoomId:domain"
const val A_URI_WITH_ROOM_WITH_THREAD =
"elementx://open/@alice:server.org/!aRoomId:domain/\$aThreadId"
const val A_URI_FOR_INVITE_LIST =
"elementx://open/@alice:server.org/invites"
}
private val sut = DeeplinkParser()
@ -50,8 +48,6 @@ class DeeplinkParserTest {
.isEqualTo(DeeplinkData.Room(A_SESSION_ID, A_ROOM_ID, null))
assertThat(sut.getFromIntent(createIntent(A_URI_WITH_ROOM_WITH_THREAD)))
.isEqualTo(DeeplinkData.Room(A_SESSION_ID, A_ROOM_ID, A_THREAD_ID))
assertThat(sut.getFromIntent(createIntent(A_URI_FOR_INVITE_LIST)))
.isEqualTo(DeeplinkData.InviteList(A_SESSION_ID))
}
@Test