1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-30 12:54:24 +01:00

return selection collection logic

This commit is contained in:
Kyle Spearrin 2019-06-26 17:50:57 -04:00
parent 2d91a893f7
commit a158021f46
2 changed files with 6 additions and 6 deletions

View File

@ -58,7 +58,8 @@ namespace Bit.App.Pages
public async Task<bool> SubmitAsync() public async Task<bool> SubmitAsync()
{ {
if(!Collections.Any(c => c.Checked)) var selectedCollectionIds = Collections?.Where(c => c.Checked).Select(c => c.Collection.Id);
if(!selectedCollectionIds?.Any() ?? true)
{ {
await Page.DisplayAlert(AppResources.AnErrorHasOccurred, AppResources.SelectOneCollection, await Page.DisplayAlert(AppResources.AnErrorHasOccurred, AppResources.SelectOneCollection,
AppResources.Ok); AppResources.Ok);
@ -71,8 +72,7 @@ namespace Bit.App.Pages
return false; return false;
} }
_cipherDomain.CollectionIds = new HashSet<string>( _cipherDomain.CollectionIds = new HashSet<string>(selectedCollectionIds);
Collections.Where(c => c.Checked).Select(c => c.Collection.Id));
try try
{ {
await _deviceActionService.ShowLoadingAsync(AppResources.Saving); await _deviceActionService.ShowLoadingAsync(AppResources.Saving);

View File

@ -86,7 +86,8 @@ namespace Bit.App.Pages
public async Task<bool> SubmitAsync() public async Task<bool> SubmitAsync()
{ {
if(!Collections?.Any(c => c.Checked) ?? true) var selectedCollectionIds = Collections?.Where(c => c.Checked).Select(c => c.Collection.Id);
if(!selectedCollectionIds?.Any() ?? true)
{ {
await Page.DisplayAlert(AppResources.AnErrorHasOccurred, AppResources.SelectOneCollection, await Page.DisplayAlert(AppResources.AnErrorHasOccurred, AppResources.SelectOneCollection,
AppResources.Ok); AppResources.Ok);
@ -102,8 +103,7 @@ namespace Bit.App.Pages
var cipherDomain = await _cipherService.GetAsync(CipherId); var cipherDomain = await _cipherService.GetAsync(CipherId);
var cipherView = await cipherDomain.DecryptAsync(); var cipherView = await cipherDomain.DecryptAsync();
var checkedCollectionIds = new HashSet<string>( var checkedCollectionIds = new HashSet<string>(selectedCollectionIds);
Collections.Where(c => c.Checked).Select(c => c.Collection.Id));
try try
{ {
await _deviceActionService.ShowLoadingAsync(AppResources.Saving); await _deviceActionService.ShowLoadingAsync(AppResources.Saving);