cleanup and updated resource strings for autofill

This commit is contained in:
Kyle Spearrin 2018-09-21 15:32:12 -04:00
parent e613198252
commit fce2a7ba94
10 changed files with 82 additions and 59 deletions

View File

@ -312,6 +312,15 @@ namespace Bit.App.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to AutoFill Activated!.
/// </summary>
public static string AutofillActivated {
get {
return ResourceManager.GetString("AutofillActivated", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Always Scan.
/// </summary>
@ -402,6 +411,24 @@ namespace Bit.App.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Your logins are now easily accessable right from your keyboard while logging into apps and websites..
/// </summary>
public static string AutofillSetup {
get {
return ResourceManager.GetString("AutofillSetup", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to We recommend disabling any other AutoFill apps under Settings if you do not plan to use them..
/// </summary>
public static string AutofillSetup2 {
get {
return ResourceManager.GetString("AutofillSetup2", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Auto-fill with Bitwarden.
/// </summary>
@ -2175,6 +2202,15 @@ namespace Bit.App.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to You must log into the main Bitwarden app before you can use AutoFill..
/// </summary>
public static string MustLogInMainAppAutofill {
get {
return ResourceManager.GetString("MustLogInMainAppAutofill", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to My Vault.
/// </summary>
@ -2302,7 +2338,7 @@ namespace Bit.App.Resources {
}
/// <summary>
/// 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..
/// </summary>
public static string NoItemsTap {
get {

View File

@ -606,7 +606,7 @@
<value>There are no items in your vault.</value>
</data>
<data name="NoItemsTap" xml:space="preserve">
<value>There are no items in your vault for this website. Tap to add one.</value>
<value>There are no items in your vault for this website/app. Tap to add one.</value>
</data>
<data name="NoUsernamePasswordConfigured" xml:space="preserve">
<value>This login does not have a username or password configured.</value>
@ -1313,4 +1313,16 @@
<value>Updated</value>
<comment>ex. Date this item was updated</comment>
</data>
<data name="AutofillActivated" xml:space="preserve">
<value>AutoFill Activated!</value>
</data>
<data name="MustLogInMainAppAutofill" xml:space="preserve">
<value>You must log into the main Bitwarden app before you can use AutoFill.</value>
</data>
<data name="AutofillSetup" xml:space="preserve">
<value>Your logins are now easily accessable right from your keyboard while logging into apps and websites.</value>
</data>
<data name="AutofillSetup2" xml:space="preserve">
<value>We recommend disabling any other AutoFill apps under Settings if you do not plan to use them.</value>
</data>
</root>

View File

@ -55,15 +55,8 @@ namespace Bit.iOS.Autofill
{
_context.ServiceIdentifiers = serviceIdentifiers;
_context.UrlString = serviceIdentifiers[0].Identifier;
var authService = Resolver.Resolve<IAuthService>();
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<IAuthService>();
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<IAuthService>();
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<IAuthService>();
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();

View File

@ -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 =>

View File

@ -548,7 +548,7 @@
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="11094" translatesAutoresizingMaskIntoConstraints="NO" image="ext-icon.png" misplaced="YES" ambiguous="YES">
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="11094" translatesAutoresizingMaskIntoConstraints="NO" image="check.png" misplaced="YES" ambiguous="YES">
<rect key="frame" x="255" y="205.5" width="90" height="90"/>
</imageView>
</subviews>

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -26,13 +26,13 @@ namespace Bit.iOS.Autofill
{
View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
var descriptor = UIFontDescriptor.PreferredBody;
DescriptionLabel.Text = $@"{AppResources.ExtensionSetup}
DescriptionLabel.Text = $@"{AppResources.AutofillSetup}
{AppResources.ExtensionSetup2}";
{AppResources.AutofillSetup2}";
DescriptionLabel.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize);
DescriptionLabel.TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f);
ActivatedLabel.Text = AppResources.ExtensionActivated;
ActivatedLabel.Text = AppResources.AutofillActivated;
ActivatedLabel.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize * 1.3f);
BackButton.Title = AppResources.Back;

View File

@ -286,5 +286,14 @@
<Version>2.0.5782</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\check.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\check%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\check%403x.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.AppExtension.CSharp.targets" />
</Project>