deltachat / deltachat-ios

Email-based instant messaging for iOS.
GNU General Public License v3.0
314 stars 49 forks source link

chatlist not always updated after sharing #1591

Closed r10s closed 2 years ago

r10s commented 2 years ago

while the chatlist is updated when eg. sharing from gallery -> delta chat, the update is missing when sharing from delta chat -> delta chat.

example:

-> the chatlist is not updated.

this may also be buggy for sharing files or other things this way, i tested only for webxdc.

EDIT: also, the message-list is not updated when sharing to the same chat.

cyBerta commented 2 years ago

@r10s events like DC_EVENT_MSGS_CHANGED are not emitted when sharing from DC to DC. I guess because they are sent from the extension app, which is a different context.

But maybe the core's dc_send_msg_sync does't emit the event. It is not a very often used method, so bugs could hide for longer here.

A robust solution would be to reintroduce refreshInBg() in onViewDidAppear

r10s commented 2 years ago

A robust solution would be to reintroduce refreshInBg() in onViewDidAppear

well, but also an expensive one :) and one with not-so-nice ux as the user will see the old state flashing up.

better we look out for why the update is missing in exactly that case (in other cases, things work as expected)

r10s commented 2 years ago

But maybe the core's dc_send_msg_sync does't emit the event.

dc_send_msg_sync emits MSGS_CHANGED, i just checked that. however, this does not really help as it is emitted to the share-instance, but we need to update the main-instance.

for other cases, this works by setting the flag UserDefaults.hasExtensionAttemptedToSend in the share-instance and check the flag from the main-instance. we are doing this in applicationWillEnterForeground() - probably this is the issue as the main app is already in foreground.