1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-16 00:03:22 +00:00

Changed all C# control flow block statements to include space between keyword and open paren (#800)

This commit is contained in:
Chad Scharf
2020-03-28 09:16:28 -04:00
committed by GitHub
parent 6c00ac43fc
commit 3c18fd7636
225 changed files with 2406 additions and 2406 deletions

View File

@@ -57,7 +57,7 @@ namespace Bit.Core.Services
public async Task<DateTime?> GetLastSyncAsync()
{
var userId = await _userService.GetUserIdAsync();
if(userId == null)
if (userId == null)
{
return null;
}
@@ -67,7 +67,7 @@ namespace Bit.Core.Services
public async Task SetLastSyncAsync(DateTime date)
{
var userId = await _userService.GetUserIdAsync();
if(userId == null)
if (userId == null)
{
return;
}
@@ -78,7 +78,7 @@ namespace Bit.Core.Services
{
SyncStarted();
var isAuthenticated = await _userService.IsAuthenticatedAsync();
if(!isAuthenticated)
if (!isAuthenticated)
{
return SyncCompleted(false);
}
@@ -86,11 +86,11 @@ namespace Bit.Core.Services
var needsSyncResult = await NeedsSyncingAsync(forceSync);
var needsSync = needsSyncResult.Item1;
var skipped = needsSyncResult.Item2;
if(skipped)
if (skipped)
{
return SyncCompleted(false);
}
if(!needsSync)
if (!needsSync)
{
await SetLastSyncAsync(now);
return SyncCompleted(false);
@@ -110,7 +110,7 @@ namespace Bit.Core.Services
}
catch
{
if(allowThrowOnError)
if (allowThrowOnError)
{
throw;
}
@@ -124,16 +124,16 @@ namespace Bit.Core.Services
public async Task<bool> SyncUpsertFolderAsync(SyncFolderNotification notification, bool isEdit)
{
SyncStarted();
if(await _userService.IsAuthenticatedAsync())
if (await _userService.IsAuthenticatedAsync())
{
try
{
var localFolder = await _folderService.GetAsync(notification.Id);
if((!isEdit && localFolder == null) ||
if ((!isEdit && localFolder == null) ||
(isEdit && localFolder != null && localFolder.RevisionDate < notification.RevisionDate))
{
var remoteFolder = await _apiService.GetFolderAsync(notification.Id);
if(remoteFolder != null)
if (remoteFolder != null)
{
var userId = await _userService.GetUserIdAsync();
await _folderService.UpsertAsync(new FolderData(remoteFolder, userId));
@@ -153,7 +153,7 @@ namespace Bit.Core.Services
public async Task<bool> SyncDeleteFolderAsync(SyncFolderNotification notification)
{
SyncStarted();
if(await _userService.IsAuthenticatedAsync())
if (await _userService.IsAuthenticatedAsync())
{
await _folderService.DeleteAsync(notification.Id);
_messagingService.Send("syncedDeletedFolder", new Dictionary<string, string>
@@ -168,28 +168,28 @@ namespace Bit.Core.Services
public async Task<bool> SyncUpsertCipherAsync(SyncCipherNotification notification, bool isEdit)
{
SyncStarted();
if(await _userService.IsAuthenticatedAsync())
if (await _userService.IsAuthenticatedAsync())
{
try
{
var shouldUpdate = true;
var localCipher = await _cipherService.GetAsync(notification.Id);
if(localCipher != null && localCipher.RevisionDate >= notification.RevisionDate)
if (localCipher != null && localCipher.RevisionDate >= notification.RevisionDate)
{
shouldUpdate = false;
}
var checkCollections = false;
if(shouldUpdate)
if (shouldUpdate)
{
if(isEdit)
if (isEdit)
{
shouldUpdate = localCipher != null;
checkCollections = true;
}
else
{
if(notification.CollectionIds == null || notification.OrganizationId == null)
if (notification.CollectionIds == null || notification.OrganizationId == null)
{
shouldUpdate = localCipher == null;
}
@@ -201,15 +201,15 @@ namespace Bit.Core.Services
}
}
if(!shouldUpdate && checkCollections && notification.OrganizationId != null &&
if (!shouldUpdate && checkCollections && notification.OrganizationId != null &&
notification.CollectionIds != null && notification.CollectionIds.Any())
{
var collections = await _collectionService.GetAllAsync();
if(collections != null)
if (collections != null)
{
foreach(var c in collections)
foreach (var c in collections)
{
if(notification.CollectionIds.Contains(c.Id))
if (notification.CollectionIds.Contains(c.Id))
{
shouldUpdate = true;
break;
@@ -218,10 +218,10 @@ namespace Bit.Core.Services
}
}
if(shouldUpdate)
if (shouldUpdate)
{
var remoteCipher = await _apiService.GetCipherAsync(notification.Id);
if(remoteCipher != null)
if (remoteCipher != null)
{
var userId = await _userService.GetUserIdAsync();
await _cipherService.UpsertAsync(new CipherData(remoteCipher, userId));
@@ -233,9 +233,9 @@ namespace Bit.Core.Services
}
}
}
catch(ApiException e)
catch (ApiException e)
{
if(e.Error != null && e.Error.StatusCode == System.Net.HttpStatusCode.NotFound && isEdit)
if (e.Error != null && e.Error.StatusCode == System.Net.HttpStatusCode.NotFound && isEdit)
{
await _cipherService.DeleteAsync(notification.Id);
_messagingService.Send("syncedDeletedCipher", new Dictionary<string, string>
@@ -252,7 +252,7 @@ namespace Bit.Core.Services
public async Task<bool> SyncDeleteCipherAsync(SyncCipherNotification notification)
{
SyncStarted();
if(await _userService.IsAuthenticatedAsync())
if (await _userService.IsAuthenticatedAsync())
{
await _cipherService.DeleteAsync(notification.Id);
_messagingService.Send("syncedDeletedCipher", new Dictionary<string, string>
@@ -281,12 +281,12 @@ namespace Bit.Core.Services
private async Task<Tuple<bool, bool>> NeedsSyncingAsync(bool forceSync)
{
if(forceSync)
if (forceSync)
{
return new Tuple<bool, bool>(true, false);
}
var lastSync = await GetLastSyncAsync();
if(lastSync == null || lastSync == DateTime.MinValue)
if (lastSync == null || lastSync == DateTime.MinValue)
{
return new Tuple<bool, bool>(true, false);
}
@@ -294,7 +294,7 @@ namespace Bit.Core.Services
{
var response = await _apiService.GetAccountRevisionDateAsync();
var d = CoreHelpers.Epoc.AddMilliseconds(response);
if(d <= lastSync.Value)
if (d <= lastSync.Value)
{
return new Tuple<bool, bool>(false, false);
}
@@ -309,9 +309,9 @@ namespace Bit.Core.Services
private async Task SyncProfileAsync(ProfileResponse response)
{
var stamp = await _userService.GetSecurityStampAsync();
if(stamp != null && stamp != response.SecurityStamp)
if (stamp != null && stamp != response.SecurityStamp)
{
if(_logoutCallbackAsync != null)
if (_logoutCallbackAsync != null)
{
await _logoutCallbackAsync(true);
}
@@ -346,15 +346,15 @@ namespace Bit.Core.Services
private async Task SyncSettingsAsync(string userId, DomainsResponse response)
{
var eqDomains = new List<List<string>>();
if(response != null && response.EquivalentDomains != null)
if (response != null && response.EquivalentDomains != null)
{
eqDomains = eqDomains.Concat(response.EquivalentDomains).ToList();
}
if(response != null && response.GlobalEquivalentDomains != null)
if (response != null && response.GlobalEquivalentDomains != null)
{
foreach(var global in response.GlobalEquivalentDomains)
foreach (var global in response.GlobalEquivalentDomains)
{
if(global.Domains.Any())
if (global.Domains.Any())
{
eqDomains.Add(global.Domains);
}