1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-10 21:33:36 +00:00

convert to local functions to avoid continuewith

This commit is contained in:
Kyle Spearrin
2019-04-19 16:15:29 -04:00
parent 6d8af4d97a
commit c6ce3e9480
5 changed files with 95 additions and 78 deletions

View File

@@ -67,10 +67,15 @@ namespace Bit.Core.Services
return new List<CollectionView>();
}
var decCollections = new List<CollectionView>();
async Task decryptAndAddCollectionAsync(Collection collection)
{
var c = await collection.DecryptAsync();
decCollections.Add(c);
}
var tasks = new List<Task>();
foreach(var collection in collections)
{
tasks.Add(collection.DecryptAsync().ContinueWith(async c => decCollections.Add(await c)));
tasks.Add(decryptAndAddCollectionAsync(collection));
}
await Task.WhenAll(tasks);
return decCollections.OrderBy(c => c, new CollectionLocaleComparer(_i18nService)).ToList();