From b920e7e95c46281b12a24e3021abf2dae0c09b8a Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 24 Jul 2017 10:34:22 -0400 Subject: [PATCH] attachment updates --- src/Android/Android.csproj | 15 ++++ src/Android/Resources/Resource.Designer.cs | 13 +-- .../Resources/drawable-hdpi/paperclip.png | Bin 658 -> 658 bytes src/Android/Resources/drawable-hdpi/trash.png | Bin 0 -> 452 bytes .../Resources/drawable-xhdpi/paperclip.png | Bin 802 -> 802 bytes .../Resources/drawable-xhdpi/trash.png | Bin 0 -> 390 bytes .../Resources/drawable-xxhdpi/paperclip.png | Bin 1151 -> 1151 bytes .../Resources/drawable-xxhdpi/trash.png | Bin 0 -> 534 bytes .../Resources/drawable-xxxhdpi/paperclip.png | Bin 1496 -> 1496 bytes .../Resources/drawable-xxxhdpi/trash.png | Bin 0 -> 552 bytes src/Android/Resources/drawable/paperclip.png | Bin 249 -> 249 bytes src/Android/Resources/drawable/trash.png | Bin 0 -> 274 bytes src/App/Controls/VaultAttachmentsViewCell.cs | 3 +- src/App/Pages/Vault/VaultAttachmentsPage.cs | 83 +++++++++++++----- src/App/Pages/Vault/VaultViewLoginPage.cs | 2 +- src/App/Resources/AppResources.Designer.cs | 36 ++++++++ src/App/Resources/AppResources.resx | 12 +++ src/iOS/Resources/paperclip.png | Bin 249 -> 249 bytes src/iOS/Resources/paperclip@2x.png | Bin 802 -> 802 bytes src/iOS/Resources/paperclip@3x.png | Bin 1151 -> 1151 bytes src/iOS/Resources/trash.png | Bin 0 -> 274 bytes src/iOS/Resources/trash@2x.png | Bin 0 -> 390 bytes src/iOS/Resources/trash@3x.png | Bin 0 -> 534 bytes src/iOS/iOS.csproj | 9 ++ 24 files changed, 142 insertions(+), 31 deletions(-) create mode 100644 src/Android/Resources/drawable-hdpi/trash.png create mode 100644 src/Android/Resources/drawable-xhdpi/trash.png create mode 100644 src/Android/Resources/drawable-xxhdpi/trash.png create mode 100644 src/Android/Resources/drawable-xxxhdpi/trash.png create mode 100644 src/Android/Resources/drawable/trash.png create mode 100644 src/iOS/Resources/trash.png create mode 100644 src/iOS/Resources/trash@2x.png create mode 100644 src/iOS/Resources/trash@3x.png diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index 3ef96d99b..8a02b77a7 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -935,6 +935,21 @@ + + + + + + + + + + + + + + + diff --git a/src/Android/Resources/Resource.Designer.cs b/src/Android/Resources/Resource.Designer.cs index 76e05e615..67d14c36c 100644 --- a/src/Android/Resources/Resource.Designer.cs +++ b/src/Android/Resources/Resource.Designer.cs @@ -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() { diff --git a/src/Android/Resources/drawable-hdpi/paperclip.png b/src/Android/Resources/drawable-hdpi/paperclip.png index 9d87e364a7a7aba5bd9fdfd541bf078bde7ec3e1..c6db5eb1bd4f3df637ae2119c54259edc924d3af 100644 GIT binary patch delta 270 ecmbQlI*E0HPW_pI1p{mUG)JZ^{mnXzX^a3@xXy9_ delta 270 fcmbQlI*E0HPW|111p{mUrngMY^ET@+rZEBlQ`z7C diff --git a/src/Android/Resources/drawable-hdpi/trash.png b/src/Android/Resources/drawable-hdpi/trash.png new file mode 100644 index 0000000000000000000000000000000000000000..19be4b36cece5dafff6fe7734ee0f0ec0caefd67 GIT binary patch literal 452 zcmeAS@N?(olHy`uVBq!ia0vp^(jd&i3?z4Pv7`g36#+gWu0YzRchBHQZd%7C0o`g| z666=mz{teH%E8IS&BMzlAR;O$Bd4UJr*B~F;O65O6q%8kU07UR-8yUTqQ&cX?K^n* z^7RK#KL7mvSFMe|257_-PZ!4!jo`OuPKq6L5NUZhX^SF9(!6A~V+vP(@1N;f-t_L? z&0pc)uauu-4cR(F8}n@M$uJz~nV6T(_jF?YrdewZ*V@)Fl<(fi=rHA* z*h=vy*Vi6pxmWhe=S1N5L$TEhqd6R{A~y5?&)**%k~i_}sYdPm51G=lcAk2srrISi oW1A0e@Z7$WJxK{_J{f|%51iFvG)78&qol`;+07R3+a{vGU literal 0 HcmV?d00001 diff --git a/src/Android/Resources/drawable-xhdpi/paperclip.png b/src/Android/Resources/drawable-xhdpi/paperclip.png index 825dee100e73d793dd180c46e1b2cd5399032b65..852e27724c2f04e05950db8caf2e7f5a5150f1c4 100644 GIT binary patch delta 321 hcmZ3)wuo(lPW_pI1p{rrDaqbvDob6rIiB$_BLKGO_!a;F delta 321 hcmZ3)wuo(lPW|111p{rrDaqbnXW3%AIiB$_BLI5N3}FBO diff --git a/src/Android/Resources/drawable-xhdpi/trash.png b/src/Android/Resources/drawable-xhdpi/trash.png new file mode 100644 index 0000000000000000000000000000000000000000..9136d27ffc878a5ec86ed979f2938611bce00d6d GIT binary patch literal 390 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k3?#4J%UA`ZDgt~$T!FMr?;iT23A(B?fOe~w z1o;IsFfy^Qvaw6ZDyx~AxqA5qmRHm_FIc)|>-L>{4xYPs`PQA6?>~P1{$$f41E7{^ zo-U3d7N_4{Imvg(fQRLRqUxL9Q3?SXr~mwyFUkmUpX$sawEf({O;eZu5MrH>vU*bJ zsZ=)GWec7pm6#;Y*x9%4$${;)pO(#1eEI63OP|RWRrRk1YUK|T&z--?%n;1jkbLM# zUGk$@{}sC97Hh4@I&^E1*xx>#oW*tjYvKbxi#%EMLLo!YHQ4c)jNv+Ej=N`_6~Ax& aFLHlYR*t=5uuUt_g$$mqelF{r5}E)3pRAPt literal 0 HcmV?d00001 diff --git a/src/Android/Resources/drawable-xxhdpi/paperclip.png b/src/Android/Resources/drawable-xxhdpi/paperclip.png index 0bb78b189c6120ad371a66e58c1e0e9d95e73d90..97eedb9eaa549c0e8771528b2e9d3beea006dabd 100644 GIT binary patch delta 418 icmey*@t;=1c|YR;CIBEeV5|TD diff --git a/src/Android/Resources/drawable-xxhdpi/trash.png b/src/Android/Resources/drawable-xxhdpi/trash.png new file mode 100644 index 0000000000000000000000000000000000000000..536fc9e46a25c73c235cbfd1a8fd0df5e6990690 GIT binary patch literal 534 zcmeAS@N?(olHy`uVBq!ia0vp^W+2SL3?z5Yp7kC`tq$-BaRt&gy?cfPQgh>M1UlEE zB*-tAfsu)Ym4lO)Urx{!}7#Uy|#&MKB70L z2;ZA;tt)2q%pi=z+&Jn-)uv19N-_?InwBk2GS1{>VF$7b@;H zT_rZgI6+fXvCOQE`Ps76ume87_O3tZf9S>~yW33*d+wk8pQK$C*cq>4_@{32BPYY7 zBEdcz-{?G!kDNAtgIz#u#Wki)w&zO}q(AdiEc@8YVJs(L=6KP>cIPiS?f8tJ;eU3u S><>~PW_pI1tZ=5M4ARa>~PW|111tZ=5M4ASFR;*d*W-g|4%mB(8po9Pb diff --git a/src/Android/Resources/drawable-xxxhdpi/trash.png b/src/Android/Resources/drawable-xxxhdpi/trash.png new file mode 100644 index 0000000000000000000000000000000000000000..97491ec48f6808551700d83e62f5c007d5242a92 GIT binary patch literal 552 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY3?!3`olAk#oB*E?S0HWEyJv7BmffN%K=&D! z1o;IsFfy^Qa&qzT35kkH$jGaznONJnd-?eK1%#!fW#=|DEnT)^?WXPfj-R@I^Ul3T zUw{7oE3ti|69WSyho_5UNW|f{*V6f$3$yS&qj-{Y9yrGTWxs@rZBva#?nI@dSN+V1rE_g1klQ3uya zCUq#bNq~u8>Qip4pI=wU*{asZ?~pG1g26#rID^xnkJE%@!79!W7KM$At+h`Gif$4X zbMW9<5fH8Ll5L6c6`_nz$=9!klr4@)dCB_N%hIRs`njxgN@xNAxE=20 literal 0 HcmV?d00001 diff --git a/src/Android/Resources/drawable/paperclip.png b/src/Android/Resources/drawable/paperclip.png index d46ad5ad99112a41586672255b78577864b5ddb3..61f4c4b4bca800bf6f431ef4d0daa9459ad140d1 100644 GIT binary patch delta 171 zcmV;c0960^0r>%tR)3zws!RHH>E49S;JQD*%tR)5W^d!%2N?oH?nuKV*#KI^l6k~q>g@MJON9C%h!QP;Ox#uv*; zqH4vLwQ2lNOB@?`v#)1;63?9_`j+e|?D(`X#;T5{3zvy)g@&&BnCEnydT^E4QrOfQ z;fU{DCmIS16FB6yJ2#1jp7}DrYTHc`haRVJ$ju~CF;Mx7PbAE!>y{`<%)0gM{rB3x Z{Q!*icpM#&LAU?_002ovPDHLkV1kcPSLy%& diff --git a/src/Android/Resources/drawable/trash.png b/src/Android/Resources/drawable/trash.png new file mode 100644 index 0000000000000000000000000000000000000000..75b96daddc40c21ffed3abb24fa68ffbe0da9431 GIT binary patch literal 274 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+3?vf;>QaGJV1Q4EE0DJ7-9tsB8h*18XsA?4 zkY6wZ6Eg?5h?I=FnT3t5gST(Y#JQ{2K6vr^=il%MV-=vPFi#i95Q*@k=Z*_D7zj9D z^gnhWsp!T(?xzXoH!Nc`+4W*B3xmksjx94%+E=Zra=ts4`Ep)HG=tXK!#1Y9%;xG! vstTNr3nt!}-g3kK(); _deviceActiveService = Resolver.Resolve(); _googleAnalyticsService = Resolver.Resolve(); + _tokenService = Resolver.Resolve(); + _cryptoService = Resolver.Resolve(); 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 { }; - 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")); + } + } } } diff --git a/src/App/Pages/Vault/VaultViewLoginPage.cs b/src/App/Pages/Vault/VaultViewLoginPage.cs index 00e60781e..b203943f0 100644 --- a/src/App/Pages/Vault/VaultViewLoginPage.cs +++ b/src/App/Pages/Vault/VaultViewLoginPage.cs @@ -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(); diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index 8953e90d3..32e061c41 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -1024,6 +1024,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Feature Unavailable. + /// + public static string FeatureUnavailable { + get { + return ResourceManager.GetString("FeatureUnavailable", resourceCulture); + } + } + /// /// Looks up a localized string similar to File. /// @@ -1267,6 +1276,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Learn More. + /// + public static string LearnMore { + get { + return ResourceManager.GetString("LearnMore", resourceCulture); + } + } + /// /// Looks up a localized string similar to Length. /// @@ -1537,6 +1555,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Maximum file size is 100 MB.. + /// + public static string MaxFileSize { + get { + return ResourceManager.GetString("MaxFileSize", resourceCulture); + } + } + /// /// Looks up a localized string similar to Minimum Numbers. /// @@ -2221,6 +2248,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to You cannot use this feature until you update your encryption key.. + /// + public static string UpdateKey { + get { + return ResourceManager.GetString("UpdateKey", resourceCulture); + } + } + /// /// Looks up a localized string similar to URI. /// diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index 7a64973c3..6ab7020d3 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -986,4 +986,16 @@ File Source + + Feature Unavailable + + + Maximum file size is 100 MB. + + + You cannot use this feature until you update your encryption key. + + + Learn More + \ No newline at end of file diff --git a/src/iOS/Resources/paperclip.png b/src/iOS/Resources/paperclip.png index d46ad5ad99112a41586672255b78577864b5ddb3..61f4c4b4bca800bf6f431ef4d0daa9459ad140d1 100644 GIT binary patch delta 171 zcmV;c0960^0r>%tR)3zws!RHH>E49S;JQD*%tR)5W^d!%2N?oH?nuKV*#KI^l6k~q>g@MJON9C%h!QP;Ox#uv*; zqH4vLwQ2lNOB@?`v#)1;63?9_`j+e|?D(`X#;T5{3zvy)g@&&BnCEnydT^E4QrOfQ z;fU{DCmIS16FB6yJ2#1jp7}DrYTHc`haRVJ$ju~CF;Mx7PbAE!>y{`<%)0gM{rB3x Z{Q!*icpM#&LAU?_002ovPDHLkV1kcPSLy%& diff --git a/src/iOS/Resources/paperclip@2x.png b/src/iOS/Resources/paperclip@2x.png index 825dee100e73d793dd180c46e1b2cd5399032b65..852e27724c2f04e05950db8caf2e7f5a5150f1c4 100644 GIT binary patch delta 321 hcmZ3)wuo(lPW_pI1p{rrDaqbvDob6rIiB$_BLKGO_!a;F delta 321 hcmZ3)wuo(lPW|111p{rrDaqbnXW3%AIiB$_BLI5N3}FBO diff --git a/src/iOS/Resources/paperclip@3x.png b/src/iOS/Resources/paperclip@3x.png index 0bb78b189c6120ad371a66e58c1e0e9d95e73d90..97eedb9eaa549c0e8771528b2e9d3beea006dabd 100644 GIT binary patch delta 418 icmey*@t;=1c|YR;CIBEeV5|TD diff --git a/src/iOS/Resources/trash.png b/src/iOS/Resources/trash.png new file mode 100644 index 0000000000000000000000000000000000000000..75b96daddc40c21ffed3abb24fa68ffbe0da9431 GIT binary patch literal 274 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+3?vf;>QaGJV1Q4EE0DJ7-9tsB8h*18XsA?4 zkY6wZ6Eg?5h?I=FnT3t5gST(Y#JQ{2K6vr^=il%MV-=vPFi#i95Q*@k=Z*_D7zj9D z^gnhWsp!T(?xzXoH!Nc`+4W*B3xmksjx94%+E=Zra=ts4`Ep)HG=tXK!#1Y9%;xG! vstTNr3nt!}-g3kK|k3?#4J%UA`ZDgt~$T!FMr?;iT23A(B?fOe~w z1o;IsFfy^Qvaw6ZDyx~AxqA5qmRHm_FIc)|>-L>{4xYPs`PQA6?>~P1{$$f41E7{^ zo-U3d7N_4{Imvg(fQRLRqUxL9Q3?SXr~mwyFUkmUpX$sawEf({O;eZu5MrH>vU*bJ zsZ=)GWec7pm6#;Y*x9%4$${;)pO(#1eEI63OP|RWRrRk1YUK|T&z--?%n;1jkbLM# zUGk$@{}sC97Hh4@I&^E1*xx>#oW*tjYvKbxi#%EMLLo!YHQ4c)jNv+Ej=N`_6~Ax& aFLHlYR*t=5uuUt_g$$mqelF{r5}E)3pRAPt literal 0 HcmV?d00001 diff --git a/src/iOS/Resources/trash@3x.png b/src/iOS/Resources/trash@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..536fc9e46a25c73c235cbfd1a8fd0df5e6990690 GIT binary patch literal 534 zcmeAS@N?(olHy`uVBq!ia0vp^W+2SL3?z5Yp7kC`tq$-BaRt&gy?cfPQgh>M1UlEE zB*-tAfsu)Ym4lO)Urx{!}7#Uy|#&MKB70L z2;ZA;tt)2q%pi=z+&Jn-)uv19N-_?InwBk2GS1{>VF$7b@;H zT_rZgI6+fXvCOQE`Ps76ume87_O3tZf9S>~yW33*d+wk8pQK$C*cq>4_@{32BPYY7 zBEdcz-{?G!kDNAtgIz#u#Wki)w&zO}q(AdiEc@8YVJs(L=6KP>cIPiS?f8tJ;eU3u S>< + + + + + + + + +