mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-23 11:45:38 +01:00
subtitles for each type
This commit is contained in:
parent
296c9dc055
commit
cc0bb65096
@ -140,14 +140,14 @@ namespace Bit.Android
|
||||
{
|
||||
var isPremium = Resolver.Resolve<ITokenService>()?.TokenPremium ?? false;
|
||||
var autoCopyEnabled = !_settings.GetValueOrDefault(Constants.SettingDisableTotpCopy, false);
|
||||
if(isPremium && autoCopyEnabled && _deviceActionService != null && cipher.Totp.Value != null)
|
||||
if(isPremium && autoCopyEnabled && _deviceActionService != null && cipher.LoginTotp.Value != null)
|
||||
{
|
||||
_deviceActionService.CopyToClipboard(App.Utilities.Crypto.Totp(cipher.Totp.Value));
|
||||
_deviceActionService.CopyToClipboard(App.Utilities.Crypto.Totp(cipher.LoginTotp.Value));
|
||||
}
|
||||
|
||||
data.PutExtra("uri", cipher.Uri.Value);
|
||||
data.PutExtra("username", cipher.Username);
|
||||
data.PutExtra("password", cipher.Password.Value);
|
||||
data.PutExtra("uri", cipher.LoginUri.Value);
|
||||
data.PutExtra("username", cipher.LoginUsername);
|
||||
data.PutExtra("password", cipher.LoginPassword.Value);
|
||||
}
|
||||
|
||||
if(Parent == null)
|
||||
|
@ -22,27 +22,48 @@ namespace Bit.App.Models.Page
|
||||
switch(cipher.Type)
|
||||
{
|
||||
case CipherType.Login:
|
||||
Username = cipher.Login?.Username?.Decrypt(cipher.OrganizationId) ?? " ";
|
||||
Password = new Lazy<string>(() => cipher.Login?.Password?.Decrypt(cipher.OrganizationId));
|
||||
Uri = new Lazy<string>(() => cipher.Login?.Uri?.Decrypt(cipher.OrganizationId));
|
||||
Totp = new Lazy<string>(() => cipher.Login?.Totp?.Decrypt(cipher.OrganizationId));
|
||||
LoginUsername = cipher.Login?.Username?.Decrypt(cipher.OrganizationId) ?? " ";
|
||||
LoginPassword = new Lazy<string>(() => cipher.Login?.Password?.Decrypt(cipher.OrganizationId));
|
||||
LoginUri = new Lazy<string>(() => cipher.Login?.Uri?.Decrypt(cipher.OrganizationId));
|
||||
LoginTotp = new Lazy<string>(() => cipher.Login?.Totp?.Decrypt(cipher.OrganizationId));
|
||||
|
||||
Subtitle = Username;
|
||||
Subtitle = LoginUsername;
|
||||
break;
|
||||
case CipherType.SecureNote:
|
||||
Subtitle = " ";
|
||||
break;
|
||||
case CipherType.Card:
|
||||
var cardNumber = cipher.Card?.Number?.Decrypt(cipher.OrganizationId) ?? " ";
|
||||
CardNumber = cipher.Card?.Number?.Decrypt(cipher.OrganizationId) ?? " ";
|
||||
var cardBrand = cipher.Card?.Brand?.Decrypt(cipher.OrganizationId) ?? " ";
|
||||
CardCode = new Lazy<string>(() => cipher.Card?.Code?.Decrypt(cipher.OrganizationId));
|
||||
|
||||
Subtitle = $"{cardBrand}, *{cardNumber}";
|
||||
Subtitle = cardBrand;
|
||||
if(!string.IsNullOrWhiteSpace(CardNumber) && CardNumber.Length >= 4)
|
||||
{
|
||||
if(!string.IsNullOrWhiteSpace(CardNumber))
|
||||
{
|
||||
Subtitle += ", ";
|
||||
}
|
||||
Subtitle += ("*" + CardNumber.Substring(CardNumber.Length - 4));
|
||||
}
|
||||
break;
|
||||
case CipherType.Identity:
|
||||
var firstName = cipher.Identity?.FirstName?.Decrypt(cipher.OrganizationId) ?? " ";
|
||||
var lastName = cipher.Identity?.LastName?.Decrypt(cipher.OrganizationId) ?? " ";
|
||||
Subtitle = $"{firstName} {lastName}";
|
||||
|
||||
Subtitle = " ";
|
||||
if(!string.IsNullOrWhiteSpace(firstName))
|
||||
{
|
||||
Subtitle = firstName;
|
||||
}
|
||||
if(!string.IsNullOrWhiteSpace(lastName))
|
||||
{
|
||||
if(!string.IsNullOrWhiteSpace(Subtitle))
|
||||
{
|
||||
Subtitle += " ";
|
||||
}
|
||||
Subtitle += lastName;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -58,10 +79,10 @@ namespace Bit.App.Models.Page
|
||||
public CipherType Type { get; set; }
|
||||
|
||||
// Login metadata
|
||||
public string Username { get; set; }
|
||||
public Lazy<string> Password { get; set; }
|
||||
public Lazy<string> Uri { get; set; }
|
||||
public Lazy<string> Totp { get; set; }
|
||||
public string LoginUsername { get; set; }
|
||||
public Lazy<string> LoginPassword { get; set; }
|
||||
public Lazy<string> LoginUri { get; set; }
|
||||
public Lazy<string> LoginTotp { get; set; }
|
||||
|
||||
// Login metadata
|
||||
public string CardNumber { get; set; }
|
||||
|
@ -176,7 +176,7 @@ namespace Bit.App.Pages
|
||||
|
||||
var fuzzyLogins = ciphers?.Item2.Select(l => new VaultListPageModel.AutofillCipher(l, true))
|
||||
.OrderBy(s => s.Name)
|
||||
.ThenBy(s => s.Username)
|
||||
.ThenBy(s => s.LoginUsername)
|
||||
.ToList();
|
||||
if(fuzzyLogins?.Any() ?? false)
|
||||
{
|
||||
@ -242,11 +242,11 @@ namespace Bit.App.Pages
|
||||
|
||||
if(cipher.Type == CipherType.Login)
|
||||
{
|
||||
if(!string.IsNullOrWhiteSpace(cipher.Password.Value))
|
||||
if(!string.IsNullOrWhiteSpace(cipher.LoginPassword.Value))
|
||||
{
|
||||
buttons.Add(AppResources.CopyPassword);
|
||||
}
|
||||
if(!string.IsNullOrWhiteSpace(cipher.Username))
|
||||
if(!string.IsNullOrWhiteSpace(cipher.LoginUsername))
|
||||
{
|
||||
buttons.Add(AppResources.CopyUsername);
|
||||
}
|
||||
@ -277,11 +277,11 @@ namespace Bit.App.Pages
|
||||
}
|
||||
else if(selection == AppResources.CopyPassword)
|
||||
{
|
||||
Copy(cipher.Password.Value, AppResources.Password);
|
||||
Copy(cipher.LoginPassword.Value, AppResources.Password);
|
||||
}
|
||||
else if(selection == AppResources.CopyUsername)
|
||||
{
|
||||
Copy(cipher.Username, AppResources.Username);
|
||||
Copy(cipher.LoginUsername, AppResources.Username);
|
||||
}
|
||||
else if(selection == AppResources.CopyNumber)
|
||||
{
|
||||
|
@ -175,7 +175,8 @@ namespace Bit.App.Pages
|
||||
_filterResultsCancellationTokenSource);
|
||||
}
|
||||
|
||||
private CancellationTokenSource FilterResultsBackground(string searchFilter, CancellationTokenSource previousCts)
|
||||
private CancellationTokenSource FilterResultsBackground(string searchFilter,
|
||||
CancellationTokenSource previousCts)
|
||||
{
|
||||
var cts = new CancellationTokenSource();
|
||||
Task.Run(async () =>
|
||||
@ -239,7 +240,8 @@ namespace Bit.App.Pages
|
||||
var pushPromptShow = _settings.GetValueOrDefault(Constants.PushInitialPromptShown, false);
|
||||
Action registerAction = () =>
|
||||
{
|
||||
var lastPushRegistration = _settings.GetValueOrDefault(Constants.PushLastRegistrationDate, DateTime.MinValue);
|
||||
var lastPushRegistration =
|
||||
_settings.GetValueOrDefault(Constants.PushLastRegistrationDate, DateTime.MinValue);
|
||||
if(!pushPromptShow || DateTime.UtcNow - lastPushRegistration > TimeSpan.FromDays(1))
|
||||
{
|
||||
_pushNotification.Register();
|
||||
@ -409,7 +411,8 @@ namespace Bit.App.Pages
|
||||
}
|
||||
else
|
||||
{
|
||||
_googleAnalyticsService.TrackExtensionEvent("AutoFilled", Uri.StartsWith("http") ? "Website" : "App");
|
||||
_googleAnalyticsService.TrackExtensionEvent("AutoFilled",
|
||||
Uri.StartsWith("http") ? "Website" : "App");
|
||||
MessagingCenter.Send(Application.Current, "Autofill", cipher);
|
||||
}
|
||||
}
|
||||
@ -423,16 +426,16 @@ namespace Bit.App.Pages
|
||||
|
||||
if(cipher.Type == CipherType.Login)
|
||||
{
|
||||
if(!string.IsNullOrWhiteSpace(cipher.Password.Value))
|
||||
if(!string.IsNullOrWhiteSpace(cipher.LoginPassword.Value))
|
||||
{
|
||||
buttons.Add(AppResources.CopyPassword);
|
||||
}
|
||||
if(!string.IsNullOrWhiteSpace(cipher.Username))
|
||||
if(!string.IsNullOrWhiteSpace(cipher.LoginUsername))
|
||||
{
|
||||
buttons.Add(AppResources.CopyUsername);
|
||||
}
|
||||
if(!string.IsNullOrWhiteSpace(cipher.Uri.Value) && (cipher.Uri.Value.StartsWith("http://")
|
||||
|| cipher.Uri.Value.StartsWith("https://")))
|
||||
if(!string.IsNullOrWhiteSpace(cipher.LoginUri.Value) && (cipher.LoginUri.Value.StartsWith("http://")
|
||||
|| cipher.LoginUri.Value.StartsWith("https://")))
|
||||
{
|
||||
buttons.Add(AppResources.GoToWebsite);
|
||||
}
|
||||
@ -463,15 +466,15 @@ namespace Bit.App.Pages
|
||||
}
|
||||
else if(selection == AppResources.CopyPassword)
|
||||
{
|
||||
Copy(cipher.Password.Value, AppResources.Password);
|
||||
Copy(cipher.LoginPassword.Value, AppResources.Password);
|
||||
}
|
||||
else if(selection == AppResources.CopyUsername)
|
||||
{
|
||||
Copy(cipher.Username, AppResources.Username);
|
||||
Copy(cipher.LoginUsername, AppResources.Username);
|
||||
}
|
||||
else if(selection == AppResources.GoToWebsite)
|
||||
{
|
||||
Device.OpenUri(new Uri(cipher.Uri.Value));
|
||||
Device.OpenUri(new Uri(cipher.LoginUri.Value));
|
||||
}
|
||||
else if(selection == AppResources.CopyNumber)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user