attachment updates
@ -935,6 +935,21 @@
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-xxxhdpi\paperclip.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\trash.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-hdpi\trash.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\trash.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-xxhdpi\trash.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable-xxxhdpi\trash.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<Import Project="..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
13
src/Android/Resources/Resource.Designer.cs
generated
@ -2756,8 +2756,8 @@ namespace Bit.Android
|
||||
// aapt resource value: 0x7f0200e6
|
||||
public const int notification_sm = 2130837734;
|
||||
|
||||
// aapt resource value: 0x7f0200f7
|
||||
public const int notification_template_icon_bg = 2130837751;
|
||||
// aapt resource value: 0x7f0200f8
|
||||
public const int notification_template_icon_bg = 2130837752;
|
||||
|
||||
// aapt resource value: 0x7f0200e7
|
||||
public const int paperclip = 2130837735;
|
||||
@ -2799,13 +2799,16 @@ namespace Bit.Android
|
||||
public const int tools_selected = 2130837747;
|
||||
|
||||
// aapt resource value: 0x7f0200f4
|
||||
public const int upload = 2130837748;
|
||||
public const int trash = 2130837748;
|
||||
|
||||
// aapt resource value: 0x7f0200f5
|
||||
public const int user = 2130837749;
|
||||
public const int upload = 2130837749;
|
||||
|
||||
// aapt resource value: 0x7f0200f6
|
||||
public const int yubikey = 2130837750;
|
||||
public const int user = 2130837750;
|
||||
|
||||
// aapt resource value: 0x7f0200f7
|
||||
public const int yubikey = 2130837751;
|
||||
|
||||
static Drawable()
|
||||
{
|
||||
|
Before Width: | Height: | Size: 658 B After Width: | Height: | Size: 658 B |
BIN
src/Android/Resources/drawable-hdpi/trash.png
Normal file
After Width: | Height: | Size: 452 B |
Before Width: | Height: | Size: 802 B After Width: | Height: | Size: 802 B |
BIN
src/Android/Resources/drawable-xhdpi/trash.png
Normal file
After Width: | Height: | Size: 390 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
src/Android/Resources/drawable-xxhdpi/trash.png
Normal file
After Width: | Height: | Size: 534 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
BIN
src/Android/Resources/drawable-xxxhdpi/trash.png
Normal file
After Width: | Height: | Size: 552 B |
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
BIN
src/Android/Resources/drawable/trash.png
Normal file
After Width: | Height: | Size: 274 B |
@ -6,10 +6,11 @@ namespace Bit.App.Controls
|
||||
public class VaultAttachmentsViewCell : LabeledRightDetailCell
|
||||
{
|
||||
public VaultAttachmentsViewCell()
|
||||
: base(false)
|
||||
{
|
||||
Label.SetBinding(Label.TextProperty, nameof(VaultAttachmentsPageModel.Attachment.Name));
|
||||
Detail.SetBinding(Label.TextProperty, nameof(VaultAttachmentsPageModel.Attachment.SizeName));
|
||||
Icon.Source = "trash";
|
||||
Detail.MinimumWidthRequest = 100;
|
||||
BackgroundColor = Color.White;
|
||||
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
|
@ -22,10 +22,13 @@ namespace Bit.App.Pages
|
||||
private readonly IConnectivity _connectivity;
|
||||
private readonly IDeviceActionService _deviceActiveService;
|
||||
private readonly IGoogleAnalyticsService _googleAnalyticsService;
|
||||
private readonly ITokenService _tokenService;
|
||||
private readonly ICryptoService _cryptoService;
|
||||
private readonly string _loginId;
|
||||
private Login _login;
|
||||
private byte[] _fileBytes;
|
||||
private DateTime? _lastAction;
|
||||
private bool _canUseAttachments = true;
|
||||
|
||||
public VaultAttachmentsPage(string loginId)
|
||||
: base(true)
|
||||
@ -36,6 +39,8 @@ namespace Bit.App.Pages
|
||||
_userDialogs = Resolver.Resolve<IUserDialogs>();
|
||||
_deviceActiveService = Resolver.Resolve<IDeviceActionService>();
|
||||
_googleAnalyticsService = Resolver.Resolve<IGoogleAnalyticsService>();
|
||||
_tokenService = Resolver.Resolve<ITokenService>();
|
||||
_cryptoService = Resolver.Resolve<ICryptoService>();
|
||||
|
||||
Init();
|
||||
}
|
||||
@ -51,6 +56,8 @@ namespace Bit.App.Pages
|
||||
|
||||
private void Init()
|
||||
{
|
||||
_canUseAttachments = _cryptoService.EncKey != null;
|
||||
|
||||
SubscribeFileResult(true);
|
||||
var selectButton = new ExtendedButton
|
||||
{
|
||||
@ -103,10 +110,14 @@ namespace Bit.App.Pages
|
||||
ItemsSource = PresentationAttchments,
|
||||
HasUnevenRows = true,
|
||||
ItemTemplate = new DataTemplate(() => new VaultAttachmentsViewCell()),
|
||||
Footer = NewTable,
|
||||
VerticalOptions = LayoutOptions.FillAndExpand
|
||||
};
|
||||
|
||||
if(_tokenService.TokenPremium)
|
||||
{
|
||||
ListView.Footer = NewTable;
|
||||
}
|
||||
|
||||
NoDataLabel = new Label
|
||||
{
|
||||
Text = AppResources.NoAttachments,
|
||||
@ -130,6 +141,13 @@ namespace Bit.App.Pages
|
||||
}
|
||||
_lastAction = DateTime.UtcNow;
|
||||
|
||||
|
||||
if(!_canUseAttachments)
|
||||
{
|
||||
await ShowUpdateKeyAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!_connectivity.IsConnected)
|
||||
{
|
||||
AlertNoConnection();
|
||||
@ -168,7 +186,11 @@ namespace Bit.App.Pages
|
||||
|
||||
Title = AppResources.Attachments;
|
||||
Content = ListView;
|
||||
ToolbarItems.Add(saveToolBarItem);
|
||||
|
||||
if(_tokenService.TokenPremium)
|
||||
{
|
||||
ToolbarItems.Add(saveToolBarItem);
|
||||
}
|
||||
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
@ -186,6 +208,11 @@ namespace Bit.App.Pages
|
||||
base.OnAppearing();
|
||||
ListView.ItemSelected += AttachmentSelected;
|
||||
await LoadAttachmentsAsync();
|
||||
|
||||
if(_tokenService.TokenPremium && !_canUseAttachments)
|
||||
{
|
||||
await ShowUpdateKeyAsync();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDisappearing()
|
||||
@ -235,30 +262,28 @@ namespace Bit.App.Pages
|
||||
|
||||
((ListView)sender).SelectedItem = null;
|
||||
|
||||
var buttons = new List<string> { };
|
||||
var selection = await DisplayActionSheet(attachment.Name, AppResources.Cancel, AppResources.Delete,
|
||||
buttons.ToArray());
|
||||
|
||||
if(selection == AppResources.Delete)
|
||||
if(!await _userDialogs.ConfirmAsync(AppResources.DoYouReallyWantToDelete, null, AppResources.Yes, AppResources.No))
|
||||
{
|
||||
_userDialogs.ShowLoading(AppResources.Deleting, MaskType.Black);
|
||||
var saveTask = await _loginService.DeleteAttachmentAsync(_login, attachment.Id);
|
||||
_userDialogs.HideLoading();
|
||||
return;
|
||||
}
|
||||
|
||||
if(saveTask.Succeeded)
|
||||
{
|
||||
_userDialogs.Toast(AppResources.AttachmentDeleted);
|
||||
_googleAnalyticsService.TrackAppEvent("DeletedAttachment");
|
||||
await LoadAttachmentsAsync();
|
||||
}
|
||||
else if(saveTask.Errors.Count() > 0)
|
||||
{
|
||||
await _userDialogs.AlertAsync(saveTask.Errors.First().Message, AppResources.AnErrorHasOccurred);
|
||||
}
|
||||
else
|
||||
{
|
||||
await _userDialogs.AlertAsync(AppResources.AnErrorHasOccurred);
|
||||
}
|
||||
_userDialogs.ShowLoading(AppResources.Deleting, MaskType.Black);
|
||||
var saveTask = await _loginService.DeleteAttachmentAsync(_login, attachment.Id);
|
||||
_userDialogs.HideLoading();
|
||||
|
||||
if(saveTask.Succeeded)
|
||||
{
|
||||
_userDialogs.Toast(AppResources.AttachmentDeleted);
|
||||
_googleAnalyticsService.TrackAppEvent("DeletedAttachment");
|
||||
await LoadAttachmentsAsync();
|
||||
}
|
||||
else if(saveTask.Errors.Count() > 0)
|
||||
{
|
||||
await _userDialogs.AlertAsync(saveTask.Errors.First().Message, AppResources.AnErrorHasOccurred);
|
||||
}
|
||||
else
|
||||
{
|
||||
await _userDialogs.AlertAsync(AppResources.AnErrorHasOccurred);
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,5 +309,15 @@ namespace Bit.App.Pages
|
||||
SubscribeFileResult(true);
|
||||
});
|
||||
}
|
||||
|
||||
private async Task ShowUpdateKeyAsync()
|
||||
{
|
||||
var confirmed = await _userDialogs.ConfirmAsync(AppResources.UpdateKey, AppResources.FeatureUnavailable,
|
||||
AppResources.LearnMore, AppResources.Cancel);
|
||||
if(confirmed)
|
||||
{
|
||||
Device.OpenUri(new Uri("https://help.bitwarden.com"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
Table.Root.Remove(AttachmentsSection);
|
||||
}
|
||||
if(Model.ShowAttachments)
|
||||
if(Model.ShowAttachments && _tokenService.TokenPremium)
|
||||
{
|
||||
AttachmentsSection = new TableSection(AppResources.Attachments);
|
||||
AttachmentCells = new List<AttachmentViewCell>();
|
||||
|
36
src/App/Resources/AppResources.Designer.cs
generated
@ -1024,6 +1024,15 @@ namespace Bit.App.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Feature Unavailable.
|
||||
/// </summary>
|
||||
public static string FeatureUnavailable {
|
||||
get {
|
||||
return ResourceManager.GetString("FeatureUnavailable", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to File.
|
||||
/// </summary>
|
||||
@ -1267,6 +1276,15 @@ namespace Bit.App.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Learn More.
|
||||
/// </summary>
|
||||
public static string LearnMore {
|
||||
get {
|
||||
return ResourceManager.GetString("LearnMore", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Length.
|
||||
/// </summary>
|
||||
@ -1537,6 +1555,15 @@ namespace Bit.App.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Maximum file size is 100 MB..
|
||||
/// </summary>
|
||||
public static string MaxFileSize {
|
||||
get {
|
||||
return ResourceManager.GetString("MaxFileSize", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Minimum Numbers.
|
||||
/// </summary>
|
||||
@ -2221,6 +2248,15 @@ namespace Bit.App.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to You cannot use this feature until you update your encryption key..
|
||||
/// </summary>
|
||||
public static string UpdateKey {
|
||||
get {
|
||||
return ResourceManager.GetString("UpdateKey", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to URI.
|
||||
/// </summary>
|
||||
|
@ -986,4 +986,16 @@
|
||||
<data name="FileSource" xml:space="preserve">
|
||||
<value>File Source</value>
|
||||
</data>
|
||||
<data name="FeatureUnavailable" xml:space="preserve">
|
||||
<value>Feature Unavailable</value>
|
||||
</data>
|
||||
<data name="MaxFileSize" xml:space="preserve">
|
||||
<value>Maximum file size is 100 MB.</value>
|
||||
</data>
|
||||
<data name="UpdateKey" xml:space="preserve">
|
||||
<value>You cannot use this feature until you update your encryption key.</value>
|
||||
</data>
|
||||
<data name="LearnMore" xml:space="preserve">
|
||||
<value>Learn More</value>
|
||||
</data>
|
||||
</root>
|
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
Before Width: | Height: | Size: 802 B After Width: | Height: | Size: 802 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
src/iOS/Resources/trash.png
Normal file
After Width: | Height: | Size: 274 B |
BIN
src/iOS/Resources/trash@2x.png
Normal file
After Width: | Height: | Size: 390 B |
BIN
src/iOS/Resources/trash@3x.png
Normal file
After Width: | Height: | Size: 534 B |
@ -776,6 +776,15 @@
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\paperclip%403x.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\trash.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\trash%402x.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\trash%403x.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
|