New behavior for updating messages

In past versions of Delta Chat, the title bar would only show “Updating…” when new messages arrived. In the latest version of Delta Chat, the title bar shows “Updating…” every time you switch to the app, even when there are no new messages and nothing to update.

Does this reflect a change to how Delta Chat checks for messages? Is this a deliberate change which improves Delta Chat performance?

1 Like

This was changed to show “Updating…” when Delta Chat checks for messages, right after logging in but before receiving an answer telling if there are messages. Previously it was in the “Connected” state. How the app checks for messages is not changed, only the connectivity status was adjusted.

This is done for two reasons.

First, there is now a notification on Android which is shown while the app is “Updating…” to avoid the app being placed into background. We don’t want this notification to disappear while the app is not sure if there are new messages yet. iOS has similar logic when push notification is received.

Second, on very slow connections if the app is “Updating…” user can see that new messages may still arrive, and once the status bar changes to normal state displaying account name it is possible to see that there are no messages and fetching is finished. Previously the app asked the server for new updates and switched to “Connected” until the server responds, which might take a while. User could not tell if the app is “Connected” because it already checked for messages and there are none or because it still waits for the server answer.

If this “Updating…” display is annoying because of brief flickering, then I think it should be solved in the UI by only displaying the new state if 1 second or so passed since the last connectivity change.

1 Like

Thanks for your answer. I don’t have a problem with flickering but I am seeing “Updating…” every time I switch from another app to DC, which did not happen before. Does this mean that DC is logging in every time I switch to the app? Was DC always logging in every time I switched to the app, but only now shows this in the title bar? Why does DC need to log in every time I switch to the app, if its already logged in?

It is not logging in every time, it checks if connections is still there by trying to fetch new messages. Switching to the app interrupts IMAP IDLE.

I didn’t realize switching to the app interrupts IMAP IDLE, thanks for explaining. Does DC interrupt IMAP IDLE on purpose or this is just how the OS works?

It’s just how the OS works. Android and iOS both set aggressive limits for how applications can operate in the background, to prevent buggy or malicious applications from running the user’s battery down. One of those limits is that applications cannot maintain a network connection (such as to the mail server) while they are not open.

My question is more like if IMAP IDLE is working fine in the background, on an OS which supports background network conncetions, why interrupt that when switching to the app? Is it just because DC doesn’t trust IMAP IDLE 100% and thinks maybe it missed something?

“Interrupt” means that core checks if IMAP connection is still working. There is a maybe_network API in the core that is called by the UIs every time they think connections should be checked. This is normally done when OS says there are network changes, e.g. if you switch to a new Wi-Fi it makes sense to test the connection because it is likely not working anymore due to IP address change, but UIs also call this maybe_network when the app goes foreground just in case.

2 Likes

After this “Updating…” my Android and PC stops receiving any messages at least 20 min and +

However, I want to note that I really reconnected to wifi and on my phone from the mobile network to wifi… However, you can explain what this threatens, in simpler language, more schematic or something…

P.S.Having studied the topic, I probably understood everything about what you are talking about here, correct me if this is not the case.

Sounds to me like you are perhaps not using IMAP IDLE, not receiving messages for that time is not normal, what mail provider do you use?

Not sure IMAP IDLE it must be on or off… in android app can not find this :thinking:
mailchat.pl