mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Some formatting and cleanup
This commit is contained in:
parent
f086f0e083
commit
820531120a
2 changed files with 17 additions and 10 deletions
|
@ -112,7 +112,10 @@ class PermalinkHandler @Inject constructor(private val activeSessionHolder: Acti
|
|||
private fun PermalinkData.RoomLink.getRoomId(): Single<Optional<String>> {
|
||||
val session = activeSessionHolder.getSafeActiveSession()
|
||||
return if (isRoomAlias && session != null) {
|
||||
session.rx().getRoomIdByAlias(roomIdOrAlias, true).map { it.getOrNull()?.roomId.toOptional() }.subscribeOn(Schedulers.io())
|
||||
session.rx()
|
||||
.getRoomIdByAlias(roomIdOrAlias, true)
|
||||
.map { it.getOrNull()?.roomId.toOptional() }
|
||||
.subscribeOn(Schedulers.io())
|
||||
} else {
|
||||
Single.just(Optional.from(roomIdOrAlias))
|
||||
}
|
||||
|
|
|
@ -144,15 +144,19 @@ class UserListViewModel @AssistedInject constructor(@Assisted initialState: User
|
|||
}
|
||||
.onErrorReturn { Optional.empty() }
|
||||
|
||||
Single.zip(searchObservable, profileObservable, { searchResults, optionalProfile ->
|
||||
val profile = optionalProfile.getOrNull() ?: return@zip searchResults
|
||||
val searchContainsProfile = searchResults.indexOfFirst { it.userId == profile.userId } != -1
|
||||
if (searchContainsProfile) {
|
||||
searchResults
|
||||
} else {
|
||||
listOf(profile) + searchResults
|
||||
}
|
||||
})
|
||||
Single.zip(
|
||||
searchObservable,
|
||||
profileObservable,
|
||||
{ searchResults, optionalProfile ->
|
||||
val profile = optionalProfile.getOrNull() ?: return@zip searchResults
|
||||
val searchContainsProfile = searchResults.any { it.userId == profile.userId }
|
||||
if (searchContainsProfile) {
|
||||
searchResults
|
||||
} else {
|
||||
listOf(profile) + searchResults
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
stream.toAsync {
|
||||
|
|
Loading…
Reference in a new issue