@@ -108,6 +108,7 @@ import to.bitkit.ui.shared.toast.ToastEventBus
108108import to.bitkit.ui.shared.toast.ToastQueueManager
109109import to.bitkit.ui.sheets.SendRoute
110110import to.bitkit.ui.theme.TRANSITION_SCREEN_MS
111+ import to.bitkit.usecases.FormatMoneyValue
111112import to.bitkit.utils.Bip21Utils
112113import to.bitkit.utils.Logger
113114import to.bitkit.utils.NetworkValidationHelper
@@ -153,6 +154,7 @@ class AppViewModel @Inject constructor(
153154 private val notificationsSheet : NotificationsTimedSheet ,
154155 private val quickPaySheet : QuickPayTimedSheet ,
155156 private val highBalanceSheet : HighBalanceTimedSheet ,
157+ private val formatMoneyValue : FormatMoneyValue ,
156158) : ViewModel() {
157159 val healthState = healthRepo.healthState
158160
@@ -748,7 +750,7 @@ class AppViewModel @Inject constructor(
748750 showAddressValidationError(
749751 titleRes = R .string.other__pay_insufficient_spending,
750752 descriptionRes = R .string.other__pay_insufficient_spending_amount_description,
751- descriptionArgs = mapOf (" amount" to shortfall.toString( )),
753+ descriptionArgs = mapOf (" amount" to formatMoneyValue(shortfall )),
752754 testTag = " InsufficientSpendingToast" ,
753755 )
754756 return
@@ -758,7 +760,7 @@ class AppViewModel @Inject constructor(
758760 _sendUiState .update { it.copy(isAddressInputValid = true ) }
759761 }
760762
761- private fun validateOnChainAddress (invoice : OnChainInvoice ) {
763+ private suspend fun validateOnChainAddress (invoice : OnChainInvoice ) {
762764 val validatedAddress = runCatching { validateBitcoinAddress(invoice.address) }
763765 .getOrElse {
764766 showAddressValidationError(
@@ -794,7 +796,7 @@ class AppViewModel @Inject constructor(
794796 showAddressValidationError(
795797 titleRes = R .string.other__pay_insufficient_savings,
796798 descriptionRes = R .string.other__pay_insufficient_savings_amount_description,
797- descriptionArgs = mapOf (" amount" to shortfall.toString( )),
799+ descriptionArgs = mapOf (" amount" to formatMoneyValue(shortfall )),
798800 testTag = " InsufficientSavingsToast" ,
799801 )
800802 return
@@ -915,7 +917,7 @@ class AppViewModel @Inject constructor(
915917 type = Toast .ToastType .ERROR ,
916918 title = context.getString(R .string.wallet__lnurl_pay__error_min__title),
917919 description = context.getString(R .string.wallet__lnurl_pay__error_min__description)
918- .replace(" {amount}" , minSendable.toString( )),
920+ .replace(" {amount}" , formatMoneyValue(minSendable )),
919921 testTag = " LnurlPayAmountTooLowToast" ,
920922 )
921923 return
@@ -1125,7 +1127,7 @@ class AppViewModel @Inject constructor(
11251127 type = Toast .ToastType .ERROR ,
11261128 title = context.getString(R .string.other__pay_insufficient_savings),
11271129 description = context.getString(R .string.other__pay_insufficient_savings_amount_description)
1128- .replace(" {amount}" , shortfall.toString( )),
1130+ .replace(" {amount}" , formatMoneyValue(shortfall )),
11291131 testTag = " InsufficientSavingsToast" ,
11301132 )
11311133 return
@@ -1167,7 +1169,7 @@ class AppViewModel @Inject constructor(
11671169 type = Toast .ToastType .ERROR ,
11681170 title = context.getString(R .string.other__pay_insufficient_spending),
11691171 description = context.getString(R .string.other__pay_insufficient_spending_amount_description)
1170- .replace(" {amount}" , shortfall.toString( )),
1172+ .replace(" {amount}" , formatMoneyValue(shortfall )),
11711173 testTag = " InsufficientSpendingToast" ,
11721174 )
11731175 return
0 commit comments