From 91ba17f71bfab66ad4f400ff9bba815e78557f98 Mon Sep 17 00:00:00 2001 From: Valere Date: Wed, 22 Sep 2021 10:43:39 +0200 Subject: [PATCH] Code review --- .../app/features/userdirectory/UserListViewModel.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/userdirectory/UserListViewModel.kt b/vector/src/main/java/im/vector/app/features/userdirectory/UserListViewModel.kt index 8cf8437183..dd045f5d32 100644 --- a/vector/src/main/java/im/vector/app/features/userdirectory/UserListViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/userdirectory/UserListViewModel.kt @@ -101,9 +101,7 @@ class UserListViewModel @AssistedInject constructor(@Assisted initialState: User } private fun cleanISURL(url: String?): String? { - return if (url?.startsWith("https://") == true) { - url.substring("https://".length) - } else url + return url?.removePrefix("https://") } override fun onCleared() { @@ -186,15 +184,13 @@ class UserListViewModel @AssistedInject constructor(@Assisted initialState: User displayName = json[ProfileService.DISPLAY_NAME_KEY] as? String, avatarUrl = json[ProfileService.AVATAR_URL_KEY] as? String ) - ).toOptional() + ) } .onErrorResumeNext { - Single.just(ThreePidUser(email = search, user = User(foundThreePid.matrixId)).toOptional()) + Single.just(ThreePidUser(email = search, user = User(foundThreePid.matrixId))) } - } ?: Single.just(ThreePidUser(email = search, user = null).toOptional()) + } ?: Single.just(ThreePidUser(email = search, user = null)) } - .map { it.getOrNull() } - stream.toAsync { copy(matchingEmail = it) }