mirror of
https://github.com/bitwarden/mobile
synced 2026-01-14 06:23:41 +00:00
[SG-471] Added properties to speed up page bindings
This commit is contained in:
@@ -72,7 +72,7 @@
|
||||
FontSize="Small"
|
||||
FontAttributes="Bold"/>
|
||||
<Label
|
||||
Text="{Binding TimeOfRequest}"
|
||||
Text="{Binding TimeOfRequestText}"
|
||||
FontSize="Small"
|
||||
Margin="0,0,0,57"/>
|
||||
<Button
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
namespace Bit.App.Pages
|
||||
using System;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
public partial class LoginPasswordlessPage : BaseContentPage
|
||||
{
|
||||
private LoginPasswordlessViewModel _vm;
|
||||
|
||||
public LoginPasswordlessPage(string email, string deviceType, string ipAddress, string location, string fingerprintPhrase)
|
||||
public LoginPasswordlessPage(string fingerprintPhrase, string email, string deviceType, string ipAddress, string location, DateTime requestDate)
|
||||
{
|
||||
InitializeComponent();
|
||||
_vm = BindingContext as LoginPasswordlessViewModel;
|
||||
@@ -14,12 +16,7 @@
|
||||
_vm.IpAddress = ipAddress;
|
||||
_vm.NearLocation = location;
|
||||
_vm.FingerprintPhrase = fingerprintPhrase;
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
_vm.InitAsync();
|
||||
base.OnAppearing();
|
||||
_vm.RequestDate = requestDate;
|
||||
}
|
||||
|
||||
private async void Close_Clicked(object sender, System.EventArgs e)
|
||||
|
||||
@@ -12,17 +12,15 @@ namespace Bit.App.Pages
|
||||
public class LoginPasswordlessViewModel : BaseViewModel
|
||||
{
|
||||
private IStateService _stateService;
|
||||
|
||||
public string Email { get; set; }
|
||||
public string LogInAttempByLabel { get; set; }
|
||||
public string FingerprintPhrase { get; set; }
|
||||
public FormattedString FingerprintPhraseFormatted { get; set; }
|
||||
public string DeviceType { get; set; }
|
||||
public string IpAddress { get; set; }
|
||||
public string NearLocation { get; set; }
|
||||
public string TimeOfRequest { get; set; }
|
||||
public DateTime RequestDate { get; set; }
|
||||
|
||||
private string _logInAttempByLabel;
|
||||
private string _deviceType;
|
||||
private FormattedString _fingerprintPhraseFormatted;
|
||||
private string _fingerprintPhrase;
|
||||
private string _email;
|
||||
private string _timeOfRequest;
|
||||
private DateTime _requestDate;
|
||||
private string _nearLocation;
|
||||
private string _ipAddress;
|
||||
|
||||
public LoginPasswordlessViewModel()
|
||||
{
|
||||
@@ -30,17 +28,78 @@ namespace Bit.App.Pages
|
||||
PageTitle = AppResources.LogInRequested;
|
||||
}
|
||||
|
||||
public async Task InitAsync()
|
||||
public string Email
|
||||
{
|
||||
LogInAttempByLabel = string.Format(AppResources.LogInAttemptByOn, Email, "bitwarden login test");
|
||||
FingerprintPhraseFormatted = CreateFingerprintPhrase();
|
||||
TimeOfRequest = CreateRequestDate();
|
||||
UpdateScreen();
|
||||
get => _email;
|
||||
set
|
||||
{
|
||||
LogInAttempByLabel = string.Format(AppResources.LogInAttemptByOn, value, "bitwarden login test");
|
||||
SetProperty(ref _email, value);
|
||||
}
|
||||
}
|
||||
|
||||
private FormattedString CreateFingerprintPhrase()
|
||||
public string FingerprintPhrase
|
||||
{
|
||||
var fingerprintList = FingerprintPhrase.Split('-').ToList();
|
||||
get => _fingerprintPhrase;
|
||||
set
|
||||
{
|
||||
FingerprintPhraseFormatted = CreateFingerprintPhrase(value);
|
||||
SetProperty(ref _fingerprintPhrase, value);
|
||||
}
|
||||
}
|
||||
|
||||
public FormattedString FingerprintPhraseFormatted
|
||||
{
|
||||
get => _fingerprintPhraseFormatted;
|
||||
set => SetProperty(ref _fingerprintPhraseFormatted, value);
|
||||
}
|
||||
|
||||
public string LogInAttempByLabel
|
||||
{
|
||||
get => _logInAttempByLabel;
|
||||
set => SetProperty(ref _logInAttempByLabel, value);
|
||||
}
|
||||
|
||||
public string DeviceType
|
||||
{
|
||||
get => _deviceType;
|
||||
set => SetProperty(ref _deviceType, value);
|
||||
}
|
||||
|
||||
public string IpAddress
|
||||
{
|
||||
get => _ipAddress;
|
||||
set => SetProperty(ref _ipAddress, value);
|
||||
}
|
||||
|
||||
public string NearLocation
|
||||
{
|
||||
get => _nearLocation;
|
||||
set => SetProperty(ref _nearLocation, value);
|
||||
}
|
||||
|
||||
public DateTime RequestDate
|
||||
{
|
||||
get => _requestDate;
|
||||
set
|
||||
{
|
||||
TimeOfRequestText = CreateRequestDate();
|
||||
SetProperty(ref _requestDate, value);
|
||||
}
|
||||
}
|
||||
|
||||
public string TimeOfRequestText
|
||||
{
|
||||
get => _timeOfRequest;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _timeOfRequest, value);
|
||||
}
|
||||
}
|
||||
|
||||
private FormattedString CreateFingerprintPhrase(string fingerprintPhrase)
|
||||
{
|
||||
var fingerprintList = fingerprintPhrase.Split('-').ToList();
|
||||
var fs = new FormattedString();
|
||||
var lastFingerprint = fingerprintList.LastOrDefault();
|
||||
|
||||
@@ -80,15 +139,5 @@ namespace Bit.App.Pages
|
||||
|
||||
return RequestDate.ToShortTimeString();
|
||||
}
|
||||
|
||||
public void UpdateScreen()
|
||||
{
|
||||
TriggerPropertyChanged(nameof(LogInAttempByLabel));
|
||||
TriggerPropertyChanged(nameof(FingerprintPhraseFormatted));
|
||||
TriggerPropertyChanged(nameof(DeviceType));
|
||||
TriggerPropertyChanged(nameof(IpAddress));
|
||||
TriggerPropertyChanged(nameof(NearLocation));
|
||||
TriggerPropertyChanged(nameof(TimeOfRequest));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user