Add KDoc to the libraries/deeplink API interfaces

Document DeeplinkParser, DeepLinkCreator and InviteFriendsUseCase, including that
DeepLinkCreator.create silently ignores the deeper arguments once an outer one is
null.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benoit Marty
2026-08-14 10:28:47 +02:00
parent 055fe408a6
commit c0848cee9d
3 changed files with 24 additions and 0 deletions
@@ -13,6 +13,17 @@ 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.ThreadId
/**
* Builds the app's internal deep links, used to point a notification or a shortcut at a precise place in the app.
*/
fun interface DeepLinkCreator {
/**
* Builds a link to the most precise target the arguments allow, ignoring the deeper ones once an outer one is `null`.
*
* @param sessionId the session to open.
* @param roomId the room to open, or `null` to stop at the room list.
* @param threadId the thread to open within that room, or `null` for the main timeline.
* @param eventId the event to focus on, or `null` to open at the latest message.
*/
fun create(sessionId: SessionId, roomId: RoomId?, threadId: ThreadId?, eventId: EventId?): String
}
@@ -10,6 +10,13 @@ package io.element.android.libraries.deeplink.api
import android.content.Intent
/**
* Extracts the app's own deep link data from an incoming intent; see [DeepLinkCreator] for the other direction.
*/
fun interface DeeplinkParser {
/**
* @param intent the intent the app was started or resumed with.
* @return the session, room and event to open, or `null` when the intent is not one of the app's deep links.
*/
fun getFromIntent(intent: Intent): DeeplinkData?
}
@@ -10,6 +10,12 @@ package io.element.android.libraries.deeplink.api.usecase
import android.app.Activity
/**
* Opens the system share sheet with an invitation to install the app.
*/
fun interface InviteFriendsUseCase {
/**
* @param activity the activity the share sheet is shown from.
*/
fun execute(activity: Activity)
}