mirror of
https://github.com/bitwarden/mobile.git
synced 2024-12-17 15:27:43 +01:00
attachment listing
This commit is contained in:
parent
2a6fe3f351
commit
a5bf16a415
@ -544,6 +544,42 @@
|
||||
</controls:RepeaterView.ItemTemplate>
|
||||
</controls:RepeaterView>
|
||||
</StackLayout>
|
||||
<StackLayout StyleClass="box" IsVisible="{Binding ShowAttachments}">
|
||||
<StackLayout StyleClass="box-row-header">
|
||||
<Label Text="{u:I18n Attachments}"
|
||||
StyleClass="box-header, box-header-platform" />
|
||||
</StackLayout>
|
||||
<controls:RepeaterView ItemsSource="{Binding Cipher.Attachments}">
|
||||
<controls:RepeaterView.ItemTemplate>
|
||||
<DataTemplate x:DataType="views:AttachmentView">
|
||||
<StackLayout Spacing="0" Padding="0">
|
||||
<StackLayout Orientation="Horizontal" StyleClass="box-row" Spacing="10">
|
||||
<Label
|
||||
Text="{Binding FileName, Mode=OneWay}"
|
||||
StyleClass="box-value"
|
||||
VerticalTextAlignment="Center"
|
||||
HorizontalOptions="StartAndExpand" />
|
||||
<Label
|
||||
Text="{Binding SizeName, Mode=OneWay}"
|
||||
StyleClass="box-sub-label"
|
||||
HorizontalTextAlignment="End"
|
||||
HorizontalOptions="End"
|
||||
VerticalTextAlignment="Center"
|
||||
VerticalOptions="CenterAndExpand" />
|
||||
<controls:FaButton
|
||||
StyleClass="box-row-button, box-row-button-platform"
|
||||
Text=""
|
||||
Command="{Binding BindingContext.DownloadAttachmentCommand, Source={x:Reference _page}}"
|
||||
CommandParameter="{Binding .}"
|
||||
HorizontalOptions="End"
|
||||
VerticalOptions="CenterAndExpand" />
|
||||
</StackLayout>
|
||||
<BoxView StyleClass="box-row-separator" />
|
||||
</StackLayout>
|
||||
</DataTemplate>
|
||||
</controls:RepeaterView.ItemTemplate>
|
||||
</controls:RepeaterView>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
@ -47,6 +47,7 @@ namespace Bit.App.Pages
|
||||
TogglePasswordCommand = new Command(TogglePassword);
|
||||
ToggleCardCodeCommand = new Command(ToggleCardCode);
|
||||
CheckPasswordCommand = new Command(CheckPasswordAsync);
|
||||
DownloadAttachmentCommand = new Command<AttachmentView>(DownloadAttachmentAsync);
|
||||
|
||||
PageTitle = AppResources.ViewItem;
|
||||
}
|
||||
@ -58,6 +59,7 @@ namespace Bit.App.Pages
|
||||
public Command TogglePasswordCommand { get; set; }
|
||||
public Command ToggleCardCodeCommand { get; set; }
|
||||
public Command CheckPasswordCommand { get; set; }
|
||||
public Command DownloadAttachmentCommand { get; set; }
|
||||
public string CipherId { get; set; }
|
||||
public CipherView Cipher
|
||||
{
|
||||
@ -104,21 +106,22 @@ namespace Bit.App.Pages
|
||||
nameof(ShowCardCodeIcon)
|
||||
});
|
||||
}
|
||||
public bool IsLogin => _cipher?.Type == Core.Enums.CipherType.Login;
|
||||
public bool IsIdentity => _cipher?.Type == Core.Enums.CipherType.Identity;
|
||||
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 bool ShowUris => IsLogin && _cipher.Login.HasUris;
|
||||
public bool IsLogin => Cipher?.Type == Core.Enums.CipherType.Login;
|
||||
public bool IsIdentity => Cipher?.Type == Core.Enums.CipherType.Identity;
|
||||
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 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 ShowTotp => IsLogin && !string.IsNullOrWhiteSpace(_cipher.Login.Totp) &&
|
||||
!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);
|
||||
public string ShowPasswordIcon => _showPassword ? "" : "";
|
||||
public string ShowCardCodeIcon => _showCardCode ? "" : "";
|
||||
public string ShowPasswordIcon => ShowPassword ? "" : "";
|
||||
public string ShowCardCodeIcon => ShowCardCode ? "" : "";
|
||||
public string TotpCodeFormatted
|
||||
{
|
||||
get => _totpCodeFormatted;
|
||||
@ -245,6 +248,17 @@ namespace Bit.App.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private async void DownloadAttachmentAsync(AttachmentView attachment)
|
||||
{
|
||||
if(Cipher.OrganizationId == null && !CanAccessPremium)
|
||||
{
|
||||
await _platformUtilsService.ShowDialogAsync(AppResources.PremiumRequired);
|
||||
}
|
||||
await _deviceActionService.ShowLoadingAsync(AppResources.Downloading);
|
||||
await Task.Delay(2000); // TODO: download
|
||||
await _deviceActionService.HideLoadingAsync();
|
||||
}
|
||||
|
||||
private async void CopyAsync(string id, string text = null)
|
||||
{
|
||||
string name = null;
|
||||
|
@ -145,4 +145,11 @@
|
||||
<Setter Property="LineBreakMode"
|
||||
Value="CharacterWrap" />
|
||||
</Style>
|
||||
<Style TargetType="Label"
|
||||
Class="box-sub-label">
|
||||
<Setter Property="FontSize"
|
||||
Value="Small" />
|
||||
<Setter Property="TextColor"
|
||||
Value="{StaticResource MutedColor}" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
|
@ -13,6 +13,7 @@
|
||||
<Color x:Key="PasswordSpecialColor">#c40800</Color>
|
||||
|
||||
<Color x:Key="BorderColor">#dddddd</Color>
|
||||
<Color x:Key="DisabledIconColor">#c7c7cd</Color>
|
||||
|
||||
<Color x:Key="BoxBorderColor">#f0f0f0</Color>
|
||||
<Color x:Key="BoxHeaderTextColor">#3c8dbc</Color>
|
||||
|
@ -13,6 +13,7 @@
|
||||
<Color x:Key="PasswordSpecialColor">#c40800</Color>
|
||||
|
||||
<Color x:Key="BorderColor">#dddddd</Color>
|
||||
<Color x:Key="DisabledIconColor">#c7c7cd</Color>
|
||||
|
||||
<Color x:Key="BoxBorderColor">#dddddd</Color>
|
||||
<Color x:Key="BoxHeaderTextColor">#3c8dbc</Color>
|
||||
|
Loading…
Reference in New Issue
Block a user