mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-30 00:40:49 +00:00
Adds Zap Address preference to the zap tag https://github.com/nostr-protocol/nips/pull/402/files
This commit is contained in:
parent
1596a7b559
commit
0a11de1892
@ -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)
|
||||||
|
@ -33,4 +33,6 @@ interface EventInterface {
|
|||||||
|
|
||||||
fun getReward(): BigDecimal?
|
fun getReward(): BigDecimal?
|
||||||
fun getPoWRank(): Int
|
fun getPoWRank(): Int
|
||||||
|
|
||||||
|
fun zapAddress(): String?
|
||||||
}
|
}
|
||||||
|
@ -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))
|
||||||
|
Loading…
Reference in New Issue
Block a user