Permalink: move supported hosts to config file

This commit is contained in:
Florian Renaud 2021-09-09 17:17:11 +02:00 committed by Florian Renaud
parent a73f0a9fa8
commit 21d0a28150
2 changed files with 12 additions and 10 deletions

View File

@ -63,7 +63,7 @@ class LinkHandlerActivity : VectorBaseActivity<ActivityProgressBinding>() {
if (uri.getQueryParameter(LoginConfig.CONFIG_HS_PARAMETER) != null) { if (uri.getQueryParameter(LoginConfig.CONFIG_HS_PARAMETER) != null) {
handleConfigUrl(uri) handleConfigUrl(uri)
} else if (SUPPORTED_HOSTS.contains(uri.host)) { } else if (resources.getStringArray(R.array.permalink_supported_hosts).contains(uri.host)) {
handleSupportedHostUrl(uri) handleSupportedHostUrl(uri)
} else { } else {
// Other links are not yet handled, but should not come here (manifest configuration error?) // Other links are not yet handled, but should not come here (manifest configuration error?)
@ -175,15 +175,6 @@ class LinkHandlerActivity : VectorBaseActivity<ActivityProgressBinding>() {
} }
companion object { companion object {
private val SUPPORTED_HOSTS = listOf(
// Regular Element Web instance
"app.element.io",
// Other known instances of Element Web
"develop.element.io",
"staging.element.io",
// Previous Web instance, kept for compatibility reason
"riot.im"
)
private val SUPPORTED_PATHS = listOf( private val SUPPORTED_PATHS = listOf(
"/#/room/", "/#/room/",
"/#/user/", "/#/user/",

View File

@ -26,4 +26,15 @@
<item>gitter.im</item> <item>gitter.im</item>
</string-array> </string-array>
<!-- Permalink config -->
<string-array name="permalink_supported_hosts" translatable="false">
<!-- Regular Element Web instance -->
<item>app.element.io</item>
<!-- Other known instances of Element Web -->
<item>develop.element.io</item>
<item>staging.element.io</item>
<!-- Previous Web instance, kept for compatibility reason -->
<item>riot.im</item>
</string-array>
</resources> </resources>