From e65558958d37e68c4a163bbe426e864a778dbd9b Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Tue, 8 Sep 2020 10:45:00 +0300 Subject: [PATCH] Code review refactoring. --- .../java/im/vector/app/features/link/LinkHandlerActivity.kt | 6 ++---- vector/src/main/res/values/strings.xml | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/link/LinkHandlerActivity.kt b/vector/src/main/java/im/vector/app/features/link/LinkHandlerActivity.kt index d97ca3ebc1..daedc2fe84 100644 --- a/vector/src/main/java/im/vector/app/features/link/LinkHandlerActivity.kt +++ b/vector/src/main/java/im/vector/app/features/link/LinkHandlerActivity.kt @@ -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() } diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 06e9530ad5..d02a28bb19 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -2560,4 +2560,7 @@ Confirm PIN to disable PIN Can\'t open a room where you are banned from. Can\'t find this room. Make sure it exists. + + + The link was malformed