@@ -429,7 +429,6 @@ class HomeViewModel @Inject constructor(
429429 vibrator.vibrate()
430430
431431 viewModelScope.launch {
432- balanceController.fetchBalanceSuspend()
433432 client.fetchLimits(true ).subscribe({}, ErrorUtils ::handleError)
434433 }
435434 },
@@ -447,6 +446,7 @@ class HomeViewModel @Inject constructor(
447446 }
448447
449448 private fun presentSend (data : List <Byte >, bill : Bill , isVibrate : Boolean = false) {
449+ println (" present send" )
450450 if (bill.didReceive) {
451451 uiFlow.update {
452452 val billState = it.billState
@@ -499,36 +499,40 @@ class HomeViewModel @Inject constructor(
499499 cashLinkManager.cancelSend()
500500 BottomBarManager .clearByType(BottomBarManager .BottomBarMessageType .REMOTE_SEND )
501501
502- val shown = showToastIfNeeded(style)
502+ viewModelScope.launch {
503+ val shown = showToastIfNeeded(style)
504+ withContext(Dispatchers .Main ) {
505+ uiFlow.update {
506+ it.copy(
507+ presentationStyle = style,
508+ )
509+ }
503510
504- uiFlow.update {
505- it.copy(
506- presentationStyle = style,
507- billState = it.billState.copy(
508- bill = null ,
509- valuation = null ,
510- primaryAction = null ,
511- secondaryAction = null ,
512- )
513- )
514- }
511+ uiFlow.update {
512+ it.copy(
513+ billState = it.billState.copy(
514+ bill = null ,
515+ valuation = null ,
516+ primaryAction = null ,
517+ secondaryAction = null ,
518+ )
519+ )
520+ }
521+ }
515522
516- viewModelScope.launch {
517523 historyController.fetchChats()
518524 balanceController.fetchBalanceSuspend()
519525
520- if (shown) {
521- delay(300 )
522- }
523-
524526 if (shown) {
525527 delay(5 .seconds.inWholeMilliseconds)
526528 }
529+ withContext(Dispatchers .Main ) {
527530 uiFlow.update {
528531 it.copy(
529532 billState = it.billState.copy(showToast = false )
530533 )
531534 }
535+ }
532536 }
533537 }
534538
0 commit comments