mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-30 00:40:49 +00:00
Adds @Stable tag to Notification Card models
This commit is contained in:
parent
aed7f46ca0
commit
e9bdc045ba
@ -13,6 +13,7 @@ import androidx.compose.material.icons.Icons
|
|||||||
import androidx.compose.material.icons.filled.Bolt
|
import androidx.compose.material.icons.filled.Bolt
|
||||||
import androidx.compose.material.icons.filled.ExpandMore
|
import androidx.compose.material.icons.filled.ExpandMore
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.Stable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
@ -92,6 +93,7 @@ fun UserReactionsRow(model: UserReactionsViewModel, accountViewModel: AccountVie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Stable
|
||||||
class UserReactionsViewModel : ViewModel() {
|
class UserReactionsViewModel : ViewModel() {
|
||||||
var user: User? = null
|
var user: User? = null
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package com.vitorpamplona.amethyst.ui.screen
|
|||||||
|
|
||||||
import androidx.compose.runtime.Immutable
|
import androidx.compose.runtime.Immutable
|
||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
|
import androidx.compose.runtime.Stable
|
||||||
import com.vitorpamplona.amethyst.model.Note
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
import com.vitorpamplona.amethyst.model.User
|
import com.vitorpamplona.amethyst.model.User
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
@ -92,9 +93,17 @@ class MessageSetCard(val note: Note) : Card() {
|
|||||||
override fun id() = note.idHex
|
override fun id() = note.idHex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Immutable
|
||||||
sealed class CardFeedState {
|
sealed class CardFeedState {
|
||||||
|
@Immutable
|
||||||
object Loading : CardFeedState()
|
object Loading : CardFeedState()
|
||||||
|
|
||||||
|
@Stable
|
||||||
class Loaded(val feed: MutableState<ImmutableList<Card>>) : CardFeedState()
|
class Loaded(val feed: MutableState<ImmutableList<Card>>) : CardFeedState()
|
||||||
|
|
||||||
|
@Immutable
|
||||||
object Empty : CardFeedState()
|
object Empty : CardFeedState()
|
||||||
|
|
||||||
|
@Immutable
|
||||||
class FeedError(val errorMessage: String) : CardFeedState()
|
class FeedError(val errorMessage: String) : CardFeedState()
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.vitorpamplona.amethyst.ui.screen
|
package com.vitorpamplona.amethyst.ui.screen
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import androidx.compose.runtime.Stable
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
@ -33,6 +34,7 @@ import kotlinx.coroutines.launch
|
|||||||
import kotlin.time.ExperimentalTime
|
import kotlin.time.ExperimentalTime
|
||||||
import kotlin.time.measureTimedValue
|
import kotlin.time.measureTimedValue
|
||||||
|
|
||||||
|
@Stable
|
||||||
class NotificationViewModel : CardFeedViewModel(NotificationFeedFilter)
|
class NotificationViewModel : CardFeedViewModel(NotificationFeedFilter)
|
||||||
|
|
||||||
open class CardFeedViewModel(val localFilter: FeedFilter<Note>) : ViewModel() {
|
open class CardFeedViewModel(val localFilter: FeedFilter<Note>) : ViewModel() {
|
||||||
|
Loading…
Reference in New Issue
Block a user