mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-30 12:54:24 +01:00
collection management when adding new cipher
This commit is contained in:
parent
056b9fd2de
commit
3bd01067e3
@ -409,6 +409,9 @@
|
|||||||
HorizontalOptions="End" />
|
HorizontalOptions="End" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<BoxView StyleClass="box-row-separator" />
|
<BoxView StyleClass="box-row-separator" />
|
||||||
|
<Button Text="{u:I18n Attachments}" StyleClass="box-button-row"
|
||||||
|
IsVisible="{Binding EditMode}"
|
||||||
|
Clicked="Attachments_Clicked"></Button>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout StyleClass="box">
|
<StackLayout StyleClass="box">
|
||||||
<StackLayout StyleClass="box-row-header">
|
<StackLayout StyleClass="box-row-header">
|
||||||
@ -500,6 +503,55 @@
|
|||||||
<Button Text="{u:I18n NewCustomField}" StyleClass="box-button-row"
|
<Button Text="{u:I18n NewCustomField}" StyleClass="box-button-row"
|
||||||
Clicked="NewField_Clicked"></Button>
|
Clicked="NewField_Clicked"></Button>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
<StackLayout StyleClass="box">
|
||||||
|
<StackLayout StyleClass="box-row-header">
|
||||||
|
<Label Text="{u:I18n Ownership}"
|
||||||
|
StyleClass="box-header, box-header-platform" />
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayout StyleClass="box-row, box-row-input">
|
||||||
|
<Label
|
||||||
|
Text="{u:I18n WhoOwnsThisItem}"
|
||||||
|
StyleClass="box-label" />
|
||||||
|
<Picker
|
||||||
|
x:Name="_ownershipPicker"
|
||||||
|
ItemsSource="{Binding OwnershipOptions, Mode=OneTime}"
|
||||||
|
SelectedIndex="{Binding OwnershipSelectedIndex}"
|
||||||
|
StyleClass="box-value" />
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayout StyleClass="box"
|
||||||
|
IsVisible="{Binding Cipher.OrganizationId, Converter={StaticResource notNull}}">
|
||||||
|
<StackLayout StyleClass="box-row-header">
|
||||||
|
<Label Text="{u:I18n Collections}"
|
||||||
|
StyleClass="box-header, box-header-platform" />
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayout Spacing="0" Padding="0"
|
||||||
|
IsVisible="{Binding HasCollections, Converter={StaticResource inverseBool}}">
|
||||||
|
<StackLayout StyleClass="box-row, box-row-switch">
|
||||||
|
<Label Text="{u:I18n NoCollectionsToList}" />
|
||||||
|
</StackLayout>
|
||||||
|
<BoxView StyleClass="box-row-separator" />
|
||||||
|
</StackLayout>
|
||||||
|
<controls:RepeaterView ItemsSource="{Binding Collections}" IsVisible="{Binding HasCollections}">
|
||||||
|
<controls:RepeaterView.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="pages:AddEditPageCollectionViewModel">
|
||||||
|
<StackLayout Spacing="0" Padding="0">
|
||||||
|
<StackLayout StyleClass="box-row, box-row-switch">
|
||||||
|
<Label
|
||||||
|
Text="{Binding Collection.Name}"
|
||||||
|
StyleClass="box-label, box-label-regular"
|
||||||
|
HorizontalOptions="StartAndExpand" />
|
||||||
|
<Switch
|
||||||
|
IsToggled="{Binding Checked}"
|
||||||
|
StyleClass="box-value"
|
||||||
|
HorizontalOptions="End" />
|
||||||
|
</StackLayout>
|
||||||
|
<BoxView StyleClass="box-row-separator" />
|
||||||
|
</StackLayout>
|
||||||
|
</DataTemplate>
|
||||||
|
</controls:RepeaterView.ItemTemplate>
|
||||||
|
</controls:RepeaterView>
|
||||||
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
|
using System.Collections.Generic;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Bit.App.Pages
|
namespace Bit.App.Pages
|
||||||
@ -11,15 +12,14 @@ namespace Bit.App.Pages
|
|||||||
string cipherId = null,
|
string cipherId = null,
|
||||||
CipherType? type = null,
|
CipherType? type = null,
|
||||||
string folderId = null,
|
string folderId = null,
|
||||||
string collectionId = null,
|
string collectionId = null)
|
||||||
string organizationId = null)
|
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_vm = BindingContext as AddEditPageViewModel;
|
_vm = BindingContext as AddEditPageViewModel;
|
||||||
_vm.Page = this;
|
_vm.Page = this;
|
||||||
_vm.CipherId = cipherId;
|
_vm.CipherId = cipherId;
|
||||||
_vm.FolderId = folderId;
|
_vm.FolderId = folderId;
|
||||||
_vm.OrganizationId = organizationId;
|
_vm.CollectionIds = collectionId != null ? new HashSet<string>(new List<string> { collectionId }) : null;
|
||||||
_vm.Type = type;
|
_vm.Type = type;
|
||||||
_vm.Init();
|
_vm.Init();
|
||||||
SetActivityIndicator();
|
SetActivityIndicator();
|
||||||
@ -29,6 +29,7 @@ namespace Bit.App.Pages
|
|||||||
_cardExpMonthPicker.ItemDisplayBinding = new Binding("Key");
|
_cardExpMonthPicker.ItemDisplayBinding = new Binding("Key");
|
||||||
_identityTitlePicker.ItemDisplayBinding = new Binding("Key");
|
_identityTitlePicker.ItemDisplayBinding = new Binding("Key");
|
||||||
_folderPicker.ItemDisplayBinding = new Binding("Key");
|
_folderPicker.ItemDisplayBinding = new Binding("Key");
|
||||||
|
_ownershipPicker.ItemDisplayBinding = new Binding("Key");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async void OnAppearing()
|
protected override async void OnAppearing()
|
||||||
@ -67,5 +68,13 @@ namespace Bit.App.Pages
|
|||||||
{
|
{
|
||||||
_vm.AddField();
|
_vm.AddField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Attachments_Clicked(object sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
if(DoOnce())
|
||||||
|
{
|
||||||
|
// await Navigation.PushModalAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ namespace Bit.App.Pages
|
|||||||
private readonly IDeviceActionService _deviceActionService;
|
private readonly IDeviceActionService _deviceActionService;
|
||||||
private readonly ICipherService _cipherService;
|
private readonly ICipherService _cipherService;
|
||||||
private readonly IFolderService _folderService;
|
private readonly IFolderService _folderService;
|
||||||
|
private readonly ICollectionService _collectionService;
|
||||||
private readonly IUserService _userService;
|
private readonly IUserService _userService;
|
||||||
private readonly IPlatformUtilsService _platformUtilsService;
|
private readonly IPlatformUtilsService _platformUtilsService;
|
||||||
private readonly IAuditService _auditService;
|
private readonly IAuditService _auditService;
|
||||||
@ -29,6 +30,9 @@ namespace Bit.App.Pages
|
|||||||
private int _cardExpMonthSelectedIndex;
|
private int _cardExpMonthSelectedIndex;
|
||||||
private int _identityTitleSelectedIndex;
|
private int _identityTitleSelectedIndex;
|
||||||
private int _folderSelectedIndex;
|
private int _folderSelectedIndex;
|
||||||
|
private int _ownershipSelectedIndex;
|
||||||
|
private bool _hasCollections;
|
||||||
|
private List<Core.Models.View.CollectionView> _writeableCollections;
|
||||||
private string[] _additionalCipherProperties = new string[]
|
private string[] _additionalCipherProperties = new string[]
|
||||||
{
|
{
|
||||||
nameof(IsLogin),
|
nameof(IsLogin),
|
||||||
@ -67,6 +71,7 @@ namespace Bit.App.Pages
|
|||||||
_platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService");
|
_platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService");
|
||||||
_auditService = ServiceContainer.Resolve<IAuditService>("auditService");
|
_auditService = ServiceContainer.Resolve<IAuditService>("auditService");
|
||||||
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
|
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
|
||||||
|
_collectionService = ServiceContainer.Resolve<ICollectionService>("collectionService");
|
||||||
GeneratePasswordCommand = new Command(GeneratePassword);
|
GeneratePasswordCommand = new Command(GeneratePassword);
|
||||||
TogglePasswordCommand = new Command(TogglePassword);
|
TogglePasswordCommand = new Command(TogglePassword);
|
||||||
ToggleCardCodeCommand = new Command(ToggleCardCode);
|
ToggleCardCodeCommand = new Command(ToggleCardCode);
|
||||||
@ -75,6 +80,7 @@ namespace Bit.App.Pages
|
|||||||
FieldOptionsCommand = new Command<AddEditPageFieldViewModel>(FieldOptions);
|
FieldOptionsCommand = new Command<AddEditPageFieldViewModel>(FieldOptions);
|
||||||
Uris = new ExtendedObservableCollection<LoginUriView>();
|
Uris = new ExtendedObservableCollection<LoginUriView>();
|
||||||
Fields = new ExtendedObservableCollection<AddEditPageFieldViewModel>();
|
Fields = new ExtendedObservableCollection<AddEditPageFieldViewModel>();
|
||||||
|
Collections = new ExtendedObservableCollection<AddEditPageCollectionViewModel>();
|
||||||
|
|
||||||
TypeOptions = new List<KeyValuePair<string, CipherType>>
|
TypeOptions = new List<KeyValuePair<string, CipherType>>
|
||||||
{
|
{
|
||||||
@ -121,6 +127,7 @@ namespace Bit.App.Pages
|
|||||||
new KeyValuePair<string, string>(AppResources.Dr, AppResources.Dr),
|
new KeyValuePair<string, string>(AppResources.Dr, AppResources.Dr),
|
||||||
};
|
};
|
||||||
FolderOptions = new List<KeyValuePair<string, string>>();
|
FolderOptions = new List<KeyValuePair<string, string>>();
|
||||||
|
OwnershipOptions = new List<KeyValuePair<string, string>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command GeneratePasswordCommand { get; set; }
|
public Command GeneratePasswordCommand { get; set; }
|
||||||
@ -133,21 +140,25 @@ namespace Bit.App.Pages
|
|||||||
public string OrganizationId { get; set; }
|
public string OrganizationId { get; set; }
|
||||||
public string FolderId { get; set; }
|
public string FolderId { get; set; }
|
||||||
public CipherType? Type { get; set; }
|
public CipherType? Type { get; set; }
|
||||||
public List<string> CollectionIds { get; set; }
|
public HashSet<string> CollectionIds { get; set; }
|
||||||
public List<KeyValuePair<string, CipherType>> TypeOptions { get; set; }
|
public List<KeyValuePair<string, CipherType>> TypeOptions { get; set; }
|
||||||
public List<KeyValuePair<string, string>> CardBrandOptions { get; set; }
|
public List<KeyValuePair<string, string>> CardBrandOptions { get; set; }
|
||||||
public List<KeyValuePair<string, string>> CardExpMonthOptions { get; set; }
|
public List<KeyValuePair<string, string>> CardExpMonthOptions { get; set; }
|
||||||
public List<KeyValuePair<string, string>> IdentityTitleOptions { get; set; }
|
public List<KeyValuePair<string, string>> IdentityTitleOptions { get; set; }
|
||||||
public List<KeyValuePair<string, string>> FolderOptions { get; set; }
|
public List<KeyValuePair<string, string>> FolderOptions { get; set; }
|
||||||
|
public List<KeyValuePair<string, string>> OwnershipOptions { get; set; }
|
||||||
public ExtendedObservableCollection<LoginUriView> Uris { get; set; }
|
public ExtendedObservableCollection<LoginUriView> Uris { get; set; }
|
||||||
public ExtendedObservableCollection<AddEditPageFieldViewModel> Fields { get; set; }
|
public ExtendedObservableCollection<AddEditPageFieldViewModel> Fields { get; set; }
|
||||||
|
public ExtendedObservableCollection<AddEditPageCollectionViewModel> Collections { get; set; }
|
||||||
public int TypeSelectedIndex
|
public int TypeSelectedIndex
|
||||||
{
|
{
|
||||||
get => _typeSelectedIndex;
|
get => _typeSelectedIndex;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetProperty(ref _typeSelectedIndex, value);
|
if(SetProperty(ref _typeSelectedIndex, value))
|
||||||
TypeChanged();
|
{
|
||||||
|
TypeChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int CardBrandSelectedIndex
|
public int CardBrandSelectedIndex
|
||||||
@ -155,8 +166,10 @@ namespace Bit.App.Pages
|
|||||||
get => _cardBrandSelectedIndex;
|
get => _cardBrandSelectedIndex;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetProperty(ref _cardBrandSelectedIndex, value);
|
if(SetProperty(ref _cardBrandSelectedIndex, value))
|
||||||
CardBrandChanged();
|
{
|
||||||
|
CardBrandChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int CardExpMonthSelectedIndex
|
public int CardExpMonthSelectedIndex
|
||||||
@ -164,8 +177,10 @@ namespace Bit.App.Pages
|
|||||||
get => _cardExpMonthSelectedIndex;
|
get => _cardExpMonthSelectedIndex;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetProperty(ref _cardExpMonthSelectedIndex, value);
|
if(SetProperty(ref _cardExpMonthSelectedIndex, value))
|
||||||
CardExpMonthChanged();
|
{
|
||||||
|
CardExpMonthChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int IdentityTitleSelectedIndex
|
public int IdentityTitleSelectedIndex
|
||||||
@ -173,8 +188,10 @@ namespace Bit.App.Pages
|
|||||||
get => _identityTitleSelectedIndex;
|
get => _identityTitleSelectedIndex;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetProperty(ref _identityTitleSelectedIndex, value);
|
if(SetProperty(ref _identityTitleSelectedIndex, value))
|
||||||
IdentityTitleChanged();
|
{
|
||||||
|
IdentityTitleChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int FolderSelectedIndex
|
public int FolderSelectedIndex
|
||||||
@ -182,8 +199,21 @@ namespace Bit.App.Pages
|
|||||||
get => _folderSelectedIndex;
|
get => _folderSelectedIndex;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
SetProperty(ref _folderSelectedIndex, value);
|
if(SetProperty(ref _folderSelectedIndex, value))
|
||||||
FolderChanged();
|
{
|
||||||
|
FolderChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int OwnershipSelectedIndex
|
||||||
|
{
|
||||||
|
get => _ownershipSelectedIndex;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if(SetProperty(ref _ownershipSelectedIndex, value))
|
||||||
|
{
|
||||||
|
OrganizationChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public CipherView Cipher
|
public CipherView Cipher
|
||||||
@ -209,6 +239,11 @@ namespace Bit.App.Pages
|
|||||||
nameof(ShowCardCodeIcon)
|
nameof(ShowCardCodeIcon)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
public bool HasCollections
|
||||||
|
{
|
||||||
|
get => _hasCollections;
|
||||||
|
set => SetProperty(ref _hasCollections, value);
|
||||||
|
}
|
||||||
public bool EditMode => !string.IsNullOrWhiteSpace(CipherId);
|
public bool EditMode => !string.IsNullOrWhiteSpace(CipherId);
|
||||||
public bool IsLogin => Cipher?.Type == CipherType.Login;
|
public bool IsLogin => Cipher?.Type == CipherType.Login;
|
||||||
public bool IsIdentity => Cipher?.Type == CipherType.Identity;
|
public bool IsIdentity => Cipher?.Type == CipherType.Identity;
|
||||||
@ -230,7 +265,25 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
public async Task LoadAsync()
|
public async Task LoadAsync()
|
||||||
{
|
{
|
||||||
// TODO: load collections
|
var myEmail = await _userService.GetEmailAsync();
|
||||||
|
OwnershipOptions.Add(new KeyValuePair<string, string>(myEmail, null));
|
||||||
|
var orgs = await _userService.GetAllOrganizationAsync();
|
||||||
|
foreach(var org in orgs.OrderBy(o => o.Name))
|
||||||
|
{
|
||||||
|
if(org.Enabled && org.Status == OrganizationUserStatusType.Confirmed)
|
||||||
|
{
|
||||||
|
OwnershipOptions.Add(new KeyValuePair<string, string>(org.Name, org.Id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var allCollections = await _collectionService.GetAllDecryptedAsync();
|
||||||
|
_writeableCollections = allCollections.Where(c => !c.ReadOnly).ToList();
|
||||||
|
if(CollectionIds?.Any() ?? false)
|
||||||
|
{
|
||||||
|
var colId = CollectionIds.First();
|
||||||
|
var collection = _writeableCollections.FirstOrDefault(c => c.Id == colId);
|
||||||
|
OrganizationId = collection?.OrganizationId;
|
||||||
|
}
|
||||||
var folders = await _folderService.GetAllDecryptedAsync();
|
var folders = await _folderService.GetAllDecryptedAsync();
|
||||||
FolderOptions = folders.Select(f => new KeyValuePair<string, string>(f.Name, f.Id)).ToList();
|
FolderOptions = folders.Select(f => new KeyValuePair<string, string>(f.Name, f.Id)).ToList();
|
||||||
|
|
||||||
@ -240,21 +293,6 @@ namespace Bit.App.Pages
|
|||||||
{
|
{
|
||||||
var cipher = await _cipherService.GetAsync(CipherId);
|
var cipher = await _cipherService.GetAsync(CipherId);
|
||||||
Cipher = await cipher.DecryptAsync();
|
Cipher = await cipher.DecryptAsync();
|
||||||
|
|
||||||
FolderSelectedIndex = string.IsNullOrWhiteSpace(Cipher.FolderId) ? FolderOptions.Count - 1 :
|
|
||||||
FolderOptions.FindIndex(k => k.Value == Cipher.FolderId); ;
|
|
||||||
if(Cipher.Card != null)
|
|
||||||
{
|
|
||||||
CardBrandSelectedIndex = string.IsNullOrWhiteSpace(Cipher.Card.Brand) ? 0 :
|
|
||||||
CardBrandOptions.FindIndex(k => k.Value == Cipher.Card.Brand);
|
|
||||||
CardExpMonthSelectedIndex = string.IsNullOrWhiteSpace(Cipher.Card.ExpMonth) ? 0 :
|
|
||||||
CardExpMonthOptions.FindIndex(k => k.Value == Cipher.Card.ExpMonth);
|
|
||||||
}
|
|
||||||
if(Cipher.Identity != null)
|
|
||||||
{
|
|
||||||
IdentityTitleSelectedIndex = string.IsNullOrWhiteSpace(Cipher.Identity.Title) ? 0 :
|
|
||||||
IdentityTitleOptions.FindIndex(k => k.Value == Cipher.Identity.Title);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -270,15 +308,27 @@ namespace Bit.App.Pages
|
|||||||
};
|
};
|
||||||
Cipher.Login.Uris = new List<LoginUriView> { new LoginUriView() };
|
Cipher.Login.Uris = new List<LoginUriView> { new LoginUriView() };
|
||||||
Cipher.SecureNote.Type = SecureNoteType.Generic;
|
Cipher.SecureNote.Type = SecureNoteType.Generic;
|
||||||
|
|
||||||
TypeSelectedIndex = TypeOptions.FindIndex(k => k.Value == Cipher.Type);
|
TypeSelectedIndex = TypeOptions.FindIndex(k => k.Value == Cipher.Type);
|
||||||
CardBrandSelectedIndex = 0;
|
|
||||||
CardExpMonthSelectedIndex = 0;
|
|
||||||
IdentityTitleSelectedIndex = 0;
|
|
||||||
FolderSelectedIndex = FolderOptions.Count - 1;
|
|
||||||
// TODO: org/collection stuff
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FolderSelectedIndex = string.IsNullOrWhiteSpace(Cipher.FolderId) ? FolderOptions.Count - 1 :
|
||||||
|
FolderOptions.FindIndex(k => k.Value == Cipher.FolderId);
|
||||||
|
CardBrandSelectedIndex = string.IsNullOrWhiteSpace(Cipher?.Card.Brand) ? 0 :
|
||||||
|
CardBrandOptions.FindIndex(k => k.Value == Cipher.Card.Brand);
|
||||||
|
CardExpMonthSelectedIndex = string.IsNullOrWhiteSpace(Cipher?.Card.ExpMonth) ? 0 :
|
||||||
|
CardExpMonthOptions.FindIndex(k => k.Value == Cipher.Card.ExpMonth);
|
||||||
|
IdentityTitleSelectedIndex = string.IsNullOrWhiteSpace(Cipher?.Identity.Title) ? 0 :
|
||||||
|
IdentityTitleOptions.FindIndex(k => k.Value == Cipher.Identity.Title);
|
||||||
|
OwnershipSelectedIndex = string.IsNullOrWhiteSpace(Cipher.OrganizationId) ? 0 :
|
||||||
|
OwnershipOptions.FindIndex(k => k.Value == Cipher.OrganizationId);
|
||||||
|
|
||||||
|
if(!EditMode && (CollectionIds?.Any() ?? false))
|
||||||
|
{
|
||||||
|
foreach(var col in Collections)
|
||||||
|
{
|
||||||
|
col.Checked = CollectionIds.Contains(col.Collection.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
if(Cipher.Login.Uris != null)
|
if(Cipher.Login.Uris != null)
|
||||||
{
|
{
|
||||||
Uris.ResetWithRange(Cipher.Login.Uris);
|
Uris.ResetWithRange(Cipher.Login.Uris);
|
||||||
@ -310,7 +360,8 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
if(!EditMode && Cipher.OrganizationId != null)
|
if(!EditMode && Cipher.OrganizationId != null)
|
||||||
{
|
{
|
||||||
// TODO: filter cipher collection ids
|
Cipher.CollectionIds = Collections.Any() ?
|
||||||
|
new HashSet<string>(Collections.Where(c => c.Checked).Select(c => c.Collection.Id)) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cipher = await _cipherService.EncryptAsync(Cipher);
|
var cipher = await _cipherService.EncryptAsync(Cipher);
|
||||||
@ -514,6 +565,26 @@ namespace Bit.App.Pages
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OrganizationChanged()
|
||||||
|
{
|
||||||
|
if(Cipher != null && OwnershipSelectedIndex > -1)
|
||||||
|
{
|
||||||
|
Cipher.OrganizationId = OwnershipOptions[OwnershipSelectedIndex].Value;
|
||||||
|
TriggerCipherChanged();
|
||||||
|
}
|
||||||
|
if(Cipher.OrganizationId != null)
|
||||||
|
{
|
||||||
|
var cols = _writeableCollections.Where(c => c.OrganizationId == Cipher.OrganizationId)
|
||||||
|
.Select(c => new AddEditPageCollectionViewModel { Collection = c }).ToList();
|
||||||
|
Collections.ResetWithRange(cols);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Collections.ResetWithRange(new List<AddEditPageCollectionViewModel>());
|
||||||
|
}
|
||||||
|
HasCollections = Collections.Any();
|
||||||
|
}
|
||||||
|
|
||||||
private void TriggerCipherChanged()
|
private void TriggerCipherChanged()
|
||||||
{
|
{
|
||||||
TriggerPropertyChanged(nameof(Cipher), _additionalCipherProperties);
|
TriggerPropertyChanged(nameof(Cipher), _additionalCipherProperties);
|
||||||
@ -544,7 +615,19 @@ namespace Bit.App.Pages
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AddEditPageFieldViewModel : BaseViewModel
|
public class AddEditPageCollectionViewModel : ExtendedViewModel
|
||||||
|
{
|
||||||
|
private bool _checked;
|
||||||
|
|
||||||
|
public Core.Models.View.CollectionView Collection { get; set; }
|
||||||
|
public bool Checked
|
||||||
|
{
|
||||||
|
get => _checked;
|
||||||
|
set => SetProperty(ref _checked, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AddEditPageFieldViewModel : ExtendedViewModel
|
||||||
{
|
{
|
||||||
private FieldView _field;
|
private FieldView _field;
|
||||||
private bool _showHiddenValue;
|
private bool _showHiddenValue;
|
||||||
|
@ -425,7 +425,7 @@ namespace Bit.App.Pages
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ViewPageFieldViewModel : BaseViewModel
|
public class ViewPageFieldViewModel : ExtendedViewModel
|
||||||
{
|
{
|
||||||
private FieldView _field;
|
private FieldView _field;
|
||||||
private bool _showHiddenValue;
|
private bool _showHiddenValue;
|
||||||
|
27
src/App/Resources/AppResources.Designer.cs
generated
27
src/App/Resources/AppResources.Designer.cs
generated
@ -2436,6 +2436,15 @@ namespace Bit.App.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to There are no collections to list..
|
||||||
|
/// </summary>
|
||||||
|
public static string NoCollectionsToList {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("NoCollectionsToList", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to There are no favorites in your vault..
|
/// Looks up a localized string similar to There are no favorites in your vault..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -2625,6 +2634,15 @@ namespace Bit.App.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Ownership.
|
||||||
|
/// </summary>
|
||||||
|
public static string Ownership {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Ownership", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Passport Number.
|
/// Looks up a localized string similar to Passport Number.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -3651,6 +3669,15 @@ namespace Bit.App.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Who owns this item?.
|
||||||
|
/// </summary>
|
||||||
|
public static string WhoOwnsThisItem {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("WhoOwnsThisItem", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Windows Hello.
|
/// Looks up a localized string similar to Windows Hello.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1420,4 +1420,13 @@
|
|||||||
<data name="Miscellaneous" xml:space="preserve">
|
<data name="Miscellaneous" xml:space="preserve">
|
||||||
<value>Miscellaneous</value>
|
<value>Miscellaneous</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Ownership" xml:space="preserve">
|
||||||
|
<value>Ownership</value>
|
||||||
|
</data>
|
||||||
|
<data name="WhoOwnsThisItem" xml:space="preserve">
|
||||||
|
<value>Who owns this item?</value>
|
||||||
|
</data>
|
||||||
|
<data name="NoCollectionsToList" xml:space="preserve">
|
||||||
|
<value>There are no collections to list.</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
Loading…
Reference in New Issue
Block a user