From 6c496bea1412b735baa9ba9864ddc29a471b8214 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 19 Jul 2016 19:01:40 -0400 Subject: [PATCH] Change sync started/compelted flag --- src/App/Services/SyncService.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/App/Services/SyncService.cs b/src/App/Services/SyncService.cs index 19537c410..5678fe538 100644 --- a/src/App/Services/SyncService.cs +++ b/src/App/Services/SyncService.cs @@ -13,7 +13,6 @@ namespace Bit.App.Services public class SyncService : ISyncService { private const string LastSyncKey = "lastSync"; - private int _syncsInProgress = 0; private readonly ICipherApiRepository _cipherApiRepository; private readonly IFolderApiRepository _folderApiRepository; @@ -41,7 +40,7 @@ namespace Bit.App.Services _settings = settings; } - public bool SyncInProgress => _syncsInProgress > 0; + public bool SyncInProgress { get; private set; } public async Task SyncAsync(string id) { @@ -57,7 +56,7 @@ namespace Bit.App.Services { SyncCompleted(false); - if(cipher.StatusCode == System.Net.HttpStatusCode.Forbidden + if(cipher.StatusCode == System.Net.HttpStatusCode.Forbidden || cipher.StatusCode == System.Net.HttpStatusCode.Unauthorized) { MessagingCenter.Send(Application.Current, "Logout", (string)null); @@ -287,13 +286,13 @@ namespace Bit.App.Services private void SyncStarted() { - _syncsInProgress++; + SyncInProgress = true; MessagingCenter.Send(Application.Current, "SyncStarted"); } private void SyncCompleted(bool successfully) { - _syncsInProgress--; + SyncInProgress = false; MessagingCenter.Send(Application.Current, "SyncCompleted", successfully); } }