michaelkourlas / voipms-sms-client

Popular Android messaging app for VoIP.ms, a Canadian VoIP provider
https://play.google.com/store/apps/details?id=net.kourlas.voipms_sms
Apache License 2.0
218 stars 52 forks source link

Problems with Contacts with lots of messages #211

Closed yulman19 closed 3 years ago

yulman19 commented 4 years ago

Whenever I have a contact that I have a big message history with, the app becomes slow or unresponsive

michaelkourlas commented 4 years ago

This is a long-running performance issue with no clear fix.

yulman19 commented 4 years ago

Is there a workaround, like clearing the db?

michaelkourlas commented 4 years ago

You can try deleting some of the message history.

julianlam commented 3 years ago

@michaelkourlas Can we discuss the technical problems behind why this is a difficult issue to fix? I really appreciate this software you've put together and would love to help debug if I can.

It feels like an issue with synchronization, like the app is requesting all messages in the history of that contact, since the slowdown gets worse the more messages there are for that particular contact.

michaelkourlas commented 3 years ago

Yes, that's the problem. I'm sure there's a way to fix it by retrieving only part of the message history at a time, and retrieving more automatically as the user scrolls up. I just haven't done the research required to figure out how to make that work with Android's RecyclerView.

julianlam commented 3 years ago

A workaround currently is to set the synchronization date to some recent date, and then drop the local database.

There are currently no tools to automate this, I've opened #226 as a suggestion.

julianlam commented 3 years ago

Yes, that's the problem. I'm sure there's a way to fix it by retrieving only part of the message history at a time, and retrieving more automatically as the user scrolls up.

I'm confused as to why VoIP.ms API needs to be contacted to refresh the messages list when sending a message, can you not just append the message on successful response, and not synchronize?

michaelkourlas commented 3 years ago

By "requesting all messages in the history of that contact", I understood you to be referring to requesting all the messages from the local database. That's what the app does when it loads a contact -- it doesn't go and fetch them from VoIP.ms every time.

michaelkourlas commented 3 years ago

In addition, the app doesn't go and retrieve messages from VoIP.ms every time a message is sent either, so I'm not sure what you're referring to.

julianlam commented 3 years ago

Right, my mistake. So the app retrieves the message history from the local database. 👍

It seems to do this on message send as well, because if the message history is very long, the app will retry sending the message multiple times, until the message history is updated.

What I was referring to was the UX flow for sending a message seems to trigger a refresh of the message list. However is this necessary? I assumed (perhaps erroneously) that you could just append the message sent to the UI, without having to refresh the message list.

michaelkourlas commented 3 years ago

I assumed (perhaps erroneously) that you could just append the message sent to the UI, without having to refresh the message list.

I'm not sure this is possible, but in any event I believe the core issue is that we load more messages than can be displayed anyway.

michaelkourlas commented 3 years ago

The app now only loads 100 messages initially, loading more as you scroll up.

julianlam commented 3 years ago

Thanks @michaelkourlas, I really appreciate your hard work 🙂