mirror of
https://github.com/bitwarden/mobile
synced 2025-12-16 00:03:22 +00:00
Support for lock/logout/remove accounts from account list (#1826)
* Support for lock/logout/remove accounts via long-press * establish and set listview height before showing * undo modification
This commit is contained in:
@@ -5,9 +5,15 @@
|
||||
x:Class="Bit.App.Controls.AccountViewCell"
|
||||
xmlns:controls="clr-namespace:Bit.App.Controls"
|
||||
xmlns:u="clr-namespace:Bit.App.Utilities"
|
||||
x:Name="_accountView"
|
||||
x:DataType="controls:AccountViewCellViewModel">
|
||||
<Grid RowSpacing="0"
|
||||
ColumnSpacing="0">
|
||||
ColumnSpacing="0"
|
||||
xct:TouchEffect.NativeAnimation="True"
|
||||
xct:TouchEffect.Command="{Binding SelectAccountCommand, Source={x:Reference _accountView}}"
|
||||
xct:TouchEffect.CommandParameter="{Binding .}"
|
||||
xct:TouchEffect.LongPressCommand="{Binding LongPressAccountCommand, Source={x:Reference _accountView}}"
|
||||
xct:TouchEffect.LongPressCommandParameter="{Binding .}">
|
||||
|
||||
<Grid.Resources>
|
||||
<u:InverseBoolConverter x:Key="inverseBool" />
|
||||
@@ -71,7 +77,7 @@
|
||||
<Label
|
||||
Grid.Row="2"
|
||||
Text="{u:I18n AccountUnlocked}"
|
||||
IsVisible="{Binding IsUnlocked}"
|
||||
IsVisible="{Binding IsUnlockedAndNotActive}"
|
||||
StyleClass="list-sub"
|
||||
FontAttributes="Italic"
|
||||
TextTransform="Lowercase"
|
||||
@@ -79,7 +85,7 @@
|
||||
<Label
|
||||
Grid.Row="2"
|
||||
Text="{u:I18n AccountLocked}"
|
||||
IsVisible="{Binding IsLocked}"
|
||||
IsVisible="{Binding IsLockedAndNotActive}"
|
||||
StyleClass="list-sub"
|
||||
FontAttributes="Italic"
|
||||
TextTransform="Lowercase"
|
||||
@@ -87,7 +93,7 @@
|
||||
<Label
|
||||
Grid.Row="2"
|
||||
Text="{u:I18n AccountLoggedOut}"
|
||||
IsVisible="{Binding IsLoggedOut}"
|
||||
IsVisible="{Binding IsLoggedOutAndNotActive}"
|
||||
StyleClass="list-sub"
|
||||
FontAttributes="Italic"
|
||||
TextTransform="Lowercase"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Bit.Core.Models.View;
|
||||
using System.Windows.Input;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
@@ -6,7 +7,13 @@ namespace Bit.App.Controls
|
||||
public partial class AccountViewCell : ViewCell
|
||||
{
|
||||
public static readonly BindableProperty AccountProperty = BindableProperty.Create(
|
||||
nameof(Account), typeof(AccountView), typeof(AccountViewCell), default(AccountView), BindingMode.OneWay);
|
||||
nameof(Account), typeof(AccountView), typeof(AccountViewCell));
|
||||
|
||||
public static readonly BindableProperty SelectAccountCommandProperty = BindableProperty.Create(
|
||||
nameof(SelectAccountCommand), typeof(ICommand), typeof(AccountViewCell));
|
||||
|
||||
public static readonly BindableProperty LongPressAccountCommandProperty = BindableProperty.Create(
|
||||
nameof(LongPressAccountCommand), typeof(ICommand), typeof(AccountViewCell));
|
||||
|
||||
public AccountViewCell()
|
||||
{
|
||||
@@ -19,6 +26,18 @@ namespace Bit.App.Controls
|
||||
set => SetValue(AccountProperty, value);
|
||||
}
|
||||
|
||||
public ICommand SelectAccountCommand
|
||||
{
|
||||
get => GetValue(SelectAccountCommandProperty) as ICommand;
|
||||
set => SetValue(SelectAccountCommandProperty, value);
|
||||
}
|
||||
|
||||
public ICommand LongPressAccountCommand
|
||||
{
|
||||
get => GetValue(LongPressAccountCommandProperty) as ICommand;
|
||||
set => SetValue(LongPressAccountCommandProperty, value);
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(string propertyName = null)
|
||||
{
|
||||
base.OnPropertyChanged(propertyName);
|
||||
|
||||
@@ -48,16 +48,31 @@ namespace Bit.App.Controls
|
||||
get => AccountView.AuthStatus == AuthenticationStatus.Unlocked;
|
||||
}
|
||||
|
||||
public bool IsUnlockedAndNotActive
|
||||
{
|
||||
get => IsUnlocked && !IsActive;
|
||||
}
|
||||
|
||||
public bool IsLocked
|
||||
{
|
||||
get => AccountView.AuthStatus == AuthenticationStatus.Locked;
|
||||
}
|
||||
|
||||
public bool IsLockedAndNotActive
|
||||
{
|
||||
get => IsLocked && !IsActive;
|
||||
}
|
||||
|
||||
public bool IsLoggedOut
|
||||
{
|
||||
get => AccountView.AuthStatus == AuthenticationStatus.LoggedOut;
|
||||
}
|
||||
|
||||
public bool IsLoggedOutAndNotActive
|
||||
{
|
||||
get => IsLoggedOut && !IsActive;
|
||||
}
|
||||
|
||||
public string AuthStatusIconActive
|
||||
{
|
||||
get => BitwardenIcons.CheckCircle;
|
||||
|
||||
Reference in New Issue
Block a user