mirror of
https://github.com/bitwarden/mobile
synced 2025-12-17 16:53:26 +00:00
Change sync started/compelted flag
This commit is contained in:
@@ -13,7 +13,6 @@ namespace Bit.App.Services
|
|||||||
public class SyncService : ISyncService
|
public class SyncService : ISyncService
|
||||||
{
|
{
|
||||||
private const string LastSyncKey = "lastSync";
|
private const string LastSyncKey = "lastSync";
|
||||||
private int _syncsInProgress = 0;
|
|
||||||
|
|
||||||
private readonly ICipherApiRepository _cipherApiRepository;
|
private readonly ICipherApiRepository _cipherApiRepository;
|
||||||
private readonly IFolderApiRepository _folderApiRepository;
|
private readonly IFolderApiRepository _folderApiRepository;
|
||||||
@@ -41,7 +40,7 @@ namespace Bit.App.Services
|
|||||||
_settings = settings;
|
_settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SyncInProgress => _syncsInProgress > 0;
|
public bool SyncInProgress { get; private set; }
|
||||||
|
|
||||||
public async Task<bool> SyncAsync(string id)
|
public async Task<bool> SyncAsync(string id)
|
||||||
{
|
{
|
||||||
@@ -57,7 +56,7 @@ namespace Bit.App.Services
|
|||||||
{
|
{
|
||||||
SyncCompleted(false);
|
SyncCompleted(false);
|
||||||
|
|
||||||
if(cipher.StatusCode == System.Net.HttpStatusCode.Forbidden
|
if(cipher.StatusCode == System.Net.HttpStatusCode.Forbidden
|
||||||
|| cipher.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
|| cipher.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
||||||
{
|
{
|
||||||
MessagingCenter.Send(Application.Current, "Logout", (string)null);
|
MessagingCenter.Send(Application.Current, "Logout", (string)null);
|
||||||
@@ -287,13 +286,13 @@ namespace Bit.App.Services
|
|||||||
|
|
||||||
private void SyncStarted()
|
private void SyncStarted()
|
||||||
{
|
{
|
||||||
_syncsInProgress++;
|
SyncInProgress = true;
|
||||||
MessagingCenter.Send(Application.Current, "SyncStarted");
|
MessagingCenter.Send(Application.Current, "SyncStarted");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SyncCompleted(bool successfully)
|
private void SyncCompleted(bool successfully)
|
||||||
{
|
{
|
||||||
_syncsInProgress--;
|
SyncInProgress = false;
|
||||||
MessagingCenter.Send(Application.Current, "SyncCompleted", successfully);
|
MessagingCenter.Send(Application.Current, "SyncCompleted", successfully);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user