-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Rework task status dialog #2502
Conversation
44893d5
to
cd406c2
Compare
This will allow us to have root context, which can manage dialogs.
First step towards aggregating all dialogs to a single root context (xxi screen)
… notifier initialization I don't know anymore why this was added in the first place, but it doesn't make much sense anymore.
Before we showed the trade dialog optimistically assuming we will get a dlc offer instantly, even though this is coming asynchronously. Although there was no issue with this yet, I think moving this to the xxi screen as well makes sense, because we might end up with orders not getting immediately matched. Also gets rid of a redundant show dialog.
This simplifies the handling of background tasks. Next we will adapt the async order change notifier to fit into the background task pattern. This will eventually allow us to prevent multiple dialogs to be shown at once.
This patch simplifies a lot of the logic that has grown historically. The key changes are the following: - The AsyncTrade does not differentiate between manual or other order reasons. - The TaskStatus.failed enum transports any error that happens during the trade. Replacing the `submitOrderError` and `failureReason`. - The `PendingOrder` has been removed in favor of the `TaskStatus`. This gives us a little bit less information for the dialog, but this is in alignment with simplifying the task dialog in general. - If the protocol fails at any point during the trade, the error will be reported to the task dialog. Before we had only a few scenarios where an error was actually reported back to the UI, depending on the dialog to time out. Note, if the protocol fails on the coordinator side the dialog would still have to time out since we do not yet send a `TradeError` message in that case.
cd406c2
to
891fc3f
Compare
891fc3f
to
3f06a74
Compare
It feels more logical to show the new task event event if the previous event was of a different type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very much appreciated :)
Disclaimer: I didn't review the flutter code 🙈
This will allow us to clearly differentiate between a reopen/resize and a rollover protocol. We need this in order to be able to add the order id to all trade related messages. BREAKING change due to a changed protocol message
@bonomat @luckysori I've additionally addressed the issue that errors on the coordinator side are not reported back to the app, thus the dialog timing out. These errors are now reported back to the app. This is still done using the websocket, we should probably also think about refactoring the The last changes also wraps all dlc renew protocol steps into dedicated Additionally I've added the Please have a look, this is not just a frontend change. |
5bc7cd3
to
ffb49d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall. The scope is a bit out of control, so it's hard to review thoroughly, but I think the changes should not be very risky.
mobile/lib/common/xxi_screen.dart
Outdated
// update the active task to the last event received on the stack. | ||
activeTask = task; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 I'm not sure. I think it's just weird to receive a different DLC message when you are in the middle of another protocol.
Maybe we should not be bubbling up events that don't make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general that should never happen except for the following two scenarios.
- The user did not close the dialog and another event happens. I think in this case its fine to simple overwrite the current active task. (Note, the active task will only be set to
null
if the dialog is closed. - The user reconnects in the middle of the protocol, that would trigger a
RecoverDlc
background task, which will change the task type. However the change is only maginal as only the text will be changed, stating that we lost connection and trying to recover.
All other scenarios would be bugs and I think it would be better to show them so they can be fixed instead of hiding them.
ffb49d2
to
e6a5e7c
Compare
This will allow us to uniquely identify the affected order BREAKING change due to a change protocol message.
This is useful during development when we reload the dart files to automatically re-render the dialog. However, the logic is only intended to get executed when there is an actual event, so this will fail if we reload manually. Adding this catch makes development a bit easier.
e6a5e7c
to
4fe862b
Compare
4f93e32
to
9de0610
Compare
Note, the app could have crashed after the coordinator not being online for while since the round value grew indefinitely.
9de0610
to
67f7592
Compare
I simplified a lot in this patch and addressed almost all shortcomings I noticed.
TaskStatus.failed
type allowing us to also show errors on rollover, etc.Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-05-04.at.13.23.10.mp4
fixes #2381
fixes #2089
fixes #1995