Handle new mobile config url.

This commit is contained in:
Onuray Sahin 2020-09-07 12:19:34 +03:00
parent f186a00515
commit 4d7cd7319b
4 changed files with 5 additions and 4 deletions

View file

@ -1,3 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
adb shell am start -a android.intent.action.VIEW -d "https://riot.im/config/config?hs_url=https%3A%2F%2Fmozilla-test.modular.im" adb shell am start -a android.intent.action.VIEW -d "https://mobile.element.io?hs_url=https%3A%2F%2Fmozilla-test.modular.im"

View file

@ -145,6 +145,7 @@
<data android:scheme="https" /> <data android:scheme="https" />
<data android:host="riot.im" /> <data android:host="riot.im" />
<data android:host="app.element.io" /> <data android:host="app.element.io" />
<data android:host="mobile.element.io" />
</intent-filter> </intent-filter>
</activity> </activity>

View file

@ -59,7 +59,7 @@ class LinkHandlerActivity : VectorBaseActivity() {
return return
} }
if (uri.path == PATH_CONFIG) { if (uri.getQueryParameter(CONFIG_PATH_HS_PARAMETER) != null) {
handleConfigUrl(uri) handleConfigUrl(uri)
} else if (SUPPORTED_HOSTS.contains(uri.host)) { } else if (SUPPORTED_HOSTS.contains(uri.host)) {
handleSupportedHostUrl(uri) handleSupportedHostUrl(uri)
@ -155,7 +155,7 @@ class LinkHandlerActivity : VectorBaseActivity() {
} }
companion object { companion object {
private const val PATH_CONFIG = "/config/config" private const val CONFIG_PATH_HS_PARAMETER = "hs_url"
private val SUPPORTED_HOSTS = arrayOf("app.element.io", "riot.im") private val SUPPORTED_HOSTS = arrayOf("app.element.io", "riot.im")
private val SUPPORTED_PATHS = arrayOf("/#/room", "/#/user", "/#/group") private val SUPPORTED_PATHS = arrayOf("/#/room", "/#/user", "/#/group")

View file

@ -22,7 +22,7 @@ import kotlinx.android.parcel.Parcelize
/** /**
* Parameters extracted from a configuration url * Parameters extracted from a configuration url
* Ex: https://riot.im/config/config?hs_url=https%3A%2F%2Fexample.modular.im&is_url=https%3A%2F%2Fcustom.identity.org * Ex: https://mobile.element.io?hs_url=https%3A%2F%2Fexample.modular.im&is_url=https%3A%2F%2Fcustom.identity.org
* *
* Note: On RiotX, identityServerUrl will never be used, so is declared private. Keep it for compatibility reason. * Note: On RiotX, identityServerUrl will never be used, so is declared private. Keep it for compatibility reason.
*/ */