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

View file

@ -72,10 +72,12 @@ namespace Bit.App.Pages
nameof(IsCard), nameof(IsCard),
nameof(IsSecureNote), nameof(IsSecureNote),
nameof(ShowUris), nameof(ShowUris),
nameof(ShowFields),
nameof(ShowAttachments), nameof(ShowAttachments),
nameof(ShowTotp), nameof(ShowTotp),
nameof(ColoredPassword), nameof(ColoredPassword),
nameof(UpdatedText),
nameof(PasswordUpdatedText),
nameof(PasswordHistoryText),
nameof(ShowIdentityAddress), nameof(ShowIdentityAddress),
}); });
} }
@ -112,12 +114,67 @@ namespace Bit.App.Pages
public bool IsCard => Cipher?.Type == Core.Enums.CipherType.Card; public bool IsCard => Cipher?.Type == Core.Enums.CipherType.Card;
public bool IsSecureNote => Cipher?.Type == Core.Enums.CipherType.SecureNote; public bool IsSecureNote => Cipher?.Type == Core.Enums.CipherType.SecureNote;
public FormattedString ColoredPassword => PasswordFormatter.FormatPassword(Cipher.Login.Password); 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 ShowUris => IsLogin && Cipher.Login.HasUris;
public bool ShowIdentityAddress => IsIdentity && ( public bool ShowIdentityAddress => IsIdentity && (
!string.IsNullOrWhiteSpace(Cipher.Identity.Address1) || !string.IsNullOrWhiteSpace(Cipher.Identity.Address1) ||
!string.IsNullOrWhiteSpace(Cipher.Identity.City) || !string.IsNullOrWhiteSpace(Cipher.Identity.City) ||
!string.IsNullOrWhiteSpace(Cipher.Identity.Country)); !string.IsNullOrWhiteSpace(Cipher.Identity.Country));
public bool ShowFields => Cipher.HasFields;
public bool ShowAttachments => Cipher.HasAttachments && (CanAccessPremium || Cipher.OrganizationId != null); public bool ShowAttachments => Cipher.HasAttachments && (CanAccessPremium || Cipher.OrganizationId != null);
public bool ShowTotp => IsLogin && !string.IsNullOrWhiteSpace(Cipher.Login.Totp) && public bool ShowTotp => IsLogin && !string.IsNullOrWhiteSpace(Cipher.Login.Totp) &&
!string.IsNullOrWhiteSpace(TotpCodeFormatted); !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> /// <summary>
/// Looks up a localized string similar to Are you sure you want to overwrite the current password?. /// Looks up a localized string similar to Are you sure you want to overwrite the current password?.
/// </summary> /// </summary>

View file

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

View file

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