Optimize call flow

This commit is contained in:
Benoit Marty 2022-01-05 14:56:17 +01:00
parent 96d5652fcd
commit 51c9c2f032
1 changed files with 2 additions and 5 deletions

View File

@ -132,14 +132,11 @@ class RoomMemberProfileViewModel @AssistedInject constructor(
session.flow()
.liveUserAccountData(UserAccountDataTypes.TYPE_OVERRIDE_COLORS)
.unwrap()
.map { it.content.toModel<Map<String, String>>() }
.map { userColorAccountDataContent ->
userColorAccountDataContent?.get(initialState.userId)
}
.onEach {
val newUserColor = it.content.toModel<Map<String, String>>()?.get(initialState.userId)
setState {
copy(
userColorOverride = it
userColorOverride = newUserColor
)
}
}