add readonly password reveal
This commit is contained in:
@@ -12,4 +12,6 @@ public partial class DateEntryViewModel(IServiceProvider provider,
|
||||
ItemEntryConfiguration configuration,
|
||||
string key,
|
||||
DateTimeOffset value,
|
||||
double width) : ItemEntryViewModel<DateTimeOffset>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, width);
|
||||
bool isConcealed,
|
||||
bool isRevealed,
|
||||
double width) : ItemEntryViewModel<DateTimeOffset>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width);
|
||||
|
||||
@@ -20,7 +20,7 @@ public class DateEntryViewModelHandler(IServiceFactory serviceFactory) :
|
||||
double? width = configuration.Width;
|
||||
|
||||
if (serviceFactory.Create<DateEntryViewModel>(args => args.Initialize(),
|
||||
[.. args.Parameters, configuration, label, value, width])
|
||||
[.. args.Parameters, configuration, label, value, false, false, width])
|
||||
is DateEntryViewModel viewModel)
|
||||
{
|
||||
return Task.FromResult<IItemEntryViewModel?>(viewModel);
|
||||
|
||||
@@ -23,7 +23,7 @@ public class DropdownEntryViewModelHandler(IServiceFactory serviceFactory) :
|
||||
DropdownValueViewModel? selected = values.FirstOrDefault(x => x.Value is not null && x.Value.Equals($"{value}"));
|
||||
|
||||
if (serviceFactory.Create<DropdownEntryViewModel>(args => args.Initialize(),
|
||||
[values, .. args.Parameters, configuration, label, value, width, selected])
|
||||
[values, .. args.Parameters, configuration, label, value, width, false, false, selected])
|
||||
is DropdownEntryViewModel viewModel)
|
||||
{
|
||||
return Task.FromResult<IItemEntryViewModel?>(viewModel);
|
||||
|
||||
@@ -13,7 +13,9 @@ public partial class HyperlinkEntryViewModel(IServiceProvider provider,
|
||||
ItemEntryConfiguration configuration,
|
||||
string key,
|
||||
string value,
|
||||
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, width)
|
||||
double width,
|
||||
bool isConcealed,
|
||||
bool isRevealed) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width)
|
||||
{
|
||||
[RelayCommand]
|
||||
private void Invoke() => Publisher.Publish(Create.As(new Hyperlink(Value)));
|
||||
|
||||
@@ -15,7 +15,7 @@ public class HyperlinkEntryViewModelHandler(IServiceFactory serviceFactory) :
|
||||
double? width = configuration.Width;
|
||||
|
||||
if (serviceFactory.Create<HyperlinkEntryViewModel>(args => args.Initialize(),
|
||||
[.. args.Parameters, configuration, label, value, width])
|
||||
[.. args.Parameters, configuration, label, value, false, false, width])
|
||||
is HyperlinkEntryViewModel viewModel)
|
||||
{
|
||||
return Task.FromResult<IItemEntryViewModel?>(viewModel);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Wallet;
|
||||
@@ -13,6 +14,8 @@ public partial class ItemEntryViewModel<TValue>(IServiceProvider provider,
|
||||
ItemEntryConfiguration configuration,
|
||||
string key,
|
||||
TValue value,
|
||||
bool isConcealed,
|
||||
bool isRevealed,
|
||||
double width) :
|
||||
Observable<string, TValue>(provider, factory, mediator, publisher, subscriber, disposer, key, value),
|
||||
IItemEntryViewModel,
|
||||
@@ -21,6 +24,12 @@ public partial class ItemEntryViewModel<TValue>(IServiceProvider provider,
|
||||
INotificationHandler<CancelEventArgs<Item>>
|
||||
where TValue : notnull
|
||||
{
|
||||
[ObservableProperty]
|
||||
private bool isConcealed = isConcealed;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool isRevealed = isRevealed;
|
||||
|
||||
[ObservableProperty]
|
||||
private ItemState state = state;
|
||||
|
||||
@@ -48,4 +57,16 @@ public partial class ItemEntryViewModel<TValue>(IServiceProvider provider,
|
||||
|
||||
protected override void OnValueChanged() =>
|
||||
configuration.Value = Value;
|
||||
|
||||
[RelayCommand]
|
||||
private void Hide()
|
||||
{
|
||||
IsRevealed = false;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void Reveal()
|
||||
{
|
||||
IsRevealed = true;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,9 @@ public partial class MaskedTextEntryViewModel(IServiceProvider provider,
|
||||
string pattern,
|
||||
string key,
|
||||
string value,
|
||||
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, width)
|
||||
bool isConcealed,
|
||||
bool isRevealed,
|
||||
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width)
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string pattern = pattern;
|
||||
|
||||
@@ -15,7 +15,7 @@ public class MaskedTextEntryViewModelHandler(IServiceFactory serviceFactory) :
|
||||
double? width = configuration.Width;
|
||||
|
||||
if (serviceFactory.Create<MaskedTextEntryViewModel>(args => args.Initialize(),
|
||||
[.. args.Parameters, configuration, configuration.Pattern, label, value, width])
|
||||
[.. args.Parameters, configuration, configuration.Pattern, label, value, false, false, width])
|
||||
is MaskedTextEntryViewModel viewModel)
|
||||
{
|
||||
return Task.FromResult<IItemEntryViewModel?>(viewModel);
|
||||
|
||||
@@ -12,5 +12,7 @@ public partial class MultilineTextEntryViewModel(IServiceProvider provider,
|
||||
ItemEntryConfiguration configuration,
|
||||
string key,
|
||||
string value,
|
||||
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, width);
|
||||
bool isConcealed,
|
||||
bool isRevealed,
|
||||
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public class MultilineTextEntryViewModelHandler(IServiceFactory serviceFactory)
|
||||
double? width = configuration.Width;
|
||||
|
||||
if (serviceFactory.Create<MultilineTextEntryViewModel>(args => args.Initialize(),
|
||||
[.. args.Parameters, configuration, label, value, width])
|
||||
[.. args.Parameters, configuration, label, value, false, false, width])
|
||||
is MultilineTextEntryViewModel viewModel)
|
||||
{
|
||||
return Task.FromResult<IItemEntryViewModel?>(viewModel);
|
||||
|
||||
@@ -12,4 +12,6 @@ public partial class PasswordEntryViewModel(IServiceProvider provider,
|
||||
ItemEntryConfiguration configuration,
|
||||
string key,
|
||||
string value,
|
||||
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, width);
|
||||
bool isConcealed,
|
||||
bool isRevealed,
|
||||
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width);
|
||||
@@ -15,7 +15,7 @@ public class PasswordEntryViewModelHandler(IServiceFactory serviceFactory) :
|
||||
double? width = configuration.Width;
|
||||
|
||||
if (serviceFactory.Create<PasswordEntryViewModel>(args => args.Initialize(),
|
||||
[.. args.Parameters, configuration, label, value, width])
|
||||
[.. args.Parameters, configuration, label, value, true, false, width])
|
||||
is PasswordEntryViewModel viewModel)
|
||||
{
|
||||
return Task.FromResult<IItemEntryViewModel?>(viewModel);
|
||||
|
||||
@@ -12,4 +12,6 @@ public partial class PinEntryViewModel(IServiceProvider provider,
|
||||
ItemEntryConfiguration configuration,
|
||||
string key,
|
||||
string value,
|
||||
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, width);
|
||||
double width,
|
||||
bool isConcealed,
|
||||
bool isRevealed) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width);
|
||||
@@ -15,7 +15,7 @@ public class PinEntryViewModelHandler(IServiceFactory serviceFactory) :
|
||||
double? width = configuration.Width;
|
||||
|
||||
if (serviceFactory.Create<PinEntryViewModel>(args => args.Initialize(),
|
||||
[.. args.Parameters, configuration, label, value, width])
|
||||
[.. args.Parameters, configuration, label, value, true, false, width])
|
||||
is PinEntryViewModel viewModel)
|
||||
{
|
||||
return Task.FromResult<IItemEntryViewModel?>(viewModel);
|
||||
|
||||
@@ -12,4 +12,6 @@ public partial class TextEntryViewModel(IServiceProvider provider,
|
||||
ItemEntryConfiguration configuration,
|
||||
string key,
|
||||
string value,
|
||||
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, width);
|
||||
bool isConcealed,
|
||||
bool isRevealed,
|
||||
double width) : ItemEntryViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width);
|
||||
|
||||
@@ -15,7 +15,7 @@ public class TextEntryViewModelHandler(IServiceFactory serviceFactory) :
|
||||
double? width = configuration.Width;
|
||||
|
||||
if (serviceFactory.Create<TextEntryViewModel>(args => args.Initialize(),
|
||||
[.. args.Parameters, configuration, label, value, width])
|
||||
[.. args.Parameters, configuration, label, value, false, false, width])
|
||||
is TextEntryViewModel viewModel)
|
||||
{
|
||||
return Task.FromResult<IItemEntryViewModel?>(viewModel);
|
||||
|
||||
Reference in New Issue
Block a user