Code quality and remove reference to DefaultMatrixToConverter.SUPPORTED_PATHS in MatrixToConverter
This commit is contained in:
parent
fda5df848d
commit
67a9765bd3
4 changed files with 10 additions and 9 deletions
|
|
@ -110,10 +110,10 @@ class MessagesNode @AssistedInject constructor(
|
||||||
) {
|
) {
|
||||||
when (val permalink = permalinkParser.parse(Uri.parse(url))) {
|
when (val permalink = permalinkParser.parse(Uri.parse(url))) {
|
||||||
is PermalinkData.UserLink -> {
|
is PermalinkData.UserLink -> {
|
||||||
onUserDataClicked(UserId(permalink.userId))
|
callback?.onUserDataClicked(UserId(permalink.userId))
|
||||||
}
|
}
|
||||||
is PermalinkData.RoomLink -> {
|
is PermalinkData.RoomLink -> {
|
||||||
// TODO: Implement room link handling
|
// TODO Implement room link handling
|
||||||
}
|
}
|
||||||
is PermalinkData.FallbackLink,
|
is PermalinkData.FallbackLink,
|
||||||
is PermalinkData.RoomEmailInviteLink -> {
|
is PermalinkData.RoomEmailInviteLink -> {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import android.net.Uri
|
||||||
interface MatrixToConverter {
|
interface MatrixToConverter {
|
||||||
/**
|
/**
|
||||||
* Try to convert a URL from an element web instance or from a client permalink to a matrix.to url.
|
* Try to convert a URL from an element web instance or from a client permalink to a matrix.to url.
|
||||||
* To be successfully converted, URL path should contain one of the [DefaultMatrixToConverter.SUPPORTED_PATHS].
|
|
||||||
* Examples:
|
* Examples:
|
||||||
* - https://riot.im/develop/#/room/#element-android:matrix.org -> https://matrix.to/#/#element-android:matrix.org
|
* - https://riot.im/develop/#/room/#element-android:matrix.org -> https://matrix.to/#/#element-android:matrix.org
|
||||||
* - https://app.element.io/#/room/#element-android:matrix.org -> https://matrix.to/#/#element-android:matrix.org
|
* - https://app.element.io/#/room/#element-android:matrix.org -> https://matrix.to/#/#element-android:matrix.org
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,11 @@ class DefaultMatrixToConverter @Inject constructor() : MatrixToConverter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val SUPPORTED_PATHS = listOf(
|
companion object {
|
||||||
"/#/room/",
|
val SUPPORTED_PATHS = listOf(
|
||||||
"/#/user/",
|
"/#/room/",
|
||||||
"/#/group/"
|
"/#/user/",
|
||||||
)
|
"/#/group/"
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import io.element.android.libraries.matrix.api.permalink.PermalinkData
|
||||||
import io.element.android.libraries.matrix.api.permalink.PermalinkParser
|
import io.element.android.libraries.matrix.api.permalink.PermalinkParser
|
||||||
|
|
||||||
class FakePermalinkParser(
|
class FakePermalinkParser(
|
||||||
private var result: () -> PermalinkData = { throw Exception("Not implemented") }
|
private var result: () -> PermalinkData = { TODO("Not implemented") }
|
||||||
) : PermalinkParser {
|
) : PermalinkParser {
|
||||||
fun givenResult(result: PermalinkData) {
|
fun givenResult(result: PermalinkData) {
|
||||||
this.result = { result }
|
this.result = { result }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue