mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-29 08:20:51 +00:00
Fixes call from main thread
This commit is contained in:
parent
0936df9851
commit
beb901120e
@ -83,6 +83,7 @@ import com.vitorpamplona.quartz.events.LnZapEvent
|
||||
import com.vitorpamplona.quartz.events.LnZapRequestEvent
|
||||
import com.vitorpamplona.quartz.events.Participant
|
||||
import com.vitorpamplona.quartz.events.ReportEvent
|
||||
import com.vitorpamplona.quartz.events.Response
|
||||
import com.vitorpamplona.quartz.events.SealedGossipEvent
|
||||
import com.vitorpamplona.quartz.events.UserMetadata
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
@ -1353,6 +1354,17 @@ class AccountViewModel(val account: Account, val settings: SettingsState) : View
|
||||
}
|
||||
}
|
||||
|
||||
fun sendZapPaymentRequestFor(
|
||||
bolt11: String,
|
||||
zappedNote: Note?,
|
||||
onSent: () -> Unit,
|
||||
onResponse: (Response?) -> Unit,
|
||||
) {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
account.sendZapPaymentRequestFor(bolt11, zappedNote, onSent, onResponse)
|
||||
}
|
||||
}
|
||||
|
||||
val draftNoteCache = CachedDraftNotes(this)
|
||||
|
||||
class CachedDraftNotes(val accountViewModel: AccountViewModel) : GenericBaseCacheAsync<DraftEvent, Note>(20) {
|
||||
|
@ -332,7 +332,7 @@ fun FeedDVM(
|
||||
val context = LocalContext.current
|
||||
Button(onClick = {
|
||||
if (accountViewModel.account.hasWalletConnectSetup()) {
|
||||
accountViewModel.account.sendZapPaymentRequestFor(
|
||||
accountViewModel.sendZapPaymentRequestFor(
|
||||
bolt11 = invoice,
|
||||
zappedNote = null,
|
||||
onSent = {
|
||||
|
Loading…
Reference in New Issue
Block a user