@@ -14,7 +14,6 @@ import androidx.annotation.VisibleForTesting
14
14
import androidx.compose.runtime.Composable
15
15
import androidx.compose.runtime.DisposableEffect
16
16
import androidx.compose.runtime.LaunchedEffect
17
- import androidx.compose.runtime.ProduceStateScope
18
17
import androidx.compose.runtime.collectAsState
19
18
import androidx.compose.runtime.getValue
20
19
import androidx.compose.runtime.mutableStateListOf
@@ -35,9 +34,6 @@ import im.vector.app.features.analytics.plan.Interaction
35
34
import io.element.android.features.messages.impl.MessagesNavigator
36
35
import io.element.android.features.messages.impl.attachments.Attachment
37
36
import io.element.android.features.messages.impl.attachments.preview.error.sendAttachmentError
38
- import io.element.android.features.messages.impl.crypto.identity.RoomMemberIdentityStateChange
39
- import io.element.android.features.messages.impl.crypto.identity.createDefaultRoomMemberForIdentityChange
40
- import io.element.android.features.messages.impl.crypto.identity.toIdentityRoomMember
41
37
import io.element.android.features.messages.impl.draft.ComposerDraftService
42
38
import io.element.android.features.messages.impl.messagecomposer.suggestions.RoomAliasSuggestionsDataSource
43
39
import io.element.android.features.messages.impl.messagecomposer.suggestions.SuggestionsProcessor
@@ -57,7 +53,6 @@ import io.element.android.libraries.matrix.api.room.MatrixRoom
57
53
import io.element.android.libraries.matrix.api.room.draft.ComposerDraft
58
54
import io.element.android.libraries.matrix.api.room.draft.ComposerDraftType
59
55
import io.element.android.libraries.matrix.api.room.isDm
60
- import io.element.android.libraries.matrix.api.room.roomMembers
61
56
import io.element.android.libraries.matrix.api.timeline.TimelineException
62
57
import io.element.android.libraries.matrix.api.timeline.item.event.toEventOrTransactionId
63
58
import io.element.android.libraries.matrix.ui.messages.RoomMemberProfilesCache
@@ -82,24 +77,18 @@ import io.element.android.services.analytics.api.AnalyticsService
82
77
import io.element.android.services.analyticsproviders.api.trackers.captureInteraction
83
78
import io.element.android.wysiwyg.compose.RichTextEditorState
84
79
import io.element.android.wysiwyg.display.TextDisplay
85
- import kotlinx.collections.immutable.PersistentList
86
80
import kotlinx.collections.immutable.persistentListOf
87
81
import kotlinx.collections.immutable.toPersistentList
88
82
import kotlinx.coroutines.CancellationException
89
83
import kotlinx.coroutines.CoroutineScope
90
- import kotlinx.coroutines.ExperimentalCoroutinesApi
91
84
import kotlinx.coroutines.FlowPreview
92
85
import kotlinx.coroutines.delay
93
86
import kotlinx.coroutines.flow.MutableStateFlow
94
87
import kotlinx.coroutines.flow.collect
95
88
import kotlinx.coroutines.flow.combine
96
89
import kotlinx.coroutines.flow.debounce
97
- import kotlinx.coroutines.flow.distinctUntilChanged
98
90
import kotlinx.coroutines.flow.filter
99
- import kotlinx.coroutines.flow.flatMapLatest
100
- import kotlinx.coroutines.flow.launchIn
101
91
import kotlinx.coroutines.flow.merge
102
- import kotlinx.coroutines.flow.onEach
103
92
import kotlinx.coroutines.launch
104
93
import timber.log.Timber
105
94
import kotlin.time.Duration.Companion.seconds
@@ -723,33 +712,4 @@ class MessageComposerPresenter @AssistedInject constructor(
723
712
}
724
713
}
725
714
}
726
-
727
- @OptIn(ExperimentalCoroutinesApi ::class )
728
- private fun ProduceStateScope<PersistentList<RoomMemberIdentityStateChange>>.observeRoomMemberIdentityStateChange () {
729
- room.syncUpdateFlow
730
- .filter {
731
- // Room cannot become unencrypted, so we can just apply a filter here.
732
- room.isEncrypted
733
- }
734
- .distinctUntilChanged()
735
- .flatMapLatest {
736
- combine(room.identityStateChangesFlow, room.membersStateFlow) { identityStateChanges, membersState ->
737
- identityStateChanges.map { identityStateChange ->
738
- val member = membersState.roomMembers()
739
- ?.firstOrNull { roomMember -> roomMember.userId == identityStateChange.userId }
740
- ?.toIdentityRoomMember()
741
- ? : createDefaultRoomMemberForIdentityChange(identityStateChange.userId)
742
- RoomMemberIdentityStateChange (
743
- identityRoomMember = member,
744
- identityState = identityStateChange.identityState,
745
- )
746
- }
747
- }
748
- .distinctUntilChanged()
749
- .onEach { roomMemberIdentityStateChanges ->
750
- value = roomMemberIdentityStateChanges.toPersistentList()
751
- }
752
- }
753
- .launchIn(this )
754
- }
755
715
}
0 commit comments