From fa92aff11c50ec7b92d3d6e35d2fbe684d4ceae4 Mon Sep 17 00:00:00 2001 From: Florian Renaud Date: Tue, 23 Nov 2021 10:22:55 +0100 Subject: [PATCH] Add function to provide a Flow of a single UserAccountDataEvent --- .../main/java/org/matrix/android/sdk/flow/FlowSession.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/matrix-sdk-android-flow/src/main/java/org/matrix/android/sdk/flow/FlowSession.kt b/matrix-sdk-android-flow/src/main/java/org/matrix/android/sdk/flow/FlowSession.kt index 2a0abd3d24..669e27edfd 100644 --- a/matrix-sdk-android-flow/src/main/java/org/matrix/android/sdk/flow/FlowSession.kt +++ b/matrix-sdk-android-flow/src/main/java/org/matrix/android/sdk/flow/FlowSession.kt @@ -152,6 +152,13 @@ class FlowSession(private val session: Session) { } } + fun liveUserAccountData(type: String): Flow> { + return session.accountDataService().getLiveUserAccountDataEvent(type).asFlow() + .startWith(session.coroutineDispatchers.io) { + session.accountDataService().getUserAccountDataEvent(type).toOptional() + } + } + fun liveRoomAccountData(types: Set): Flow> { return session.accountDataService().getLiveRoomAccountDataEvents(types).asFlow() .startWith(session.coroutineDispatchers.io) {