refactor: remove BalanceViewModel dependency
This commit is contained in:
@@ -45,7 +45,6 @@ class WalletViewModelFactory(private val app: Application) : ViewModelProvider.F
|
|||||||
repo = repo,
|
repo = repo,
|
||||||
aliasRepo = aliasRepo,
|
aliasRepo = aliasRepo,
|
||||||
lnurlCache = lnurlCache,
|
lnurlCache = lnurlCache,
|
||||||
balanceVm = balanceVm,
|
|
||||||
scanner = lnurlScanner,
|
scanner = lnurlScanner,
|
||||||
payer = lnurlPayer,
|
payer = lnurlPayer,
|
||||||
poller = poller,
|
poller = poller,
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ fun SendScreen(
|
|||||||
when (event) {
|
when (event) {
|
||||||
is SendEvent.WithdrawScanned ->
|
is SendEvent.WithdrawScanned ->
|
||||||
vm.handleWithdrawScanned(event.raw, event.lnurl)
|
vm.handleWithdrawScanned(event.raw, event.lnurl)
|
||||||
|
is SendEvent.PaymentCompleted ->
|
||||||
|
vm.refreshBalance()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import com.bitcointxoko.gudariwallet.data.LnurlCacheRepository
|
|||||||
import com.bitcointxoko.gudariwallet.data.NodeAliasRepository
|
import com.bitcointxoko.gudariwallet.data.NodeAliasRepository
|
||||||
import com.bitcointxoko.gudariwallet.data.WalletRepository
|
import com.bitcointxoko.gudariwallet.data.WalletRepository
|
||||||
import com.bitcointxoko.gudariwallet.ui.SendState
|
import com.bitcointxoko.gudariwallet.ui.SendState
|
||||||
import com.bitcointxoko.gudariwallet.ui.balance.BalanceViewModel
|
|
||||||
import com.bitcointxoko.gudariwallet.util.BiometricHelper
|
import com.bitcointxoko.gudariwallet.util.BiometricHelper
|
||||||
import com.bitcointxoko.gudariwallet.util.Bip21Parser
|
import com.bitcointxoko.gudariwallet.util.Bip21Parser
|
||||||
import com.bitcointxoko.gudariwallet.util.LnurlMetadataParser
|
import com.bitcointxoko.gudariwallet.util.LnurlMetadataParser
|
||||||
@@ -34,6 +33,7 @@ sealed class SendEvent {
|
|||||||
val raw : LnurlScanResponse,
|
val raw : LnurlScanResponse,
|
||||||
val lnurl : String,
|
val lnurl : String,
|
||||||
) : SendEvent()
|
) : SendEvent()
|
||||||
|
object PaymentCompleted : SendEvent()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── String bundle injected at the call site ───────────────────────────────────
|
// ── String bundle injected at the call site ───────────────────────────────────
|
||||||
@@ -61,7 +61,6 @@ class SendViewModel(
|
|||||||
private val repo : WalletRepository,
|
private val repo : WalletRepository,
|
||||||
private val aliasRepo : NodeAliasRepository,
|
private val aliasRepo : NodeAliasRepository,
|
||||||
private val lnurlCache : LnurlCacheRepository,
|
private val lnurlCache : LnurlCacheRepository,
|
||||||
private val balanceVm : BalanceViewModel,
|
|
||||||
private val scanner : LnurlScanner,
|
private val scanner : LnurlScanner,
|
||||||
private val payer : LnurlPayer,
|
private val payer : LnurlPayer,
|
||||||
private val poller : PaymentPoller,
|
private val poller : PaymentPoller,
|
||||||
@@ -176,7 +175,7 @@ class SendViewModel(
|
|||||||
paymentHash = paymentHash,
|
paymentHash = paymentHash,
|
||||||
pendingRecord = PaymentRecord.fromPayment(paymentHash, amountSats, feeSats, bolt11, memo, pubkey, alias)
|
pendingRecord = PaymentRecord.fromPayment(paymentHash, amountSats, feeSats, bolt11, memo, pubkey, alias)
|
||||||
)
|
)
|
||||||
balanceVm.refreshBalance()
|
_events.tryEmit(SendEvent.PaymentCompleted)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user