Skip to content
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

Draft is cleared before the message is saved to the database #3489

Open
link2xt opened this issue Dec 13, 2024 · 6 comments
Open

Draft is cleared before the message is saved to the database #3489

link2xt opened this issue Dec 13, 2024 · 6 comments

Comments

@link2xt
Copy link
Contributor

link2xt commented Dec 13, 2024

Here the draft is removed before the message is saved to the database:

// for a quick ui feedback, we clear the related controls immediately on sending messages.
// for drafts, however, we do not change the controls, the activity may be resumed.
if (action==ACTION_SEND_OUT) {
composeText.setText("");
inputPanel.clearQuote();
}

If processing takes long, as may happen for images on slow devices, this results in the message disappearing from the compose area but not appearing in the chat for a noticeable time.

The way to fix this is probably to disable the send button and only clear the draft and re-enable the button when sendMsg returns.

This is also a problem because sendMsg may fail for some reason and then the draft is lost. In Desktop this is fixed: deltachat/deltachat-desktop#4340

Forum thread:
https://support.delta.chat/t/the-behavior-of-the-message-block-when-sending/3388

@link2xt link2xt transferred this issue from deltachat/deltachat-core-rust Dec 14, 2024
@adbenitez
Copy link
Member

If processing takes long, as may happen for images on slow devices, this results in the message disappearing from the compose area but not appearing in the chat for a noticeable time.

I think that is kinda ok for a corner case, a blocking UI don't letting you type the next message and an spinning sending button is not much better

@iequidoo
Copy link
Contributor

a blocking UI don't letting you type the next message and an spinning sending button is not much better

We may not block the UI, but just disable the Send button temporarily. If the user wants to type the next message, they can clear the input field manually or do whatever they want with the draft. Then before clearing the draft Delta Chat should only check that it hasn't changed. And if the draft is lost, the user should blame themselves.

@adbenitez
Copy link
Member

adbenitez commented Dec 20, 2024

We may not block the UI, but just disable the Send button temporarily. If the user wants to type the next message, they can clear the input field manually

that is even worse, a good compromise would be clearing the draft but the send button turning to spinning, even then you can't use the attach button then

and notice that when I said "blocking the UI" I didn't meant that the UI is frozen, but if you can't draft or send a new message in the meanwhile that is "blocking" you

@iequidoo
Copy link
Contributor

iequidoo commented Dec 20, 2024

a good compromise would be clearing the draft but the send button turning to spinning, even then you can't use the attach button then

Clearing the draft before it's sent is a way to lose it. And then it seems the spinning Send button isn't a solution. Is the idea of combining the Attach and Send buttons good at all? Sometimes i forget that it works this way, type a text and then understand that i can't attach an image. Sometimes i understand while typing a text that i picked the wrong image and want to replace it, then i need to select all the text, cut it, change the attachment and paste the text. Telegram has the same problem. But e.g. WhatsApp doesn't combine these buttons. If we do the same, we may block (make spinning) only the Send button while sending the draft and the user can type text and use the Attach button.

EDIT: In DC Desktop we also don't combine these buttons and i'd say that's more convenient. Why can't we unify things here?

@adbenitez
Copy link
Member

changing the combination of attach button and send button just to show an spinning icon is an overkill, but it will also mean we remove the draft so it doesn't solve the original problem, I guess it would really need to block and not allow editing so if message fails to be created, the draft is preserved

under what conditions would message actually fail to create? i have never had this problem in android

@iequidoo
Copy link
Contributor

changing the combination of attach button and send button just to show an spinning icon is an overkill

Not just to show a spinning icon, but also to unify UIs with Desktop.

under what conditions would message actually fail to create? i have never had this problem in android

I also haven't had this problem, but at least the chat may change its state to "can't send", e.g. a race happens and an incoming message breaking the chat protection arrives. It should be possible to accept the broken protection then and send the draft again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants