From a158021f4621302b73960608934285cecb0df184 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 26 Jun 2019 17:50:57 -0400 Subject: [PATCH] return selection collection logic --- src/App/Pages/Vault/CollectionsPageViewModel.cs | 6 +++--- src/App/Pages/Vault/SharePageViewModel.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/App/Pages/Vault/CollectionsPageViewModel.cs b/src/App/Pages/Vault/CollectionsPageViewModel.cs index a57a0be24..1fef161e7 100644 --- a/src/App/Pages/Vault/CollectionsPageViewModel.cs +++ b/src/App/Pages/Vault/CollectionsPageViewModel.cs @@ -58,7 +58,8 @@ namespace Bit.App.Pages public async Task 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, AppResources.Ok); @@ -71,8 +72,7 @@ namespace Bit.App.Pages return false; } - _cipherDomain.CollectionIds = new HashSet( - Collections.Where(c => c.Checked).Select(c => c.Collection.Id)); + _cipherDomain.CollectionIds = new HashSet(selectedCollectionIds); try { await _deviceActionService.ShowLoadingAsync(AppResources.Saving); diff --git a/src/App/Pages/Vault/SharePageViewModel.cs b/src/App/Pages/Vault/SharePageViewModel.cs index f57f9eec3..013f2d5eb 100644 --- a/src/App/Pages/Vault/SharePageViewModel.cs +++ b/src/App/Pages/Vault/SharePageViewModel.cs @@ -86,7 +86,8 @@ namespace Bit.App.Pages public async Task 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, AppResources.Ok); @@ -102,8 +103,7 @@ namespace Bit.App.Pages var cipherDomain = await _cipherService.GetAsync(CipherId); var cipherView = await cipherDomain.DecryptAsync(); - var checkedCollectionIds = new HashSet( - Collections.Where(c => c.Checked).Select(c => c.Collection.Id)); + var checkedCollectionIds = new HashSet(selectedCollectionIds); try { await _deviceActionService.ShowLoadingAsync(AppResources.Saving);