Removes the ZapSplit display when the weights are zero or were incorrectly created.
This commit is contained in:
@@ -1076,6 +1076,8 @@ private fun NoteBody(
|
|||||||
fun DisplayZapSplits(noteEvent: EventInterface, accountViewModel: AccountViewModel, nav: (String) -> Unit) {
|
fun DisplayZapSplits(noteEvent: EventInterface, accountViewModel: AccountViewModel, nav: (String) -> Unit) {
|
||||||
val list = remember(noteEvent) { noteEvent.zapSplitSetup() }
|
val list = remember(noteEvent) { noteEvent.zapSplitSetup() }
|
||||||
|
|
||||||
|
if (list.isEmpty()) return
|
||||||
|
|
||||||
Row(verticalAlignment = CenterVertically) {
|
Row(verticalAlignment = CenterVertically) {
|
||||||
Box(
|
Box(
|
||||||
Modifier
|
Modifier
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ fun WatchAccountForVideoScreen(videoFeedView: NostrVideoFeedViewModel, accountVi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SaveableFeedState(
|
private fun SaveableFeedState(
|
||||||
videoFeedView: NostrVideoFeedViewModel,
|
videoFeedView: NostrVideoFeedViewModel,
|
||||||
|
|||||||
@@ -96,16 +96,20 @@ open class Event(
|
|||||||
override fun hasZapSplitSetup() = tags.any { it.size > 1 && it[0] == "zap" }
|
override fun hasZapSplitSetup() = tags.any { it.size > 1 && it[0] == "zap" }
|
||||||
|
|
||||||
override fun zapSplitSetup(): List<ZapSplitSetup> {
|
override fun zapSplitSetup(): List<ZapSplitSetup> {
|
||||||
return tags.filter { it.size > 1 && it[0] == "zap" }.map {
|
return tags.filter { it.size > 1 && it[0] == "zap" }.mapNotNull {
|
||||||
val isLnAddress = it[0].contains("@") || it[0].startsWith("LNURL", true)
|
val isLnAddress = it[0].contains("@") || it[0].startsWith("LNURL", true)
|
||||||
val weight = if (isLnAddress) 1.0 else (it.getOrNull(3)?.toDoubleOrNull() ?: 0.0)
|
val weight = if (isLnAddress) 1.0 else (it.getOrNull(3)?.toDoubleOrNull() ?: 0.0)
|
||||||
|
|
||||||
ZapSplitSetup(
|
if (weight > 0) {
|
||||||
it[1],
|
ZapSplitSetup(
|
||||||
it.getOrNull(2),
|
it[1],
|
||||||
weight,
|
it.getOrNull(2),
|
||||||
isLnAddress
|
weight,
|
||||||
)
|
isLnAddress
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user