mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-04-01 00:18:30 +02:00
Adjusting zap calculations
This commit is contained in:
parent
52a24d5223
commit
39efc2ef9b
@ -44,6 +44,7 @@ import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.livedata.observeAsState
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.produceState
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
@ -163,18 +164,7 @@ private fun Galeries(
|
||||
nav: (String) -> Unit,
|
||||
) {
|
||||
if (multiSetCard.zapEvents.isNotEmpty()) {
|
||||
var zapEvents by
|
||||
remember(multiSetCard) {
|
||||
mutableStateOf(
|
||||
accountViewModel.cachedDecryptAmountMessageInGroup(multiSetCard.zapEvents),
|
||||
)
|
||||
}
|
||||
|
||||
LaunchedEffect(key1 = Unit) {
|
||||
accountViewModel.decryptAmountMessageInGroup(multiSetCard.zapEvents) { zapEvents = it }
|
||||
}
|
||||
|
||||
RenderZapGallery(zapEvents, backgroundColor, nav, accountViewModel)
|
||||
DecryptAndRenderZapGallery(multiSetCard, backgroundColor, accountViewModel, nav)
|
||||
}
|
||||
|
||||
if (multiSetCard.boostEvents.isNotEmpty()) {
|
||||
@ -229,12 +219,27 @@ fun RenderLikeGallery(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun DecryptAndRenderZapGallery(
|
||||
multiSetCard: MultiSetCard,
|
||||
backgroundColor: MutableState<Color>,
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: (String) -> Unit,
|
||||
) {
|
||||
val zapEvents by
|
||||
produceState(initialValue = accountViewModel.cachedDecryptAmountMessageInGroup(multiSetCard.zapEvents)) {
|
||||
accountViewModel.decryptAmountMessageInGroup(multiSetCard.zapEvents) { value = it }
|
||||
}
|
||||
|
||||
RenderZapGallery(zapEvents, backgroundColor, accountViewModel, nav)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun RenderZapGallery(
|
||||
zapEvents: ImmutableList<ZapAmountCommentNotification>,
|
||||
backgroundColor: MutableState<Color>,
|
||||
nav: (String) -> Unit,
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: (String) -> Unit,
|
||||
) {
|
||||
Row(Modifier.fillMaxWidth()) {
|
||||
Box(
|
||||
|
@ -34,7 +34,6 @@ import androidx.compose.animation.slideInVertically
|
||||
import androidx.compose.animation.slideOutVertically
|
||||
import androidx.compose.animation.togetherWith
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.combinedClickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
@ -494,8 +493,8 @@ private fun WatchZapAndRenderGallery(
|
||||
RenderZapGallery(
|
||||
zapEvents,
|
||||
backgroundColor,
|
||||
nav,
|
||||
accountViewModel,
|
||||
nav,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user