[SG-808] Only show 'remove account' option if user is in Accounts list (#2179)

* Only show 'remove account' option if user is in Accounts list

* Condense existing email logic

* Add line break

* Condense to local variable

* Cleanup spacing
This commit is contained in:
Robyn MacCallum 2022-11-10 07:06:17 -05:00 committed by GitHub
parent 9ae269dd57
commit 0106732cbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
using Bit.App.Abstractions; using Bit.App.Abstractions;
@ -247,7 +249,8 @@ namespace Bit.App.Pages
private async Task MoreAsync() private async Task MoreAsync()
{ {
var buttons = IsEmailEnabled var emailExists = _stateService.AccountViews != null && _stateService.AccountViews.Any(e => e.Email == Email);
var buttons = IsEmailEnabled || !emailExists
? new[] { AppResources.GetPasswordHint } ? new[] { AppResources.GetPasswordHint }
: new[] { AppResources.GetPasswordHint, AppResources.RemoveAccount }; : new[] { AppResources.GetPasswordHint, AppResources.RemoveAccount };
var selection = await _deviceActionService.DisplayActionSheetAsync(AppResources.Options, AppResources.Cancel, null, buttons); var selection = await _deviceActionService.DisplayActionSheetAsync(AppResources.Options, AppResources.Cancel, null, buttons);