This commit is contained in:
Vitor Pamplona 2023-04-27 09:27:29 -04:00
parent 1596a7b559
commit 0a11de1892
3 changed files with 5 additions and 1 deletions

View File

@ -41,6 +41,8 @@ open class Event(
fun taggedUsers() = tags.filter { it.size > 1 && it[0] == "p" }.map { it[1] } fun taggedUsers() = tags.filter { it.size > 1 && it[0] == "p" }.map { it[1] }
fun taggedEvents() = tags.filter { it.size > 1 && it[0] == "e" }.map { it[1] } fun taggedEvents() = tags.filter { it.size > 1 && it[0] == "e" }.map { it[1] }
override fun zapAddress() = tags.firstOrNull { it.size > 1 && it[0] == "zap" }?.get(1)
fun taggedAddresses() = tags.filter { it.size > 1 && it[0] == "a" }.mapNotNull { fun taggedAddresses() = tags.filter { it.size > 1 && it[0] == "a" }.mapNotNull {
val aTagValue = it[1] val aTagValue = it[1]
val relay = it.getOrNull(2) val relay = it.getOrNull(2)

View File

@ -33,4 +33,6 @@ interface EventInterface {
fun getReward(): BigDecimal? fun getReward(): BigDecimal?
fun getPoWRank(): Int fun getPoWRank(): Int
fun zapAddress(): String?
} }

View File

@ -60,7 +60,7 @@ class AccountViewModel(private val account: Account) : ViewModel() {
} }
fun zap(note: Note, amount: Long, pollOption: Int?, message: String, context: Context, onError: (String) -> Unit, onProgress: (percent: Float) -> Unit, zapType: LnZapEvent.ZapType) { fun zap(note: Note, amount: Long, pollOption: Int?, message: String, context: Context, onError: (String) -> Unit, onProgress: (percent: Float) -> Unit, zapType: LnZapEvent.ZapType) {
val lud16 = note.author?.info?.lud16?.trim() ?: note.author?.info?.lud06?.trim() val lud16 = note.event?.zapAddress() ?: note.author?.info?.lud16?.trim() ?: note.author?.info?.lud06?.trim()
if (lud16.isNullOrBlank()) { if (lud16.isNullOrBlank()) {
onError(context.getString(R.string.user_does_not_have_a_lightning_address_setup_to_receive_sats)) onError(context.getString(R.string.user_does_not_have_a_lightning_address_setup_to_receive_sats))