1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-28 12:35:40 +01:00

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> /// <summary>
/// Looks up a localized string similar to Always Scan. /// Looks up a localized string similar to Always Scan.
/// </summary> /// </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> /// <summary>
/// Looks up a localized string similar to Auto-fill with Bitwarden. /// Looks up a localized string similar to Auto-fill with Bitwarden.
/// </summary> /// </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> /// <summary>
/// Looks up a localized string similar to My Vault. /// Looks up a localized string similar to My Vault.
/// </summary> /// </summary>
@ -2302,7 +2338,7 @@ namespace Bit.App.Resources {
} }
/// <summary> /// <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> /// </summary>
public static string NoItemsTap { public static string NoItemsTap {
get { get {

View File

@ -606,7 +606,7 @@
<value>There are no items in your vault.</value> <value>There are no items in your vault.</value>
</data> </data>
<data name="NoItemsTap" xml:space="preserve"> <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>
<data name="NoUsernamePasswordConfigured" xml:space="preserve"> <data name="NoUsernamePasswordConfigured" xml:space="preserve">
<value>This login does not have a username or password configured.</value> <value>This login does not have a username or password configured.</value>
@ -1313,4 +1313,16 @@
<value>Updated</value> <value>Updated</value>
<comment>ex. Date this item was updated</comment> <comment>ex. Date this item was updated</comment>
</data> </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> </root>

View File

@ -55,15 +55,8 @@ namespace Bit.iOS.Autofill
{ {
_context.ServiceIdentifiers = serviceIdentifiers; _context.ServiceIdentifiers = serviceIdentifiers;
_context.UrlString = serviceIdentifiers[0].Identifier; _context.UrlString = serviceIdentifiers[0].Identifier;
if(!CheckAuthed())
var authService = Resolver.Resolve<IAuthService>();
if(!authService.IsAuthenticated)
{ {
var alert = Dialogs.CreateAlert(null, AppResources.MustLogInMainApp, AppResources.Ok, (a) =>
{
CompleteRequest();
});
PresentViewController(alert, true, null);
return; return;
} }
@ -110,37 +103,21 @@ namespace Bit.iOS.Autofill
public override void PrepareInterfaceToProvideCredential(ASPasswordCredentialIdentity credentialIdentity) public override void PrepareInterfaceToProvideCredential(ASPasswordCredentialIdentity credentialIdentity)
{ {
var authService = Resolver.Resolve<IAuthService>(); if(!CheckAuthed())
if(!authService.IsAuthenticated)
{ {
var alert = Dialogs.CreateAlert(null, AppResources.MustLogInMainApp, AppResources.Ok, (a) =>
{
CompleteRequest();
});
PresentViewController(alert, true, null);
return; return;
} }
_context.CredentialIdentity = credentialIdentity; _context.CredentialIdentity = credentialIdentity;
CheckLock(() => ProvideCredential()); CheckLock(() => ProvideCredential());
} }
public override void PrepareInterfaceForExtensionConfiguration() public override void PrepareInterfaceForExtensionConfiguration()
{ {
System.Diagnostics.Debug.WriteLine("AUTOFILL BITWARDEN: PrepareInterfaceForExtensionConfiguration");
_context.Configuring = true; _context.Configuring = true;
if(!CheckAuthed())
var authService = Resolver.Resolve<IAuthService>();
if(!authService.IsAuthenticated)
{ {
var alert = Dialogs.CreateAlert(null, AppResources.MustLogInMainApp, AppResources.Ok, (a) =>
{
CompleteRequest();
});
PresentViewController(alert, true, null);
return; return;
} }
CheckLock(() => PerformSegue("setupSegue", this)); 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() private void SetIoc()
{ {
var container = new Container(); var container = new Container();

View File

@ -1,22 +1,11 @@
using System; using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using Bit.App.Abstractions;
using Bit.iOS.Autofill.Models; using Bit.iOS.Autofill.Models;
using Foundation; using Foundation;
using UIKit; using UIKit;
using XLabs.Ioc;
using Plugin.Settings.Abstractions;
using Bit.iOS.Core.Utilities; using Bit.iOS.Core.Utilities;
using System.Threading.Tasks;
using Bit.iOS.Core;
using MobileCoreServices;
using Bit.iOS.Core.Controllers; using Bit.iOS.Core.Controllers;
using Bit.App.Resources; using Bit.App.Resources;
using Bit.App.Models;
using Bit.App.Utilities;
using Bit.iOS.Core.Models;
using Bit.iOS.Core.Views; using Bit.iOS.Core.Views;
namespace Bit.iOS.Autofill namespace Bit.iOS.Autofill
@ -121,8 +110,7 @@ namespace Bit.iOS.Autofill
_controller.CPViewController.CompleteRequest(item.Username, item.Password, totp); _controller.CPViewController.CompleteRequest(item.Username, item.Password, totp);
} }
else if(!string.IsNullOrWhiteSpace(item.Username) || !string.IsNullOrWhiteSpace(item.Password) || else if(!string.IsNullOrWhiteSpace(item.Username) || !string.IsNullOrWhiteSpace(item.Totp.Value))
!string.IsNullOrWhiteSpace(item.Totp.Value))
{ {
var sheet = Dialogs.CreateActionSheet(item.Name, _controller); var sheet = Dialogs.CreateActionSheet(item.Name, _controller);
if(!string.IsNullOrWhiteSpace(item.Username)) 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)) if(!string.IsNullOrWhiteSpace(item.Totp.Value))
{ {
sheet.AddAction(UIAlertAction.Create(AppResources.CopyTotp, UIAlertActionStyle.Default, a => sheet.AddAction(UIAlertAction.Create(AppResources.CopyTotp, UIAlertActionStyle.Default, a =>

View File

@ -548,7 +548,7 @@
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/> <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </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"/> <rect key="frame" x="255" y="205.5" width="90" height="90"/>
</imageView> </imageView>
</subviews> </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); View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
var descriptor = UIFontDescriptor.PreferredBody; var descriptor = UIFontDescriptor.PreferredBody;
DescriptionLabel.Text = $@"{AppResources.ExtensionSetup} DescriptionLabel.Text = $@"{AppResources.AutofillSetup}
{AppResources.ExtensionSetup2}"; {AppResources.AutofillSetup2}";
DescriptionLabel.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize); DescriptionLabel.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize);
DescriptionLabel.TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f); 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); ActivatedLabel.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize * 1.3f);
BackButton.Title = AppResources.Back; BackButton.Title = AppResources.Back;

View File

@ -286,5 +286,14 @@
<Version>2.0.5782</Version> <Version>2.0.5782</Version>
</PackageReference> </PackageReference>
</ItemGroup> </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" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.AppExtension.CSharp.targets" />
</Project> </Project>