Use data classes/objects for state. Only update follow sets through exposed functions.
This commit is contained in:
@@ -66,6 +66,7 @@ class User(
|
|||||||
var latestContactList: ContactListEvent? = null
|
var latestContactList: ContactListEvent? = null
|
||||||
var latestBookmarkList: BookmarkListEvent? = null
|
var latestBookmarkList: BookmarkListEvent? = null
|
||||||
var followSets: List<AddressableNote> = listOf()
|
var followSets: List<AddressableNote> = listOf()
|
||||||
|
private set
|
||||||
|
|
||||||
var reports = mapOf<User, Set<Note>>()
|
var reports = mapOf<User, Set<Note>>()
|
||||||
private set
|
private set
|
||||||
@@ -164,6 +165,10 @@ class User(
|
|||||||
flowSet?.relays?.invalidateData()
|
flowSet?.relays?.invalidateData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun updateFollowSets(sets: List<AddressableNote>) {
|
||||||
|
followSets = followSets + sets
|
||||||
|
}
|
||||||
|
|
||||||
fun addReport(note: Note) {
|
fun addReport(note: Note) {
|
||||||
val author = note.author ?: return
|
val author = note.author ?: return
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -23,13 +23,13 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.lists
|
|||||||
sealed class FollowSetState {
|
sealed class FollowSetState {
|
||||||
data object Loading : FollowSetState()
|
data object Loading : FollowSetState()
|
||||||
|
|
||||||
class Loaded(
|
data class Loaded(
|
||||||
val feed: List<FollowSet>,
|
val feed: List<FollowSet>,
|
||||||
) : FollowSetState()
|
) : FollowSetState()
|
||||||
|
|
||||||
object Empty : FollowSetState()
|
data object Empty : FollowSetState()
|
||||||
|
|
||||||
class FeedError(
|
data class FeedError(
|
||||||
val errorMessage: String,
|
val errorMessage: String,
|
||||||
) : FollowSetState()
|
) : FollowSetState()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user