Skip to content

Commit e65a436

Browse files
committed
fixup: remove dead code (refactored method)
1 parent 690c6cf commit e65a436

File tree

1 file changed

+0
-40
lines changed

1 file changed

+0
-40
lines changed

features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt

-40
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import androidx.annotation.VisibleForTesting
1414
import androidx.compose.runtime.Composable
1515
import androidx.compose.runtime.DisposableEffect
1616
import androidx.compose.runtime.LaunchedEffect
17-
import androidx.compose.runtime.ProduceStateScope
1817
import androidx.compose.runtime.collectAsState
1918
import androidx.compose.runtime.getValue
2019
import androidx.compose.runtime.mutableStateListOf
@@ -35,9 +34,6 @@ import im.vector.app.features.analytics.plan.Interaction
3534
import io.element.android.features.messages.impl.MessagesNavigator
3635
import io.element.android.features.messages.impl.attachments.Attachment
3736
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
4137
import io.element.android.features.messages.impl.draft.ComposerDraftService
4238
import io.element.android.features.messages.impl.messagecomposer.suggestions.RoomAliasSuggestionsDataSource
4339
import io.element.android.features.messages.impl.messagecomposer.suggestions.SuggestionsProcessor
@@ -57,7 +53,6 @@ import io.element.android.libraries.matrix.api.room.MatrixRoom
5753
import io.element.android.libraries.matrix.api.room.draft.ComposerDraft
5854
import io.element.android.libraries.matrix.api.room.draft.ComposerDraftType
5955
import io.element.android.libraries.matrix.api.room.isDm
60-
import io.element.android.libraries.matrix.api.room.roomMembers
6156
import io.element.android.libraries.matrix.api.timeline.TimelineException
6257
import io.element.android.libraries.matrix.api.timeline.item.event.toEventOrTransactionId
6358
import io.element.android.libraries.matrix.ui.messages.RoomMemberProfilesCache
@@ -82,24 +77,18 @@ import io.element.android.services.analytics.api.AnalyticsService
8277
import io.element.android.services.analyticsproviders.api.trackers.captureInteraction
8378
import io.element.android.wysiwyg.compose.RichTextEditorState
8479
import io.element.android.wysiwyg.display.TextDisplay
85-
import kotlinx.collections.immutable.PersistentList
8680
import kotlinx.collections.immutable.persistentListOf
8781
import kotlinx.collections.immutable.toPersistentList
8882
import kotlinx.coroutines.CancellationException
8983
import kotlinx.coroutines.CoroutineScope
90-
import kotlinx.coroutines.ExperimentalCoroutinesApi
9184
import kotlinx.coroutines.FlowPreview
9285
import kotlinx.coroutines.delay
9386
import kotlinx.coroutines.flow.MutableStateFlow
9487
import kotlinx.coroutines.flow.collect
9588
import kotlinx.coroutines.flow.combine
9689
import kotlinx.coroutines.flow.debounce
97-
import kotlinx.coroutines.flow.distinctUntilChanged
9890
import kotlinx.coroutines.flow.filter
99-
import kotlinx.coroutines.flow.flatMapLatest
100-
import kotlinx.coroutines.flow.launchIn
10191
import kotlinx.coroutines.flow.merge
102-
import kotlinx.coroutines.flow.onEach
10392
import kotlinx.coroutines.launch
10493
import timber.log.Timber
10594
import kotlin.time.Duration.Companion.seconds
@@ -723,33 +712,4 @@ class MessageComposerPresenter @AssistedInject constructor(
723712
}
724713
}
725714
}
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-
}
755715
}

0 commit comments

Comments
 (0)