fix: Do not handle sending event updates which are already synced
This is an edge case which might occour on unstable data connections. The user sends an event and receives the sync before the response to the sending http request. This leads to duplicated events while the response actually should be ignored at this point.
This commit is contained in:
parent
8548a3ab28
commit
210c925a0a
|
|
@ -828,6 +828,12 @@ class FamedlySdkHiveDatabase extends DatabaseApi {
|
||||||
?.tryGet<int>(messageSendingStatusKey) ??
|
?.tryGet<int>(messageSendingStatusKey) ??
|
||||||
2;
|
2;
|
||||||
|
|
||||||
|
// Is this the response to a sending event which is already synced? Then
|
||||||
|
// there is nothing to do here.
|
||||||
|
if (newStatus != 2 && prevEvent?.status == 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final status =
|
final status =
|
||||||
newStatus == -1 || prevEvent == null || prevEvent.status == null
|
newStatus == -1 || prevEvent == null || prevEvent.status == null
|
||||||
? newStatus
|
? newStatus
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue