mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 16:22:49 +00:00
Use toImmutableSet instead of toPersistentSet
This commit is contained in:
+2
-2
@@ -142,7 +142,7 @@ import io.element.android.libraries.textcomposer.model.TextEditorState
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
import io.element.android.wysiwyg.link.Link
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import kotlinx.collections.immutable.toPersistentSet
|
||||
import kotlinx.collections.immutable.toImmutableSet
|
||||
import timber.log.Timber
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
@@ -774,7 +774,7 @@ internal fun MessagesViewSelectionModePreview() = ElementPreview {
|
||||
.filter { SelectionAction.Forward.canApplyTo(it) }
|
||||
.take(2)
|
||||
.mapNotNull { it.eventId }
|
||||
.toPersistentSet()
|
||||
.toImmutableSet()
|
||||
MessagesView(
|
||||
state = aMessagesState(
|
||||
timelineState = aTimelineState(
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ import io.element.android.features.messages.impl.timeline.model.event.canBeForwa
|
||||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
import kotlinx.collections.immutable.ImmutableSet
|
||||
import kotlinx.collections.immutable.toPersistentSet
|
||||
import kotlinx.collections.immutable.toImmutableSet
|
||||
|
||||
/** Maximum number of messages that can be selected at once. */
|
||||
const val MAX_SELECTION_COUNT = 10
|
||||
@@ -57,7 +57,7 @@ fun SelectionAction.canApplyTo(event: TimelineItem.Event): Boolean = when (this)
|
||||
*/
|
||||
fun SelectionState.deselect(eventIds: Set<EventId>): SelectionState = when (this) {
|
||||
SelectionState.Disabled -> this
|
||||
is SelectionState.Active -> copy(selectedEventIds = (selectedEventIds - eventIds).toPersistentSet())
|
||||
is SelectionState.Active -> copy(selectedEventIds = (selectedEventIds - eventIds).toImmutableSet())
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -75,7 +75,7 @@ import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import kotlinx.collections.immutable.persistentSetOf
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
import kotlinx.collections.immutable.toPersistentSet
|
||||
import kotlinx.collections.immutable.toImmutableSet
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.combine
|
||||
@@ -285,7 +285,7 @@ class TimelinePresenter(
|
||||
snackbarDispatcher.post(SnackbarMessage(CommonStrings.screen_room_maximum_messages_selected))
|
||||
current
|
||||
}
|
||||
else -> current.copy(selectedEventIds = (selected + event.eventId).toPersistentSet())
|
||||
else -> current.copy(selectedEventIds = (selected + event.eventId).toImmutableSet())
|
||||
}
|
||||
}
|
||||
is TimelineEvent.ExitSelectionMode -> {
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ import io.element.android.libraries.matrix.test.AN_EVENT_ID
|
||||
import io.element.android.libraries.matrix.test.AN_EVENT_ID_2
|
||||
import io.element.android.libraries.matrix.test.AN_EVENT_ID_3
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import kotlinx.collections.immutable.toPersistentSet
|
||||
import kotlinx.collections.immutable.toImmutableSet
|
||||
import org.junit.Test
|
||||
|
||||
class SelectionStateTest {
|
||||
@@ -84,6 +84,6 @@ class SelectionStateTest {
|
||||
|
||||
private fun anActiveSelection(eventIds: List<EventId> = emptyList()) = SelectionState.Active(
|
||||
action = SelectionAction.Forward,
|
||||
selectedEventIds = eventIds.toPersistentSet(),
|
||||
selectedEventIds = eventIds.toImmutableSet(),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user