1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-27 21:53:57 +00: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

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