view page update info

This commit is contained in:
Kyle Spearrin 2019-04-30 09:50:35 -04:00
parent 865deaf401
commit 33684bd140
5 changed files with 123 additions and 9 deletions

View File

@ -23,6 +23,7 @@
<ResourceDictionary>
<u:InverseBoolConverter x:Key="inverseBool" />
<u:StringHasValueConverter x:Key="stringHasValue" />
<u:IsNotNullConverter x:Key="notNull" />
</ResourceDictionary>
</ContentPage.Resources>
@ -472,7 +473,7 @@
</StackLayout>
<BoxView StyleClass="box-row-separator" />
</StackLayout>
<StackLayout StyleClass="box" IsVisible="{Binding ShowFields}">
<StackLayout StyleClass="box" IsVisible="{Binding Cipher.HasFields}">
<StackLayout StyleClass="box-row-header">
<Label Text="{u:I18n CustomFields}"
StyleClass="box-header, box-header-platform" />
@ -507,7 +508,8 @@
StyleClass="box-value"
Grid.Row="1"
Grid.Column="0"
IsVisible="{Binding IsBooleanType}" />
IsVisible="{Binding IsBooleanType}"
Margin="0, 5, 0, 0" />
<StackLayout IsVisible="{Binding IsHiddenType}"
Grid.Row="1"
Grid.Column="0">
@ -563,16 +565,13 @@
Text="{Binding SizeName, Mode=OneWay}"
StyleClass="box-sub-label"
HorizontalTextAlignment="End"
HorizontalOptions="End"
VerticalTextAlignment="Center"
VerticalOptions="CenterAndExpand" />
VerticalTextAlignment="Center" />
<controls:FaButton
StyleClass="box-row-button, box-row-button-platform"
Text="&#xf019;"
Command="{Binding BindingContext.DownloadAttachmentCommand, Source={x:Reference _page}}"
CommandParameter="{Binding .}"
HorizontalOptions="End"
VerticalOptions="CenterAndExpand" />
VerticalOptions="Center" />
</StackLayout>
<BoxView StyleClass="box-row-separator" />
</StackLayout>
@ -580,6 +579,16 @@
</controls:RepeaterView.ItemTemplate>
</controls:RepeaterView>
</StackLayout>
<StackLayout StyleClass="box-bottom">
<Label FormattedText="{Binding UpdatedText}"
StyleClass="box-footer-label" />
<Label FormattedText="{Binding PasswordUpdatedText}"
StyleClass="box-footer-label"
IsVisible="{Binding Cipher.PasswordRevisionDisplayDate, Converter={StaticResource notNull}}" />
<Label FormattedText="{Binding PasswordHistoryText}"
StyleClass="box-footer-label"
IsVisible="{Binding Cipher.HasPasswordHistory}" />
</StackLayout>
</StackLayout>
</ScrollView>

View File

@ -72,10 +72,12 @@ namespace Bit.App.Pages
nameof(IsCard),
nameof(IsSecureNote),
nameof(ShowUris),
nameof(ShowFields),
nameof(ShowAttachments),
nameof(ShowTotp),
nameof(ColoredPassword),
nameof(UpdatedText),
nameof(PasswordUpdatedText),
nameof(PasswordHistoryText),
nameof(ShowIdentityAddress),
});
}
@ -112,12 +114,67 @@ namespace Bit.App.Pages
public bool IsCard => Cipher?.Type == Core.Enums.CipherType.Card;
public bool IsSecureNote => Cipher?.Type == Core.Enums.CipherType.SecureNote;
public FormattedString ColoredPassword => PasswordFormatter.FormatPassword(Cipher.Login.Password);
public FormattedString UpdatedText
{
get
{
var fs = new FormattedString();
fs.Spans.Add(new Span
{
Text = string.Format("{0}:", AppResources.DateUpdated),
FontAttributes = FontAttributes.Bold
});
fs.Spans.Add(new Span
{
Text = string.Format(" {0} {1}",
Cipher.RevisionDate.ToShortDateString(),
Cipher.RevisionDate.ToShortTimeString())
});
return fs;
}
}
public FormattedString PasswordUpdatedText
{
get
{
var fs = new FormattedString();
fs.Spans.Add(new Span
{
Text = string.Format("{0}:", AppResources.DatePasswordUpdated),
FontAttributes = FontAttributes.Bold
});
fs.Spans.Add(new Span
{
Text = string.Format(" {0} {1}",
Cipher.PasswordRevisionDisplayDate?.ToShortDateString(),
Cipher.PasswordRevisionDisplayDate?.ToShortTimeString())
});
return fs;
}
}
public FormattedString PasswordHistoryText
{
get
{
var fs = new FormattedString();
fs.Spans.Add(new Span
{
Text = string.Format("{0}:", AppResources.PasswordHistory),
FontAttributes = FontAttributes.Bold
});
fs.Spans.Add(new Span
{
Text = string.Format(" {0}", Cipher.PasswordHistory.Count.ToString()),
TextColor = (Color)Application.Current.Resources["PrimaryColor"]
});
return fs;
}
}
public bool ShowUris => IsLogin && Cipher.Login.HasUris;
public bool ShowIdentityAddress => IsIdentity && (
!string.IsNullOrWhiteSpace(Cipher.Identity.Address1) ||
!string.IsNullOrWhiteSpace(Cipher.Identity.City) ||
!string.IsNullOrWhiteSpace(Cipher.Identity.Country));
public bool ShowFields => Cipher.HasFields;
public bool ShowAttachments => Cipher.HasAttachments && (CanAccessPremium || Cipher.OrganizationId != null);
public bool ShowTotp => IsLogin && !string.IsNullOrWhiteSpace(Cipher.Login.Totp) &&
!string.IsNullOrWhiteSpace(TotpCodeFormatted);

View File

@ -2652,6 +2652,15 @@ namespace Bit.App.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Password History.
/// </summary>
internal static string PasswordHistory {
get {
return ResourceManager.GetString("PasswordHistory", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Are you sure you want to overwrite the current password?.
/// </summary>

View File

@ -1387,4 +1387,7 @@
<data name="Value" xml:space="preserve">
<value>Value</value>
</data>
<data name="PasswordHistory" xml:space="preserve">
<value>Password History</value>
</data>
</root>

View File

@ -16,6 +16,11 @@
<Setter Property="TextColor"
Value="{StaticResource TextColor}" />
</Style>
<Style TargetType="Label"
x:Key="text-muted">
<Setter Property="TextColor"
Value="{StaticResource MutedColor}" />
</Style>
<Style TargetType="Label"
x:Key="text-danger">
<Setter Property="TextColor"
@ -26,6 +31,21 @@
<Setter Property="TextColor"
Value="{StaticResource SuccessColor}" />
</Style>
<Style TargetType="Label"
x:Key="text-sm">
<Setter Property="FontSize"
Value="Small" />
</Style>
<Style TargetType="Label"
x:Key="text-lg">
<Setter Property="FontSize"
Value="Large" />
</Style>
<Style TargetType="Label"
x:Key="text-bold">
<Setter Property="FontAttributes"
Value="Bold" />
</Style>
<!-- List -->
<Style TargetType="ListView"
@ -87,6 +107,13 @@
<Setter Property="Spacing"
Value="0" />
</Style>
<Style TargetType="StackLayout"
Class="box-bottom">
<Setter Property="Padding"
Value="10, 0, 10, 10" />
<Setter Property="Spacing"
Value="0" />
</Style>
<Style TargetType="StackLayout"
Class="box-row-header">
<Setter Property="Padding"
@ -136,6 +163,8 @@
Class="box-label">
<Setter Property="FontSize"
Value="Small" />
<Setter Property="Margin"
Value="0, 0, 0, 5" />
<Setter Property="TextColor"
Value="{StaticResource MutedColor}" />
</Style>
@ -152,4 +181,11 @@
<Setter Property="TextColor"
Value="{StaticResource MutedColor}" />
</Style>
<Style TargetType="Label"
Class="box-footer-label">
<Setter Property="FontSize"
Value="Small" />
<Setter Property="TextColor"
Value="{StaticResource MutedColor}" />
</Style>
</ResourceDictionary>