From 2556c0e96060e192ecd62708bf3dca4adc68b20b Mon Sep 17 00:00:00 2001 From: Richard Holzeis Date: Wed, 8 May 2024 08:26:06 +0200 Subject: [PATCH] fix: Show pending trade dialog immediately when submitting an order Otherwise, a short delay could happen after submitting the order before the dialog is shown. This was more obvious on the test vm the other day, when the submit order request timed out. --- mobile/native/src/trade/order/handler.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mobile/native/src/trade/order/handler.rs b/mobile/native/src/trade/order/handler.rs index f3f817fe9..e30b6222d 100644 --- a/mobile/native/src/trade/order/handler.rs +++ b/mobile/native/src/trade/order/handler.rs @@ -70,6 +70,10 @@ pub async fn submit_order( order: Order, channel_opening_params: Option, ) -> Result { + event::publish(&EventInternal::BackgroundNotification( + BackgroundTask::AsyncTrade(TaskStatus::Pending), + )); + submit_order_internal(order, channel_opening_params) .await .inspect_err(report_error_to_coordinator) @@ -129,10 +133,6 @@ pub async fn submit_order_internal( set_order_to_open_and_update_ui(order.id).map_err(SubmitOrderError::Storage)?; update_position_after_order_submitted(&order).map_err(SubmitOrderError::Storage)?; - event::publish(&EventInternal::BackgroundNotification( - BackgroundTask::AsyncTrade(TaskStatus::Pending), - )); - Ok(order.id) }