mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 03:16:02 +03:00
Fix permalink handling
whole link base url was compared to supported hosts instead of the host part only
This commit is contained in:
parent
0d6e8bdeb3
commit
1341094545
2 changed files with 4 additions and 5 deletions
|
@ -273,14 +273,13 @@ class HomeActivity :
|
|||
val resolvedLink = when {
|
||||
// Element custom scheme is not handled by the sdk, convert it to matrix.to link for compatibility
|
||||
deepLink.startsWith(MATRIX_TO_CUSTOM_SCHEME_URL_BASE) -> {
|
||||
val let = when {
|
||||
when {
|
||||
deepLink.startsWith(USER_LINK_PREFIX) -> deepLink.substring(USER_LINK_PREFIX.length)
|
||||
deepLink.startsWith(ROOM_LINK_PREFIX) -> deepLink.substring(ROOM_LINK_PREFIX.length)
|
||||
else -> null
|
||||
}?.let { permalinkId ->
|
||||
activeSessionHolder.getSafeActiveSession()?.permalinkService()?.createPermalink(permalinkId)
|
||||
}
|
||||
let
|
||||
}
|
||||
else -> deepLink
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ package im.vector.app.features.permalink
|
|||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import androidx.core.net.toUri
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.di.ActiveSessionHolder
|
||||
import im.vector.app.core.extensions.isIgnored
|
||||
|
@ -118,9 +119,8 @@ class PermalinkHandler @Inject constructor(private val activeSessionHolder: Acti
|
|||
|
||||
private fun isPermalinkSupported(context: Context, url: String): Boolean {
|
||||
return url.startsWith(PermalinkService.MATRIX_TO_URL_BASE) ||
|
||||
context.resources.getStringArray(R.array.permalink_supported_hosts).any {
|
||||
url.startsWith(it)
|
||||
}
|
||||
context.resources.getStringArray(R.array.permalink_supported_hosts)
|
||||
.any { url.toUri().host == it }
|
||||
}
|
||||
|
||||
private suspend fun PermalinkData.RoomLink.getRoomId(): String? {
|
||||
|
|
Loading…
Reference in a new issue