@@ -883,30 +883,28 @@ class HomeViewModel @Inject constructor(
883883
884884 val isReceived = payload != null
885885 val presentationStyle = if (isReceived) PresentationStyle .Pop else PresentationStyle .Slide
886- withContext(Dispatchers .Main ) {
887- uiFlow.update {
888- var billState = it.billState.copy(
889- bill = Bill .Payment (amount, code, request),
890- valuation = PaymentValuation (amount),
891- primaryAction = null ,
892- )
893-
894- if (isReceived) {
895- billState = billState.copy(
896- paymentConfirmation = PaymentConfirmation (
897- state = ConfirmationState .AwaitingConfirmation ,
898- payload = code,
899- requestedAmount = amount,
900- localAmount = amount.replacing(exchange.localRate)
901- ),
902- )
903- }
886+ uiFlow.update {
887+ var billState = it.billState.copy(
888+ bill = Bill .Payment (amount, code, request),
889+ valuation = PaymentValuation (amount),
890+ primaryAction = null ,
891+ )
904892
905- it.copy(
906- presentationStyle = presentationStyle,
907- billState = billState,
893+ if (isReceived) {
894+ billState = billState.copy(
895+ paymentConfirmation = PaymentConfirmation (
896+ state = ConfirmationState .AwaitingConfirmation ,
897+ payload = code,
898+ requestedAmount = amount,
899+ localAmount = amount.replacing(exchange.localRate)
900+ ),
908901 )
909902 }
903+
904+ it.copy(
905+ presentationStyle = presentationStyle,
906+ billState = billState,
907+ )
910908 }
911909
912910 analytics.requestShown(amount = amount)
@@ -929,17 +927,14 @@ class HomeViewModel @Inject constructor(
929927 cashLinkManager.cancelBillTimeout()
930928
931929 val paymentConfirmation = uiFlow.value.billState.paymentConfirmation ? : return @launch
932- withContext(Dispatchers .Main ) {
933- uiFlow.update {
934- val billState = it.billState
935- it.copy(
936- billState = billState.copy(
937- paymentConfirmation = paymentConfirmation.copy(state = ConfirmationState .Sending )
938- ),
939- )
940- }
930+ uiFlow.update {
931+ val billState = it.billState
932+ it.copy(
933+ billState = billState.copy(
934+ paymentConfirmation = paymentConfirmation.copy(state = ConfirmationState .Sending )
935+ ),
936+ )
941937 }
942-
943938 runCatching {
944939 paymentRepository.completePayment(
945940 paymentConfirmation.requestedAmount,
0 commit comments