mirror of
https://github.com/bitwarden/mobile
synced 2025-12-05 23:53:33 +00:00
Simplify shouldUpdate logic in SyncUpsertSendAsync
This commit is contained in:
@@ -281,27 +281,15 @@ namespace Bit.Core.Services
|
||||
|
||||
try
|
||||
{
|
||||
var shouldUpdate = true;
|
||||
var localSend = await _sendService.GetAsync(notification.Id);
|
||||
if (localSend != null && localSend.RevisionDate >= notification.RevisionDate)
|
||||
{
|
||||
shouldUpdate = false;
|
||||
}
|
||||
|
||||
if (shouldUpdate)
|
||||
if ((isEdit && localSend == null) || (!isEdit && localSend != null))
|
||||
{
|
||||
if (isEdit)
|
||||
{
|
||||
shouldUpdate = localSend != null;
|
||||
}
|
||||
else
|
||||
{
|
||||
shouldUpdate = localSend == null;
|
||||
return SyncCompleted(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldUpdate)
|
||||
{
|
||||
var remoteSend = await _apiService.GetSendAsync(notification.Id);
|
||||
if (remoteSend != null)
|
||||
{
|
||||
@@ -314,7 +302,6 @@ namespace Bit.Core.Services
|
||||
return SyncCompleted(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ApiException e)
|
||||
{
|
||||
if (e.Error != null && e.Error.StatusCode == System.Net.HttpStatusCode.NotFound && isEdit)
|
||||
|
||||
Reference in New Issue
Block a user