From fce2a7ba94af9b9418b270f2f49fa5c0dfd5fa8b Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 21 Sep 2018 15:32:12 -0400 Subject: [PATCH] cleanup and updated resource strings for autofill --- src/App/Resources/AppResources.Designer.cs | 38 ++++++++++++++- src/App/Resources/AppResources.resx | 14 +++++- .../CredentialProviderViewController.cs | 44 +++++++----------- src/iOS.Autofill/LoginListViewController.cs | 28 +---------- src/iOS.Autofill/MainInterface.storyboard | 2 +- src/iOS.Autofill/Resources/check.png | Bin 0 -> 746 bytes src/iOS.Autofill/Resources/check@2x.png | Bin 0 -> 1233 bytes src/iOS.Autofill/Resources/check@3x.png | Bin 0 -> 1820 bytes src/iOS.Autofill/SetupViewController.cs | 6 +-- src/iOS.Autofill/iOS.Autofill.csproj | 9 ++++ 10 files changed, 82 insertions(+), 59 deletions(-) create mode 100644 src/iOS.Autofill/Resources/check.png create mode 100644 src/iOS.Autofill/Resources/check@2x.png create mode 100644 src/iOS.Autofill/Resources/check@3x.png diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index 42b0e164a..809505e93 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -312,6 +312,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to AutoFill Activated!. + /// + public static string AutofillActivated { + get { + return ResourceManager.GetString("AutofillActivated", resourceCulture); + } + } + /// /// Looks up a localized string similar to Always Scan. /// @@ -402,6 +411,24 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Your logins are now easily accessable right from your keyboard while logging into apps and websites.. + /// + public static string AutofillSetup { + get { + return ResourceManager.GetString("AutofillSetup", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to We recommend disabling any other AutoFill apps under Settings if you do not plan to use them.. + /// + public static string AutofillSetup2 { + get { + return ResourceManager.GetString("AutofillSetup2", resourceCulture); + } + } + /// /// Looks up a localized string similar to Auto-fill with Bitwarden. /// @@ -2175,6 +2202,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to You must log into the main Bitwarden app before you can use AutoFill.. + /// + public static string MustLogInMainAppAutofill { + get { + return ResourceManager.GetString("MustLogInMainAppAutofill", resourceCulture); + } + } + /// /// Looks up a localized string similar to My Vault. /// @@ -2302,7 +2338,7 @@ namespace Bit.App.Resources { } /// - /// Looks up a localized string similar to There are no items in your vault for this website. Tap to add one.. + /// Looks up a localized string similar to There are no items in your vault for this website/app. Tap to add one.. /// public static string NoItemsTap { get { diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index 916264ae4..a449aca4e 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -606,7 +606,7 @@ There are no items in your vault. - There are no items in your vault for this website. Tap to add one. + There are no items in your vault for this website/app. Tap to add one. This login does not have a username or password configured. @@ -1313,4 +1313,16 @@ Updated ex. Date this item was updated + + AutoFill Activated! + + + You must log into the main Bitwarden app before you can use AutoFill. + + + Your logins are now easily accessable right from your keyboard while logging into apps and websites. + + + We recommend disabling any other AutoFill apps under Settings if you do not plan to use them. + \ No newline at end of file diff --git a/src/iOS.Autofill/CredentialProviderViewController.cs b/src/iOS.Autofill/CredentialProviderViewController.cs index ab09a781c..bfa7cf93a 100644 --- a/src/iOS.Autofill/CredentialProviderViewController.cs +++ b/src/iOS.Autofill/CredentialProviderViewController.cs @@ -55,15 +55,8 @@ namespace Bit.iOS.Autofill { _context.ServiceIdentifiers = serviceIdentifiers; _context.UrlString = serviceIdentifiers[0].Identifier; - - var authService = Resolver.Resolve(); - if(!authService.IsAuthenticated) + if(!CheckAuthed()) { - var alert = Dialogs.CreateAlert(null, AppResources.MustLogInMainApp, AppResources.Ok, (a) => - { - CompleteRequest(); - }); - PresentViewController(alert, true, null); return; } @@ -110,37 +103,21 @@ namespace Bit.iOS.Autofill public override void PrepareInterfaceToProvideCredential(ASPasswordCredentialIdentity credentialIdentity) { - var authService = Resolver.Resolve(); - if(!authService.IsAuthenticated) + if(!CheckAuthed()) { - var alert = Dialogs.CreateAlert(null, AppResources.MustLogInMainApp, AppResources.Ok, (a) => - { - CompleteRequest(); - }); - PresentViewController(alert, true, null); return; } - _context.CredentialIdentity = credentialIdentity; CheckLock(() => ProvideCredential()); } public override void PrepareInterfaceForExtensionConfiguration() { - System.Diagnostics.Debug.WriteLine("AUTOFILL BITWARDEN: PrepareInterfaceForExtensionConfiguration"); _context.Configuring = true; - - var authService = Resolver.Resolve(); - if(!authService.IsAuthenticated) + if(!CheckAuthed()) { - var alert = Dialogs.CreateAlert(null, AppResources.MustLogInMainApp, AppResources.Ok, (a) => - { - CompleteRequest(); - }); - PresentViewController(alert, true, null); return; } - CheckLock(() => PerformSegue("setupSegue", this)); } @@ -274,6 +251,21 @@ namespace Bit.iOS.Autofill } } + private bool CheckAuthed() + { + var authService = Resolver.Resolve(); + if(!authService.IsAuthenticated) + { + var alert = Dialogs.CreateAlert(null, AppResources.MustLogInMainAppAutofill, AppResources.Ok, (a) => + { + CompleteRequest(); + }); + PresentViewController(alert, true, null); + return false; + } + return true; + } + private void SetIoc() { var container = new Container(); diff --git a/src/iOS.Autofill/LoginListViewController.cs b/src/iOS.Autofill/LoginListViewController.cs index 2690ea1a0..33d3db4dc 100644 --- a/src/iOS.Autofill/LoginListViewController.cs +++ b/src/iOS.Autofill/LoginListViewController.cs @@ -1,22 +1,11 @@ using System; -using System.Collections.Generic; -using System.Diagnostics; using System.Linq; -using Bit.App.Abstractions; using Bit.iOS.Autofill.Models; using Foundation; using UIKit; -using XLabs.Ioc; -using Plugin.Settings.Abstractions; using Bit.iOS.Core.Utilities; -using System.Threading.Tasks; -using Bit.iOS.Core; -using MobileCoreServices; using Bit.iOS.Core.Controllers; using Bit.App.Resources; -using Bit.App.Models; -using Bit.App.Utilities; -using Bit.iOS.Core.Models; using Bit.iOS.Core.Views; namespace Bit.iOS.Autofill @@ -121,8 +110,7 @@ namespace Bit.iOS.Autofill _controller.CPViewController.CompleteRequest(item.Username, item.Password, totp); } - else if(!string.IsNullOrWhiteSpace(item.Username) || !string.IsNullOrWhiteSpace(item.Password) || - !string.IsNullOrWhiteSpace(item.Totp.Value)) + else if(!string.IsNullOrWhiteSpace(item.Username) || !string.IsNullOrWhiteSpace(item.Totp.Value)) { var sheet = Dialogs.CreateActionSheet(item.Name, _controller); if(!string.IsNullOrWhiteSpace(item.Username)) @@ -139,20 +127,6 @@ namespace Bit.iOS.Autofill })); } - if(!string.IsNullOrWhiteSpace(item.Password)) - { - sheet.AddAction(UIAlertAction.Create(AppResources.CopyPassword, UIAlertActionStyle.Default, a => - { - UIPasteboard clipboard = UIPasteboard.General; - clipboard.String = item.Password; - var alert = Dialogs.CreateMessageAlert(AppResources.CopiedPassword); - _controller.PresentViewController(alert, true, () => - { - _controller.DismissViewController(true, null); - }); - })); - } - if(!string.IsNullOrWhiteSpace(item.Totp.Value)) { sheet.AddAction(UIAlertAction.Create(AppResources.CopyTotp, UIAlertActionStyle.Default, a => diff --git a/src/iOS.Autofill/MainInterface.storyboard b/src/iOS.Autofill/MainInterface.storyboard index e0d0b6a73..e0c5819a5 100644 --- a/src/iOS.Autofill/MainInterface.storyboard +++ b/src/iOS.Autofill/MainInterface.storyboard @@ -548,7 +548,7 @@ - + diff --git a/src/iOS.Autofill/Resources/check.png b/src/iOS.Autofill/Resources/check.png new file mode 100644 index 0000000000000000000000000000000000000000..64c9cc5a304c58fae18345c3a4249c1ee848efe5 GIT binary patch literal 746 zcmeAS@N?(olHy`uVBq!ia0vp^Q6S903?%u>HW~n_O94J1u0UG(f$DHV&l)=)0)6FL z666=mz{teH%Fe;b%O@ZxBrGB-CN3c(AfIf;z((7#N#8T^vIq4!^yT?$6{XaO@)^t2I~B zd)}#s?`b#L-2borla2Smy=^l+dv5-}ef#IrNxO5t^=VA?`ny{#eA+3k4_9m%V){>? z{>sO|aQ=~b-1|lMyEp9pq3nIXJlA2`*7j7->X2!h>rWq;+!6bl!D?G1n_PFy&RNRL z(OE`uS5p=&P-|A!k9cZrDtS8VlcMv#4X4glRQ`K^V(Hn{x94W^R=yQx*zk6W_QFrc zzAv3Nizg*((_hBVDGyBI^FBYRxviLu@mUxJ-ag(p>E#`(E$1h!{E{YnTY1q;ix`0YH)Yu_e5&at;V_HF9n+3$uaMol9LIv w&3=lh$G*$v` zO-xCUUoZnB6Eh1d8#@;_4=*3TfS{1DsDz}HjJ$%Ps=AhriJ7^TwWpVFKumr?VR1=m zMN?~AM`w3WU;o5OQ>IRzF>ChRMa$N%->`GvfrBT`U%q+PM);9y6A)`$B%RP-9Ublz!eXuMmoplSDxCP9vapa0jl$8X^Y z^LTgWi%)s<-#Wi%c2jpvU8N$^VRQa73?=8U2)xM@K0WLk!{h%PeVM z^Sft0cck<;?vG|W%XY=~%&V)mXHQ*apV4@m?QGZ8t5ONRcdxGru|2?}BW0o;627{@ zv{ZMqQK|1{tB~JDaq=gIOIv;M`i)#Luwz4=`ncE;H|mcRbCL89Ex9q&1%AB&xd|6l3#yT#VH zIqCq%dPfq_$W9Hk78=t9G7H^1Z zmAoOPn>O#c5p(qMw=xtg5P{(U(r2d^$YGAd!y>r8?lRhQ8lF!EkoXyZ%mS!p* zWIVfj#m%#JBCp;&BY8FQzg69$R;cwJ9mQD-n-+Rd%&k;)z;Ps!22WQ%mvv4F FO#p;gDNFzW literal 0 HcmV?d00001 diff --git a/src/iOS.Autofill/Resources/check@3x.png b/src/iOS.Autofill/Resources/check@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..759ca1e74523dee02ad3ec5f5d8d767833baba80 GIT binary patch literal 1820 zcmeH{`#aMM0LCXBEBd;0_m!`+Ryd_HjUJbUmTlzrpb(Lx*m7JFwizjAL)NC8cvR8v^E~hSKF{a<@%`aVcX!1D>YzFd1_K-k z$30*$70rLVL3OQhi`hb>r~gP!8d4Z z0yMR>H*ejxeaB8+P;Zw$Wbh+mH*(KjLnGs#_U$)0aPW{R%F6mE7Ke9s@$fq39}x6& z@VSssA}Q>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