PermalinkService

interface PermalinkService

Useful methods to create permalink (like matrix.to links or client permalinks). See org.matrix.android.sdk.api.MatrixConfiguration.clientPermalinkBaseUrl to setup a custom permalink base url.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
enum SpanTemplateType : Enum<PermalinkService.SpanTemplateType>

Functions

Link copied to clipboard
abstract fun createMentionSpanTemplate(type: PermalinkService.SpanTemplateType, forceMatrixTo: Boolean = false): String

Creates a HTML or Markdown mention span template. Can be used to replace a mention with a permalink to mentioned user. Ex: "%2\$s" or "%2\$s"

Link copied to clipboard
abstract fun createPermalink(id: String, forceMatrixTo: Boolean = false): String?

Creates a permalink for an id (can be a user Id, etc.). For a roomId, consider using createRoomPermalink Ex: "https://matrix.to/#/@benoit:matrix.org"

abstract fun createPermalink(event: Event, forceMatrixTo: Boolean = false): String?

Creates a permalink for an event. Ex: "https://matrix.to/#/!nbzmcXAqpxBXjAdgoX:matrix.org/$1531497316352799BevdV:matrix.org"

abstract fun createPermalink(    roomId: String,     eventId: String,     forceMatrixTo: Boolean = false): String

Creates a permalink for an event. If you have an event you can use createPermalink Ex: "https://matrix.to/#/!nbzmcXAqpxBXjAdgoX:matrix.org/$1531497316352799BevdV:matrix.org?via=matrix.org"

Link copied to clipboard
abstract fun createRoomPermalink(    roomId: String,     viaServers: List<String>? = null,     forceMatrixTo: Boolean = false): String?

Creates a permalink for a roomId, including the via parameters.

Link copied to clipboard
abstract fun getLinkedId(url: String): String?

Extract the linked id from the universal link.

Link copied to clipboard
abstract fun isPermalinkSupported(supportedHosts: Array<String>, url: String): Boolean

Check if the url is a permalink. It must be a matrix.to link or a link with host provided by the string-array permalink_supported_hosts in the config file