Better rounding for zaps
This commit is contained in:
@@ -475,17 +475,21 @@ open class NewPostViewModel() : ViewModel() {
|
|||||||
|
|
||||||
val zapReceiver =
|
val zapReceiver =
|
||||||
if (wantsForwardZapTo) {
|
if (wantsForwardZapTo) {
|
||||||
forwardZapTo.items.map { split ->
|
forwardZapTo.items.mapNotNull { split ->
|
||||||
val homeRelay =
|
if (split.percentage > 0.00001) {
|
||||||
accountViewModel?.getRelayListFor(split.key)?.writeRelays()?.firstOrNull()
|
val homeRelay =
|
||||||
?: split.key.relaysBeingUsed.keys.firstOrNull { !it.contains("localhost") }
|
accountViewModel?.getRelayListFor(split.key)?.writeRelays()?.firstOrNull()
|
||||||
|
?: split.key.relaysBeingUsed.keys.firstOrNull { !it.contains("localhost") }
|
||||||
|
|
||||||
ZapSplitSetup(
|
ZapSplitSetup(
|
||||||
lnAddressOrPubKeyHex = split.key.pubkeyHex,
|
lnAddressOrPubKeyHex = split.key.pubkeyHex,
|
||||||
relay = homeRelay,
|
relay = homeRelay,
|
||||||
weight = round(split.percentage.toDouble() * 10000),
|
weight = round(split.percentage.toDouble() * 10000) / 10000,
|
||||||
isLnAddress = false,
|
isLnAddress = false,
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
|
|||||||
Reference in New Issue
Block a user