mirror of
https://github.com/bitwarden/android.git
synced 2024-11-01 07:35:52 +03:00
formatting
This commit is contained in:
parent
b0c6c09cea
commit
24304c2f55
1 changed files with 18 additions and 18 deletions
|
@ -26,8 +26,7 @@ namespace Bit.iOS.Autofill
|
||||||
private IGoogleAnalyticsService _googleAnalyticsService;
|
private IGoogleAnalyticsService _googleAnalyticsService;
|
||||||
|
|
||||||
public CredentialProviderViewController(IntPtr handle) : base(handle)
|
public CredentialProviderViewController(IntPtr handle) : base(handle)
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
public override void ViewDidLoad()
|
public override void ViewDidLoad()
|
||||||
{
|
{
|
||||||
|
@ -71,7 +70,7 @@ namespace Bit.iOS.Autofill
|
||||||
|
|
||||||
var lockService = Resolver.Resolve<ILockService>();
|
var lockService = Resolver.Resolve<ILockService>();
|
||||||
var lockType = lockService.GetLockTypeAsync(false).GetAwaiter().GetResult();
|
var lockType = lockService.GetLockTypeAsync(false).GetAwaiter().GetResult();
|
||||||
switch (lockType)
|
switch(lockType)
|
||||||
{
|
{
|
||||||
case App.Enums.LockType.Fingerprint:
|
case App.Enums.LockType.Fingerprint:
|
||||||
PerformSegue("lockFingerprintSegue", this);
|
PerformSegue("lockFingerprintSegue", this);
|
||||||
|
@ -94,16 +93,17 @@ namespace Bit.iOS.Autofill
|
||||||
|
|
||||||
bool canGetCredentials = false;
|
bool canGetCredentials = false;
|
||||||
var authService = Resolver.Resolve<IAuthService>();
|
var authService = Resolver.Resolve<IAuthService>();
|
||||||
if (authService.IsAuthenticated)
|
if(authService.IsAuthenticated)
|
||||||
{
|
{
|
||||||
var lockService = Resolver.Resolve<ILockService>();
|
var lockService = Resolver.Resolve<ILockService>();
|
||||||
var lockType = lockService.GetLockTypeAsync(false).GetAwaiter().GetResult();
|
var lockType = lockService.GetLockTypeAsync(false).GetAwaiter().GetResult();
|
||||||
canGetCredentials = lockType == App.Enums.LockType.None;
|
canGetCredentials = lockType == App.Enums.LockType.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!canGetCredentials) {
|
if(!canGetCredentials)
|
||||||
|
{
|
||||||
var err = new NSError(new NSString("ASExtensionErrorDomain"),
|
var err = new NSError(new NSString("ASExtensionErrorDomain"),
|
||||||
Convert.ToInt32(ASExtensionErrorCode.UserInteractionRequired), null);
|
Convert.ToInt32(ASExtensionErrorCode.UserInteractionRequired), null);
|
||||||
ExtensionContext.CancelRequest(err);
|
ExtensionContext.CancelRequest(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ namespace Bit.iOS.Autofill
|
||||||
public override void PrepareInterfaceToProvideCredential(ASPasswordCredentialIdentity credentialIdentity)
|
public override void PrepareInterfaceToProvideCredential(ASPasswordCredentialIdentity credentialIdentity)
|
||||||
{
|
{
|
||||||
var authService = Resolver.Resolve<IAuthService>();
|
var authService = Resolver.Resolve<IAuthService>();
|
||||||
if (!authService.IsAuthenticated)
|
if(!authService.IsAuthenticated)
|
||||||
{
|
{
|
||||||
var alert = Dialogs.CreateAlert(null, AppResources.MustLogInMainApp, AppResources.Ok, (a) =>
|
var alert = Dialogs.CreateAlert(null, AppResources.MustLogInMainApp, AppResources.Ok, (a) =>
|
||||||
{
|
{
|
||||||
|
@ -127,7 +127,7 @@ namespace Bit.iOS.Autofill
|
||||||
_context.CredentialIdentity = credentialIdentity;
|
_context.CredentialIdentity = credentialIdentity;
|
||||||
var lockService = Resolver.Resolve<ILockService>();
|
var lockService = Resolver.Resolve<ILockService>();
|
||||||
var lockType = lockService.GetLockTypeAsync(false).GetAwaiter().GetResult();
|
var lockType = lockService.GetLockTypeAsync(false).GetAwaiter().GetResult();
|
||||||
switch (lockType)
|
switch(lockType)
|
||||||
{
|
{
|
||||||
case App.Enums.LockType.Fingerprint:
|
case App.Enums.LockType.Fingerprint:
|
||||||
PerformSegue("lockFingerprintSegue", this);
|
PerformSegue("lockFingerprintSegue", this);
|
||||||
|
@ -185,27 +185,27 @@ namespace Bit.iOS.Autofill
|
||||||
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
|
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
|
||||||
{
|
{
|
||||||
var navController = segue.DestinationViewController as UINavigationController;
|
var navController = segue.DestinationViewController as UINavigationController;
|
||||||
if (navController != null)
|
if(navController != null)
|
||||||
{
|
{
|
||||||
var listLoginController = navController.TopViewController as LoginListViewController;
|
var listLoginController = navController.TopViewController as LoginListViewController;
|
||||||
var fingerprintViewController = navController.TopViewController as LockFingerprintViewController;
|
var fingerprintViewController = navController.TopViewController as LockFingerprintViewController;
|
||||||
var pinViewController = navController.TopViewController as LockPinViewController;
|
var pinViewController = navController.TopViewController as LockPinViewController;
|
||||||
var passwordViewController = navController.TopViewController as LockPasswordViewController;
|
var passwordViewController = navController.TopViewController as LockPasswordViewController;
|
||||||
|
|
||||||
if (listLoginController != null)
|
if(listLoginController != null)
|
||||||
{
|
{
|
||||||
listLoginController.Context = _context;
|
listLoginController.Context = _context;
|
||||||
listLoginController.CPViewController = this;
|
listLoginController.CPViewController = this;
|
||||||
}
|
}
|
||||||
else if (fingerprintViewController != null)
|
else if(fingerprintViewController != null)
|
||||||
{
|
{
|
||||||
fingerprintViewController.CPViewController = this;
|
fingerprintViewController.CPViewController = this;
|
||||||
}
|
}
|
||||||
else if (pinViewController != null)
|
else if(pinViewController != null)
|
||||||
{
|
{
|
||||||
pinViewController.CPViewController = this;
|
pinViewController.CPViewController = this;
|
||||||
}
|
}
|
||||||
else if (passwordViewController != null)
|
else if(passwordViewController != null)
|
||||||
{
|
{
|
||||||
passwordViewController.CPViewController = this;
|
passwordViewController.CPViewController = this;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,8 @@ namespace Bit.iOS.Autofill
|
||||||
{
|
{
|
||||||
DismissViewController(false, () =>
|
DismissViewController(false, () =>
|
||||||
{
|
{
|
||||||
if(_context.CredentialIdentity != null) {
|
if(_context.CredentialIdentity != null)
|
||||||
|
{
|
||||||
ProvideCredential();
|
ProvideCredential();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -228,16 +229,15 @@ namespace Bit.iOS.Autofill
|
||||||
{
|
{
|
||||||
var cipherService = Resolver.Resolve<ICipherService>();
|
var cipherService = Resolver.Resolve<ICipherService>();
|
||||||
var cipher = cipherService.GetByIdAsync(_context.CredentialIdentity.RecordIdentifier).GetAwaiter().GetResult();
|
var cipher = cipherService.GetByIdAsync(_context.CredentialIdentity.RecordIdentifier).GetAwaiter().GetResult();
|
||||||
if (cipher == null || cipher.Type != App.Enums.CipherType.Login)
|
if(cipher == null || cipher.Type != App.Enums.CipherType.Login)
|
||||||
{
|
{
|
||||||
var err = new NSError(new NSString("ASExtensionErrorDomain"),
|
var err = new NSError(new NSString("ASExtensionErrorDomain"),
|
||||||
Convert.ToInt32(ASExtensionErrorCode.CredentialIdentityNotFound), null);
|
Convert.ToInt32(ASExtensionErrorCode.CredentialIdentityNotFound), null);
|
||||||
ExtensionContext.CancelRequest(err);
|
ExtensionContext.CancelRequest(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompleteRequest(
|
CompleteRequest(cipher.Login.Username?.Decrypt(cipher.OrganizationId),
|
||||||
cipher.Login.Username?.Decrypt(cipher.OrganizationId),
|
|
||||||
cipher.Login.Password?.Decrypt(cipher.OrganizationId),
|
cipher.Login.Password?.Decrypt(cipher.OrganizationId),
|
||||||
cipher.Login.Totp?.Decrypt(cipher.OrganizationId));
|
cipher.Login.Totp?.Decrypt(cipher.OrganizationId));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue