By adding the option not to resend pending messages when triggerRefreshOnConnected is called we fix a bug that results in duplicate messages being send.
This can be reproduced if you call Parley.getInstance().triggerRefreshOnConnected(); at the same that a message is being send. It's easy to reproduce this if you add this code to ChatActivity.java and send a few messages in the demo project:
With this fix we can call Parley.getInstance().triggerRefreshOnConnected(false); to prevent the duplicate messages.
Note: The solution could maybe be resolved in a better way. For example by adding another Message status type, like SEND_STATUS_SENDING, but this would be a larger refactor and I'm not sure if I can test all cases.
By adding the option not to resend pending messages when triggerRefreshOnConnected is called we fix a bug that results in duplicate messages being send.
This can be reproduced if you call
Parley.getInstance().triggerRefreshOnConnected();
at the same that a message is being send. It's easy to reproduce this if you add this code toChatActivity.java
and send a few messages in the demo project:Also check out this video:
https://github.com/parley-messaging/android-library/assets/2795333/c1870b52-8c1c-4a9b-b2bd-f8722dc7d86d
With this fix we can call Parley.getInstance().triggerRefreshOnConnected(false); to prevent the duplicate messages.
Note: The solution could maybe be resolved in a better way. For example by adding another Message status type, like
SEND_STATUS_SENDING
, but this would be a larger refactor and I'm not sure if I can test all cases.