paperclip icon for attachments in listing

This commit is contained in:
Kyle Spearrin 2017-07-23 00:09:24 -04:00
parent c96cf2b0e5
commit 4e8f69f692
15 changed files with 68 additions and 21 deletions

View file

@ -920,6 +920,21 @@
<ItemGroup> <ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\camera.png" /> <AndroidResource Include="Resources\drawable-xxxhdpi\camera.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\paperclip.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\paperclip.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xhdpi\paperclip.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxhdpi\paperclip.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxxhdpi\paperclip.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> <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')" /> <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"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

View file

@ -2756,53 +2756,56 @@ namespace Bit.Android
// aapt resource value: 0x7f0200e6 // aapt resource value: 0x7f0200e6
public const int notification_sm = 2130837734; public const int notification_sm = 2130837734;
// aapt resource value: 0x7f0200f6 // aapt resource value: 0x7f0200f7
public const int notification_template_icon_bg = 2130837750; public const int notification_template_icon_bg = 2130837751;
// aapt resource value: 0x7f0200e7 // aapt resource value: 0x7f0200e7
public const int plus = 2130837735; public const int paperclip = 2130837735;
// aapt resource value: 0x7f0200e8 // aapt resource value: 0x7f0200e8
public const int refresh = 2130837736; public const int plus = 2130837736;
// aapt resource value: 0x7f0200e9 // aapt resource value: 0x7f0200e9
public const int roundedbg = 2130837737; public const int refresh = 2130837737;
// aapt resource value: 0x7f0200ea // aapt resource value: 0x7f0200ea
public const int roundedbgdark = 2130837738; public const int roundedbg = 2130837738;
// aapt resource value: 0x7f0200eb // aapt resource value: 0x7f0200eb
public const int search = 2130837739; public const int roundedbgdark = 2130837739;
// aapt resource value: 0x7f0200ec // aapt resource value: 0x7f0200ec
public const int share = 2130837740; public const int search = 2130837740;
// aapt resource value: 0x7f0200ed // aapt resource value: 0x7f0200ed
public const int share_tools = 2130837741; public const int share = 2130837741;
// aapt resource value: 0x7f0200ee // aapt resource value: 0x7f0200ee
public const int splash_screen = 2130837742; public const int share_tools = 2130837742;
// aapt resource value: 0x7f0200ef // aapt resource value: 0x7f0200ef
public const int star = 2130837743; public const int splash_screen = 2130837743;
// aapt resource value: 0x7f0200f0 // aapt resource value: 0x7f0200f0
public const int star_selected = 2130837744; public const int star = 2130837744;
// aapt resource value: 0x7f0200f1 // aapt resource value: 0x7f0200f1
public const int tools = 2130837745; public const int star_selected = 2130837745;
// aapt resource value: 0x7f0200f2 // aapt resource value: 0x7f0200f2
public const int tools_selected = 2130837746; public const int tools = 2130837746;
// aapt resource value: 0x7f0200f3 // aapt resource value: 0x7f0200f3
public const int upload = 2130837747; public const int tools_selected = 2130837747;
// aapt resource value: 0x7f0200f4 // aapt resource value: 0x7f0200f4
public const int user = 2130837748; public const int upload = 2130837748;
// aapt resource value: 0x7f0200f5 // aapt resource value: 0x7f0200f5
public const int yubikey = 2130837749; public const int user = 2130837749;
// aapt resource value: 0x7f0200f6
public const int yubikey = 2130837750;
static Drawable() static Drawable()
{ {

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

View file

@ -28,6 +28,14 @@ namespace Bit.App.Controls
Margin = new Thickness(5, 0, 0, 0) Margin = new Thickness(5, 0, 0, 0)
}; };
LabelIcon2 = new CachedImage
{
WidthRequest = 16,
HeightRequest = 16,
HorizontalOptions = LayoutOptions.Start,
Margin = new Thickness(5, 0, 0, 0)
};
Button = new ExtendedButton Button = new ExtendedButton
{ {
WidthRequest = 60 WidthRequest = 60
@ -42,13 +50,15 @@ namespace Bit.App.Controls
grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(60, GridUnitType.Absolute) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(60, GridUnitType.Absolute) });
grid.Children.Add(Label, 0, 0); grid.Children.Add(Label, 0, 0);
grid.Children.Add(Detail, 0, 1); grid.Children.Add(Detail, 0, 1);
grid.Children.Add(LabelIcon, 1, 0); grid.Children.Add(LabelIcon, 1, 0);
grid.Children.Add(Button, 2, 0); grid.Children.Add(LabelIcon2, 2, 0);
Grid.SetColumnSpan(Detail, 2); grid.Children.Add(Button, 3, 0);
Grid.SetColumnSpan(Detail, 3);
Grid.SetRowSpan(Button, 2); Grid.SetRowSpan(Button, 2);
if(Device.RuntimePlatform == Device.Android) if(Device.RuntimePlatform == Device.Android)
@ -62,6 +72,7 @@ namespace Bit.App.Controls
public Label Label { get; private set; } public Label Label { get; private set; }
public Label Detail { get; private set; } public Label Detail { get; private set; }
public CachedImage LabelIcon { get; private set; } public CachedImage LabelIcon { get; private set; }
public CachedImage LabelIcon2 { get; private set; }
public Button Button { get; private set; } public Button Button { get; private set; }
} }
} }

View file

@ -15,12 +15,14 @@ namespace Bit.App.Controls
Label.SetBinding(Label.TextProperty, nameof(VaultListPageModel.Login.Name)); Label.SetBinding(Label.TextProperty, nameof(VaultListPageModel.Login.Name));
Detail.SetBinding(Label.TextProperty, nameof(VaultListPageModel.Login.Username)); Detail.SetBinding(Label.TextProperty, nameof(VaultListPageModel.Login.Username));
LabelIcon.SetBinding(VisualElement.IsVisibleProperty, nameof(VaultListPageModel.Login.Shared)); LabelIcon.SetBinding(VisualElement.IsVisibleProperty, nameof(VaultListPageModel.Login.Shared));
LabelIcon2.SetBinding(VisualElement.IsVisibleProperty, nameof(VaultListPageModel.Login.HasAttachments));
Button.Image = "more"; Button.Image = "more";
Button.Command = new Command(() => moreClickedAction?.Invoke(LoginParameter)); Button.Command = new Command(() => moreClickedAction?.Invoke(LoginParameter));
Button.BackgroundColor = Color.Transparent; Button.BackgroundColor = Color.Transparent;
LabelIcon.Source = "share"; LabelIcon.Source = "share";
LabelIcon2.Source = "paperclip";
BackgroundColor = Color.White; BackgroundColor = Color.White;
} }

View file

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Bit.App.Resources; using Bit.App.Resources;
using System.Linq;
namespace Bit.App.Models.Page namespace Bit.App.Models.Page
{ {
@ -12,6 +13,7 @@ namespace Bit.App.Models.Page
{ {
Id = login.Id; Id = login.Id;
Shared = !string.IsNullOrWhiteSpace(login.OrganizationId); Shared = !string.IsNullOrWhiteSpace(login.OrganizationId);
HasAttachments = login.Attachments?.Any() ?? false;
FolderId = login.FolderId; FolderId = login.FolderId;
Name = login.Name?.Decrypt(login.OrganizationId); Name = login.Name?.Decrypt(login.OrganizationId);
Username = login.Username?.Decrypt(login.OrganizationId) ?? " "; Username = login.Username?.Decrypt(login.OrganizationId) ?? " ";
@ -22,6 +24,7 @@ namespace Bit.App.Models.Page
public string Id { get; set; } public string Id { get; set; }
public bool Shared { get; set; } public bool Shared { get; set; }
public bool HasAttachments { get; set; }
public string FolderId { get; set; } public string FolderId { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Username { get; set; } public string Username { get; set; }

View file

@ -54,15 +54,19 @@ namespace Bit.App.Services
public async Task<IEnumerable<Login>> GetAllAsync() public async Task<IEnumerable<Login>> GetAllAsync()
{ {
var attachmentData = await _attachmentRepository.GetAllByUserIdAsync(_authService.UserId);
var attachmentDict = attachmentData.GroupBy(a => a.LoginId).ToDictionary(g => g.Key, g => g.ToList());
var data = await _loginRepository.GetAllByUserIdAsync(_authService.UserId); var data = await _loginRepository.GetAllByUserIdAsync(_authService.UserId);
var logins = data.Select(f => new Login(f)); var logins = data.Select(f => new Login(f, attachmentDict.ContainsKey(f.Id) ? attachmentDict[f.Id] : null));
return logins; return logins;
} }
public async Task<IEnumerable<Login>> GetAllAsync(bool favorites) public async Task<IEnumerable<Login>> GetAllAsync(bool favorites)
{ {
var attachmentData = await _attachmentRepository.GetAllByUserIdAsync(_authService.UserId);
var attachmentDict = attachmentData.GroupBy(a => a.LoginId).ToDictionary(g => g.Key, g => g.ToList());
var data = await _loginRepository.GetAllByUserIdAsync(_authService.UserId, favorites); var data = await _loginRepository.GetAllByUserIdAsync(_authService.UserId, favorites);
var logins = data.Select(f => new Login(f)); var logins = data.Select(f => new Login(f, attachmentDict.ContainsKey(f.Id) ? attachmentDict[f.Id] : null));
return logins; return logins;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -767,6 +767,15 @@
<ItemGroup> <ItemGroup>
<BundleResource Include="Resources\photo%403x.png" /> <BundleResource Include="Resources\photo%403x.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\paperclip.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\paperclip%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\paperclip%403x.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>