using AuthenticationServices; using Bit.App.Abstractions; using Bit.App.Repositories; using Bit.App.Resources; using Bit.App.Services; using Bit.iOS.Autofill.Models; using Bit.iOS.Core.Services; using Foundation; using Plugin.Connectivity; using Plugin.Fingerprint; using Plugin.Settings.Abstractions; using SimpleInjector; using System; using UIKit; using XLabs.Ioc; using XLabs.Ioc.SimpleInjectorContainer; namespace Bit.iOS.Autofill { public partial class CredentialProviderViewController : ASCredentialProviderViewController { private Context _context = new Context(); public CredentialProviderViewController (IntPtr handle) : base (handle) { } public override void ViewDidLoad() { SetIoc(); SetCulture(); base.ViewDidLoad(); _context.ExtContext = ExtensionContext; // TODO: HockeyApp } public override void PrepareCredentialList(ASCredentialServiceIdentifier[] serviceIdentifiers) { System.Diagnostics.Debug.WriteLine("AUTOFILL Got identifiers " + serviceIdentifiers.Length); base.PrepareCredentialList(serviceIdentifiers); } public override void ProvideCredentialWithoutUserInteraction(ASPasswordCredentialIdentity credentialIdentity) { base.ProvideCredentialWithoutUserInteraction(credentialIdentity); } public override void PrepareInterfaceToProvideCredential(ASPasswordCredentialIdentity credentialIdentity) { base.PrepareInterfaceToProvideCredential(credentialIdentity); } public override void PrepareInterfaceForExtensionConfiguration() { base.PrepareInterfaceForExtensionConfiguration(); } private void SetIoc() { var container = new Container(); // Services container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); // Repositories container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); // Other container.RegisterSingleton(CrossConnectivity.Current); container.RegisterSingleton(CrossFingerprint.Current); var settings = new Settings("group.com.8bit.bitwarden"); container.RegisterSingleton(settings); Resolver.ResetResolver(new SimpleInjectorResolver(container)); } private void SetCulture() { var localizeService = Resolver.Resolve(); var ci = localizeService.GetCurrentCultureInfo(); AppResources.Culture = ci; localizeService.SetLocale(ci); } } }