public async Task LoadItemsAsync(bool urlFilter = true, string searchFilter = null) { var combinedLogins = new List <CipherView>(); if (urlFilter) { var logins = await _cipherService.GetAllDecryptedByUrlAsync(_context.UrlString); if (logins?.Item1 != null) { combinedLogins.AddRange(logins.Item1); } if (logins?.Item2 != null) { combinedLogins.AddRange(logins.Item2); } } else { var logins = await _cipherService.GetAllDecryptedAsync(); combinedLogins.AddRange(logins); } _allItems = combinedLogins .Where(c => c.Type == Bit.Core.Enums.CipherType.Login && !c.IsDeleted) .Select(s => new CipherViewModel(s)) .ToList() ?? new List <CipherViewModel>(); FilterResults(searchFilter, new CancellationToken()); }
public static async Task <List <FilledItem> > GetFillItemsAsync(Parser parser, ICipherService cipherService) { if (parser.FieldCollection.FillableForLogin) { var ciphers = await cipherService.GetAllDecryptedByUrlAsync(parser.Uri); if (ciphers.Item1.Any() || ciphers.Item2.Any()) { var allCiphers = ciphers.Item1.ToList(); allCiphers.AddRange(ciphers.Item2.ToList()); return(allCiphers.Select(c => new FilledItem(c)).ToList()); } } else if (parser.FieldCollection.FillableForCard) { var ciphers = await cipherService.GetAllDecryptedAsync(); return(ciphers.Where(c => c.Type == CipherType.Card).Select(c => new FilledItem(c)).ToList()); } return(new List <FilledItem>()); }