deltachat-core-rust icon indicating copy to clipboard operation
deltachat-core-rust copied to clipboard

Webxdc: add ffi to get "update sending state"

Open r10s opened this issue 2 years ago • 4 comments

currently, the end-user of an Webxdc has no good idea about whether all updates are sent out or not.

the idea is to let the UI show a similar online indicator as in the bubbles - so a rotating circle or so when there is sth. pending and a checkmark when all update messages are sent.

the indicator should not be shown by the Webxdc itself, but just by the implementation, a good place seems to be right of the title that is shown in all UI anyway. the .xdc does not need to be adapted then.

technically, we could add a separate ffi or enhance dc_msg_get_webxdc_info().

r10s avatar May 15 '22 10:05 r10s

I wouldn't show an arrow when there are no more updates to be send, because it has no benefit (If there is no spinning circle then it's obvious that no more messages are in the queue) and only clutters the view.

Septias avatar May 18 '22 10:05 Septias

additional notes:

  • the "update sending states" should also take https://github.com/deltachat/deltachat-core-rust/pull/3417 into account (pending updates that do not exist as messages yet)

  • we have a similar issue with resending of messages. also there, the initial message is already sent successfully, but "additional things" are not (in ui, we could still use the same indicator in the bubbles, but internally, we probably need an additional state for that)

so, maybe generalize these cases to sth. as dc_msg_get_upload_state() or dc_msg_is_all_work_done() (the latter wording is already known by dc_accounts_t).

r10s avatar Jun 11 '22 08:06 r10s

Is there a way to transport a promise over ffi-boundaries? Because if we just add a normal ffi-funkcion or enhance dc_msg_get_webxdc_info() we have to bussily wait for smtp-requests to finish. This seems like a waste of ressources.

I know that there is a way to transport Promises in webassembly, but I'm not sure about ours

Edit: I've taken a closer look at our setup and I guess I'm writing something event-based since that seems to be the taken approach

Septias avatar Sep 01 '22 14:09 Septias

Is there a way to transport a promise over ffi-boundaries?

not really, we have to do that over events.

i suggest to do it similar to dc_get_connectivity():

  1. having a function to query the "update sending state" instantly (without network involved, but that should be doable as we could check the corresponding tables)
  2. plus an event that indicates that the "update sending state" has changed.

r10s avatar Sep 01 '22 19:09 r10s