mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 20:06:51 +03:00
Safe call to awaitCallback
This commit is contained in:
parent
6486b9e5cd
commit
bca24c0198
1 changed files with 3 additions and 2 deletions
|
@ -16,12 +16,13 @@
|
||||||
|
|
||||||
package im.vector.app.features.raw.wellknown
|
package im.vector.app.features.raw.wellknown
|
||||||
|
|
||||||
|
import org.matrix.android.sdk.api.extensions.tryThis
|
||||||
import org.matrix.android.sdk.api.raw.RawService
|
import org.matrix.android.sdk.api.raw.RawService
|
||||||
import org.matrix.android.sdk.internal.util.awaitCallback
|
import org.matrix.android.sdk.internal.util.awaitCallback
|
||||||
|
|
||||||
suspend fun RawService.getElementWellknown(userId: String): ElementWellKnown? {
|
suspend fun RawService.getElementWellknown(userId: String): ElementWellKnown? {
|
||||||
return awaitCallback<String> { getWellknown(userId, it) }
|
return tryThis { awaitCallback<String> { getWellknown(userId, it) } }
|
||||||
.let { ElementWellKnownMapper.from(it) }
|
?.let { ElementWellKnownMapper.from(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ElementWellKnown.isE2EByDefault() = elementE2E?.e2eDefault ?: riotE2E?.e2eDefault ?: true
|
fun ElementWellKnown.isE2EByDefault() = elementE2E?.e2eDefault ?: riotE2E?.e2eDefault ?: true
|
||||||
|
|
Loading…
Reference in a new issue