From 9164c9b946180de3447d2d76b4019556a4fcae2c Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 22 Jul 2019 08:22:02 -0400 Subject: [PATCH] InitAppIfNeeded --- src/iOS.Autofill/CredentialProviderViewController.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/iOS.Autofill/CredentialProviderViewController.cs b/src/iOS.Autofill/CredentialProviderViewController.cs index f738898fe..892620bce 100644 --- a/src/iOS.Autofill/CredentialProviderViewController.cs +++ b/src/iOS.Autofill/CredentialProviderViewController.cs @@ -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(); + } + } } } \ No newline at end of file