diff --git a/vector/src/main/java/im/vector/app/features/home/UserColorAccountDataViewModel.kt b/vector/src/main/java/im/vector/app/features/home/UserColorAccountDataViewModel.kt index 77f6eade4a..3d4f219a7c 100644 --- a/vector/src/main/java/im/vector/app/features/home/UserColorAccountDataViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/UserColorAccountDataViewModel.kt @@ -29,12 +29,12 @@ import im.vector.app.core.platform.VectorViewModel import im.vector.app.features.home.room.detail.timeline.helper.MatrixItemColorProvider import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.map -import kotlinx.coroutines.flow.mapNotNull import kotlinx.coroutines.flow.onEach import org.matrix.android.sdk.api.session.Session import org.matrix.android.sdk.api.session.accountdata.UserAccountDataTypes import org.matrix.android.sdk.api.session.events.model.toModel import org.matrix.android.sdk.flow.flow +import org.matrix.android.sdk.flow.unwrap import timber.log.Timber data class DummyState( @@ -60,8 +60,8 @@ class UserColorAccountDataViewModel @AssistedInject constructor( private fun observeAccountData() { session.flow() - .liveUserAccountData(setOf(UserAccountDataTypes.TYPE_OVERRIDE_COLORS)) - .mapNotNull { it.firstOrNull() } + .liveUserAccountData(UserAccountDataTypes.TYPE_OVERRIDE_COLORS) + .unwrap() .map { it.content.toModel>() } .onEach { userColorAccountDataContent -> if (userColorAccountDataContent == null) { diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewModel.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewModel.kt index 8961ab66cb..859bb6125f 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileViewModel.kt @@ -39,7 +39,6 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.map -import kotlinx.coroutines.flow.mapNotNull import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch import kotlinx.coroutines.withContext @@ -131,8 +130,8 @@ class RoomMemberProfileViewModel @AssistedInject constructor( private fun observeAccountData() { session.flow() - .liveUserAccountData(setOf(UserAccountDataTypes.TYPE_OVERRIDE_COLORS)) - .mapNotNull { it.firstOrNull() } + .liveUserAccountData(UserAccountDataTypes.TYPE_OVERRIDE_COLORS) + .unwrap() .map { it.content.toModel>() } .map { userColorAccountDataContent -> userColorAccountDataContent?.get(initialState.userId)