1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-26 12:16:07 +01:00

InitAppIfNeeded

This commit is contained in:
Kyle Spearrin 2019-07-22 08:22:02 -04:00
parent 13ddd10c40
commit 9164c9b946

View File

@ -34,6 +34,7 @@ namespace Bit.iOS.Autofill
public override void PrepareCredentialList(ASCredentialServiceIdentifier[] serviceIdentifiers)
{
InitAppIfNeeded();
_context.ServiceIdentifiers = serviceIdentifiers;
if(serviceIdentifiers.Length > 0)
{
@ -67,6 +68,7 @@ namespace Bit.iOS.Autofill
public override void ProvideCredentialWithoutUserInteraction(ASPasswordCredentialIdentity credentialIdentity)
{
InitAppIfNeeded();
if(!IsAuthed() || IsLocked())
{
var err = new NSError(new NSString("ASExtensionErrorDomain"),
@ -80,6 +82,7 @@ namespace Bit.iOS.Autofill
public override void PrepareInterfaceToProvideCredential(ASPasswordCredentialIdentity credentialIdentity)
{
InitAppIfNeeded();
if(!CheckAuthed())
{
return;
@ -90,6 +93,7 @@ namespace Bit.iOS.Autofill
public override void PrepareInterfaceForExtensionConfiguration()
{
InitAppIfNeeded();
_context.Configuring = true;
if(!CheckAuthed())
{
@ -260,5 +264,13 @@ namespace Bit.iOS.Autofill
iOSCoreHelpers.Bootstrap();
iOSCoreHelpers.AppearanceAdjustments();
}
private void InitAppIfNeeded()
{
if(ServiceContainer.RegisteredServices == null || ServiceContainer.RegisteredServices.Count == 0)
{
InitApp();
}
}
}
}