1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-13 14:53:18 +00:00

Further simplify SyncService code

This commit is contained in:
Bernd Schoolmann
2023-08-03 19:40:53 +02:00
parent ed75aa7942
commit cd45992e6b

View File

@@ -277,17 +277,18 @@ namespace Bit.Core.Services
public async Task<bool> SyncUpsertSendAsync(SyncSendNotification notification, bool isEdit) public async Task<bool> SyncUpsertSendAsync(SyncSendNotification notification, bool isEdit)
{ {
SyncStarted(); SyncStarted();
if (!await _stateService.IsAuthenticatedAsync()) return SyncCompleted(false); if (!await _stateService.IsAuthenticatedAsync())
{
return SyncCompleted(false);
}
try try
{ {
var localSend = await _sendService.GetAsync(notification.Id); var localSend = await _sendService.GetAsync(notification.Id);
if (localSend != null && localSend.RevisionDate >= notification.RevisionDate) if (localSend != null && localSend.RevisionDate >= notification.RevisionDate
&& ((isEdit && localSend == null) || (!isEdit && localSend != null)))
{ {
if ((isEdit && localSend == null) || (!isEdit && localSend != null)) return SyncCompleted(false);
{
return SyncCompleted(false);
}
} }
var remoteSend = await _apiService.GetSendAsync(notification.Id); var remoteSend = await _apiService.GetSendAsync(notification.Id);