Code review refactoring.

This commit is contained in:
Onuray Sahin 2020-09-08 10:45:00 +03:00
parent c41c91b0e7
commit e65558958d
2 changed files with 5 additions and 4 deletions

View file

@ -94,9 +94,7 @@ class LinkHandlerActivity : VectorBaseActivity() {
val path = SUPPORTED_PATHS.find { it in uri.toString() } ?: return null
// 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
return uri
.toString()
.replace(uri.toString().substring(0, uri.toString().indexOf(path) + path.length), "https://$MATRIX_TO_HOST/#")
return "https://$MATRIX_TO_HOST/#" + uri.toString().substringAfter(path)
}
private fun startPermalinkHandler(permalink: String) {
@ -105,7 +103,7 @@ class LinkHandlerActivity : VectorBaseActivity() {
.observeOn(AndroidSchedulers.mainThread())
.subscribe { isHandled ->
if (!isHandled) {
toast(R.string.permalink_malformed)
toast(R.string.universal_link_malformed)
}
finish()
}

View file

@ -2560,4 +2560,7 @@
<string name="auth_pin_confirm_to_disable_title">Confirm PIN to disable PIN</string>
<string name="error_opening_banned_room">Can\'t open a room where you are banned from.</string>
<string name="room_error_not_found">Can\'t find this room. Make sure it exists.</string>
<!-- Universal link -->
<string name="universal_link_malformed">The link was malformed</string>
</resources>