From 1783fbab59343fd9a3c3ab4b9cb9ef0a8c7feb83 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Wed, 7 Jan 2026 13:18:17 -0500 Subject: [PATCH] Separating ListChange --- .../amethyst/model/ListChange.kt | 39 +++++++++++++++++++ .../amethyst/ui/dal/ChangesFlowFilter.kt | 19 +-------- 2 files changed, 40 insertions(+), 18 deletions(-) create mode 100644 amethyst/src/main/java/com/vitorpamplona/amethyst/model/ListChange.kt diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/ListChange.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/ListChange.kt new file mode 100644 index 000000000..1c0530571 --- /dev/null +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/ListChange.kt @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2025 Vitor Pamplona + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the + * Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +package com.vitorpamplona.amethyst.model + +sealed class ListChange { + data class Addition( + val item: T, + ) : ListChange() + + data class Deletion( + val item: T, + ) : ListChange() + + data class SetAddition( + val item: Set, + ) : ListChange() + + data class SetDeletion( + val item: Set, + ) : ListChange() +} diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/ChangesFlowFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/ChangesFlowFilter.kt index 792ef828d..dab6bd150 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/ChangesFlowFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/ChangesFlowFilter.kt @@ -20,26 +20,9 @@ */ package com.vitorpamplona.amethyst.ui.dal +import com.vitorpamplona.amethyst.model.ListChange import kotlinx.coroutines.flow.MutableSharedFlow interface ChangesFlowFilter : IAdditiveFeedFilter { fun changesFlow(): MutableSharedFlow> } - -sealed class ListChange { - data class Addition( - val item: T, - ) : ListChange() - - data class Deletion( - val item: T, - ) : ListChange() - - data class SetAddition( - val item: Set, - ) : ListChange() - - data class SetDeletion( - val item: Set, - ) : ListChange() -}