mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 09:25:49 +03:00
confirming to reviewed PR
This commit is contained in:
parent
618ab6c862
commit
f45338be4c
2 changed files with 7 additions and 4 deletions
1
changelog.d/3735.bugfix
Normal file
1
changelog.d/3735.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
the element-based domain permalinks (e.g. https://app.element.io/#/user/@chagai95:matrix.org) don't have the mxid in the first param (like matrix.to does - https://matrix.to/#/@chagai95:matrix.org) but rather in the second after /user/ so /user/mxid
|
|
@ -21,12 +21,14 @@ import android.net.UrlQuerySanitizer
|
|||
import org.matrix.android.sdk.api.MatrixPatterns
|
||||
|
||||
/**
|
||||
* This class turns an uri to a [PermalinkData]
|
||||
* This class turns a uri to a [PermalinkData]
|
||||
* element-based domains (e.g. https://app.element.io/#/user/@chagai95:matrix.org) permalinks or matrix.to permalinks (e.g. https://matrix.to/#/@chagai95:matrix.org)
|
||||
*
|
||||
*/
|
||||
object PermalinkParser {
|
||||
|
||||
/**
|
||||
* Turns an uri string to a [PermalinkData]
|
||||
* Turns a uri string to a [PermalinkData]
|
||||
*/
|
||||
fun parse(uriString: String): PermalinkData {
|
||||
val uri = Uri.parse(uriString)
|
||||
|
@ -34,7 +36,7 @@ object PermalinkParser {
|
|||
}
|
||||
|
||||
/**
|
||||
* Turns an uri to a [PermalinkData]
|
||||
* Turns a uri to a [PermalinkData]
|
||||
*/
|
||||
fun parse(uri: Uri): PermalinkData {
|
||||
if (!uri.toString().startsWith(PermalinkService.MATRIX_TO_URL_BASE)) {
|
||||
|
@ -53,7 +55,7 @@ object PermalinkParser {
|
|||
.filter { it.isNotEmpty() }
|
||||
.take(2)
|
||||
|
||||
// the base domain permalinks don't have the mxid in the first param but in the second after /user/mxid
|
||||
// the the element-based domain permalinks (e.g. https://app.element.io/#/user/@chagai95:matrix.org) don't have the mxid in the first param (like matrix.to does - https://matrix.to/#/@chagai95:matrix.org) but rather in the second after /user/ so /user/mxid
|
||||
var identifier = params.getOrNull(0);
|
||||
if (identifier.equals("user")) {
|
||||
identifier = params.getOrNull(1)
|
||||
|
|
Loading…
Reference in a new issue