@@ -347,7 +347,7 @@ class AppViewModel @Inject constructor(
347347 }
348348 }
349349
350- private fun onAmountChange (value : String ) {
350+ private fun onAmountChange (value : String ) = viewModelScope.launch {
351351 _sendUiState .update {
352352 it.copy(
353353 amountInput = value,
@@ -401,7 +401,7 @@ class AppViewModel @Inject constructor(
401401 }
402402 }
403403
404- private fun onPaymentMethodSwitch () {
404+ private fun onPaymentMethodSwitch () = viewModelScope.launch {
405405 val nextPaymentMethod = when (_sendUiState .value.payMethod) {
406406 SendMethod .ONCHAIN -> SendMethod .LIGHTNING
407407 SendMethod .LIGHTNING -> SendMethod .ONCHAIN
@@ -433,8 +433,10 @@ class AppViewModel @Inject constructor(
433433 return
434434 }
435435
436+ _sendUiState .update { it.copy(isLoading = true ) }
436437 refreshOnchainSendIfNeeded()
437438 estimateLightningRoutingFeesIfNeeded()
439+ _sendUiState .update { it.copy(isLoading = false ) }
438440
439441 setSendEffect(SendEffect .NavigateToConfirm )
440442 }
@@ -447,7 +449,7 @@ class AppViewModel @Inject constructor(
447449 setSendEffect(SendEffect .NavigateToConfirm )
448450 }
449451
450- private fun validateAmount (
452+ private suspend fun validateAmount (
451453 value : String ,
452454 payMethod : SendMethod = _sendUiState .value.payMethod,
453455 ): Boolean {
@@ -822,7 +824,7 @@ class AppViewModel @Inject constructor(
822824 return false
823825 }
824826
825- private fun resetAmountInput () {
827+ private fun resetAmountInput () = viewModelScope.launch {
826828 _sendUiState .update { state ->
827829 state.copy(
828830 amountInput = state.amount.toString(),
0 commit comments